[issue14591] Value returned by random.random() out of valid range

2012-04-19 Thread Mark Dickinson

Mark Dickinson  added the comment:

The latest patch has the disadvantage that it'll often change the behaviour of 
jumpahead for people on 32-bit platforms, which may lead to unnecessary 
breakage.

Here's a better version that only fixes mt[0] in the unlikely (but possible) 
event that mt[1] through mt[623] are all zero.  That should mean that users on 
32-bit machines who are depending on jumpahead being reproducible won't notice 
(unless they're very unlucky indeed).

--
Added file: http://bugs.python.org/file25268/random_jumpahead_3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14590] ConfigParser doesn't strip inline comment when delimiter occurs earlier without preceding space.

2012-04-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

INI files won't go away and there will come a time where 3.3 is old. Since 3.2 
inline comments are turned off by default which mitigates the problem. Fixing 
this parser bug for the 3.3 release seems safe enough for me as long as you 
clearly state in NEWS and the docs that it changed. I'll leave 2.7 and 3.2 
behind as to my doubts stated in the previous comment.

--
versions:  -Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14619] Enhanced variable substitution for databases

2012-04-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

I agree this would be very handy, but the database engines I know which accept 
"bind variables" (Oracle, MySQL, JDBC) only accept simple types.
So to handle ?? it would be necessary to modify the SQL statement passed to the 
database server: "name in (?, ?, ?)".

This has some drawbacks IMO:
- One advantage of bind variables is that the SQL server sees the same 
statement for different invocations of execute() and thus can reuse computed 
data (parsed query, execution plan, etc) .  The "??" placeholder would silently 
kill this optimization.
- cursor.executemany() would have to format and pass a different statement for 
each row, which would break the implementations that prepare the statement once 
and pass all the rows in a single call.
- cx_Oracle has a cursor.prepare(stmt) function which explicitly exposes the 
above mechanism; it could not work with "??".

Yes, the IN operator in SQL is difficult to address.  I've tried several 
approaches to this, one of them was to create a temporary table and joint it in 
the main query...

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-19 Thread Eric Snow

Eric Snow  added the comment:

Looking it over, I'm confident that tokenizer.detect_encoding() does not raise 
a SyntaxError where PyTokenizer_FindEncodingFilename() does.  I've run out of 
time tonight, but I'll look at it more tomorrow.

Once find_module() is done, I'd like to move on to reload(), which I expect 
will be pretty straightforward at this point.  Then the feasibility of 
issue14618 should be clear.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14601] PEP sources not available as documented

2012-04-19 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Not sure how it was supposed to be fixed in the past, as the docutils formatter 
would happily use whatever URL the docutils release had in place. I now fixed 
it for real (I hope) in 34076bfed420

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14620] Fatal Python error: Cannot recover from stack overflow.

2012-04-19 Thread Florian Bruhin

New submission from Florian Bruhin :

Hey,

I just got the error message in the title when trying to run a script with 
python.

You can find the coredump, stacktrace, and the scripts I ran at 
http://the-compiler.org/tmp/pythoncrash/

The command line I ran:
python -u pythonomegle.py

Running Python 3.2.2 on Archlinux.

--
components: None
messages: 158706
nosy: The-Compiler
priority: normal
severity: normal
status: open
title: Fatal Python error: Cannot recover from stack overflow.
type: crash
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14619] Enhanced variable substitution for databases

2012-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Raymond, the variable substitution is normally done by the database and not the 
Python database modules, so you'd have to ask the database maintainers for 
assistance.

The qmark ('?') parameter style is part of the ODBC standard, so it's unlikely 
that this will get changed any time soon unless you have good contacts with 
Microsoft :-)

The ODBC standard also doesn't support multi-value substitutions in the API, so 
there's no way to pass the array to the database driver.

BTW: Such things are better discussed on the DB-SIG mailing list than the 
Python tracker.

--
nosy: +lemburg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7980] time.strptime not thread safe

2012-04-19 Thread Cédric Krier

Changes by Cédric Krier :


--
nosy: +ced

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14611] inspect.getargs fails on some anonymous tuples

2012-04-19 Thread Stefano Taschini

Stefano Taschini  added the comment:

I think this should do.

inspect.getargs is now looking for STORE_DEREF besides STORE_FAST, and is 
making sure that the appropriate namespace (locals vs cell + free vars) is 
selected depending on the opcode.

The only changes to the test suite are three additional tests, based on the two 
examples above.

--
keywords: +patch
Added file: http://bugs.python.org/file25269/issue_14611.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14381] Intern certain integral floats for memory savings and performance

2012-04-19 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Why do you think it isn't safe, Antoine?

It violates C's strict aliasing rules;  Google for 'C strict aliasing' or 'C 
type punning' for more information.  This isn't just a theoretical concern:  
gcc is known to make optimizations based on the assumption that strict aliasing 
isn't violated.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14423] Getting the starting date of iso week from a week number and a year.

2012-04-19 Thread Esben Agerbæk Black

Esben Agerbæk Black  added the comment:

>> 2) I get errors for all my test when I build "my" python and run
>> "./python.exe -m test.datetimetester -j3"
>> I asume this is because I have yet to implement the c version in
>> Modules/_datetimemodule.c
>> is this the correct assumption?

>You should probably run "./python.exe -m test -v test_datetime" instead.
>Not sure that will fix your test failures, though :)

Ok so now i only get errors for "_Fast" tests am I correct in assuming that 
this is because i lack a C implementation?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-19 Thread sbt

sbt  added the comment:

Up to date patch.

--
Added file: http://bugs.python.org/file25270/mp_pickle_conn.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14381] Intern certain integral floats for memory savings and performance

2012-04-19 Thread Mark Dickinson

Mark Dickinson  added the comment:

> We only support IEEE platforms.

I don't think that's true, BTW.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11618] Locks broken wrt timeouts on Windows

2012-04-19 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Here is a new patch.
This uses critical sections and condition variables to avoid kernel mode 
switches for locks. Windows mutexes are expensive and for uncontented locks, 
this offers a big win.

It also adds an internal set of critical section/condition variable structures, 
that can be used on windows to do other such things without resorting to 
explicit kernel objects.

This code works on XP and newer, since it relies on the "semaphore" kernel 
object being present.  In addition, if compiled to target Vista or greater, it 
will use the built-in critical section primitives and the  FRWLock objects 
(which are faster still than CriticalSection objects and more robust)

--
status: pending -> open
Added file: http://bugs.python.org/file25271/ntlocks.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-19 Thread sbt

sbt  added the comment:

A couple of minor changes based on Antoine's earlier review (which I did not 
notice till now).

--
Added file: http://bugs.python.org/file25272/mp_pickle_conn.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14428] Implementation of the PEP 418

2012-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
>> Please leave the pybench default timers unchanged in case the
>> new APIs are not available.
> 
> Ok, done in the new patch: perf_counter_process_time-2.patch.

Thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5118] '%.2f' % 2.545 doesn't round correctly

2012-04-19 Thread Zeev Rotshtein

Zeev Rotshtein  added the comment:

Well this IS a bug. There is a certain globally accepted manner in which 
rounding work and python does something else.

P.S.: A bug is when something doesn't do what it's supposed to do the way it's 
supposed to do it. This definition does not depend on "internal representation" 
or any such things.

--
nosy: +Zeev.Rotshtein

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5118] '%.2f' % 2.545 doesn't round correctly

2012-04-19 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Well this IS a bug.

I assume that you're referring to behaviour like this:

Python 2.7.2 (default, Jan 13 2012, 17:11:09) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 2.545
>>> round(x, 2)
2.54

To explain again, what happens here is:

(1) After the assignment 'x = 2.545', what's stored for x is not the precise 
decimal value 2.545, but a binary approximation to it.  That binary 
approximation just happens to be very slightly less than 2.545.

(2) Now when rounding, the usual rules are applies (values less than half get 
rounded down), to give 2.54.

Which part(s) of the above do you think should be changed?  Should the 'round' 
function incorrectly round some numbers up even though they fall below the 
halfway case?

--
assignee:  -> mark.dickinson
versions: +Python 2.7 -Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14538] HTMLParser: parsing error

2012-04-19 Thread Michel Leunen

Michel Leunen  added the comment:

Thanks guys for your comments and for solving this issue. Great work!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14032] test_cmd_line_script prints undefined 'data' variable

2012-04-19 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c4c67c2d8ffc by Nick Coghlan in branch '3.2':
Close #14032: fix incorrect variable reference in test_cmd_line_script
http://hg.python.org/cpython/rev/c4c67c2d8ffc

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14098] provide public C-API for reading/setting sys.exc_info()

2012-04-19 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9fdec1354af4 by Martin v. Löwis in branch 'default':
Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
http://hg.python.org/cpython/rev/9fdec1354af4

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14098] provide public C-API for reading/setting sys.exc_info()

2012-04-19 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Thanks for the patch!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11618] Locks broken wrt timeouts on Windows

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> This uses critical sections and condition variables to avoid kernel
> mode switches for locks. Windows mutexes are expensive and for
> uncontented locks, this offers a big win.

Can you post some numbers?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13903] New shared-keys dictionary implementation

2012-04-19 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Mark, can you please submit a contributor form?

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2470] Need fixer for dl (removed) -> ctypes module

2012-04-19 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Being open for four years, this is hardly critical.

--
priority: critical -> normal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, could you try applying the following patch to threading.py?


diff --git a/Lib/threading.py b/Lib/threading.py
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -887,7 +887,7 @@ def _after_fork():
 ident = _get_ident()
 thread._Thread__ident = ident
 new_active[ident] = thread
-else:
+elif not isinstance(thread, _DummyThread):
 # All the others are already stopped.
 thread._Thread__stop()

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Added file: http://bugs.python.org/file25274/dummythreadafterfork.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is a complete patch + tests for 2.7.

--
Added file: http://bugs.python.org/file25273/dummythreadafterfork.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14601] PEP sources not available as documented

2012-04-19 Thread Éric Araujo

Éric Araujo  added the comment:

Confirmed, thanks!

--
components:  -Documentation
stage:  -> committed/rejected

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: http://bugs.python.org/file25273/dummythreadafterfork.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14601] PEP sources not available as documented

2012-04-19 Thread STINNER Victor

STINNER Victor  added the comment:

Martin> I now fixed it for real (I hope) in 34076bfed420

Thanks!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8536] Support new features of ZLIB 1.2.6

2012-04-19 Thread Jason Killen

Jason Killen  added the comment:

Given I'm new I wouldn't say I "evaluated" the usefulness of the new functions 
but I have given them a look and didn't see anything obvious.  If thats good 
enough great, if not then hopefully someone with a little more experience will 
take a look.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14098] provide public C-API for reading/setting sys.exc_info()

2012-04-19 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

The documentation does not explain how this new API is different from 
PyErr_Fetch/PyErr_Restore.  In particular the documentation doesn't mention 
that PyErr_Fetch and PyErr_GetExcInfo access different bits of the error state 
(curexc_* vs. exc_* in the thread state). 

Because of this it is not clear why there are two sets of functions, and why 
you want to use one set or the other.

--
nosy: +ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14614] PyTuple_SET_ITEM could check bounds in debug mode

2012-04-19 Thread Brett Cannon

Brett Cannon  added the comment:

Should we limit ourselves to bound errors? Couldn't we make the macros aliases 
for their full-fledged function equivalents (e.g. PyTuple_SetItem()) which 
trigger Py_FatalError() on error so we also get argument type checking?

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12947] Examples in library/doctest.html lack the flags

2012-04-19 Thread Stefano Taschini

Stefano Taschini  added the comment:

As far as I can see, Sphinx has a global setting for trim_doctest_flags but 
lacks the possibility of locally disabling the trimming.

A quick workaround would be to have the following sphinx extension added:

class ProxyLexer(object):

def __init__(self, underlying):
self.__underlying = underlying

def __getattr__(self, attr):
return getattr(self.__underlying, attr)

def setup(app):
from sphinx.highlighting import lexers
if lexers is not None:
lexers['pycon-literal'] = ProxyLexer(lexers['pycon'])
lexers['pycon3-literal'] = ProxyLexer(lexers['pycon3'])

That would allow blocks marked as

.. code-block:: pycon-literal

or preceded by 

.. highlight:: pycon-literal

to escape the trimming of doctest flags.

If that's of any interest I can submit a patch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2012-04-19 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Joe,

Your changes to the test suit don't apply cleanly anymore.  I can probably fix 
the conflicts, but if you could post an updated patch it will help.

Thanks.

--
nosy:  -Alexander.Belopolsky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13684] httplib tunnel infinite loop

2012-04-19 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
assignee:  -> orsenthil

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14588] PEP 3115 compliant dynamic class creation

2012-04-19 Thread Daniel Urban

Daniel Urban  added the comment:

Fair enough.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10769] ast: provide more useful range information

2012-04-19 Thread Michael

Michael  added the comment:

Hi,

Attached is the updated patch by Sven Brauch from the original mailing list 
thread bringing column offset reporting for attributes in line with everything 
else.

The offsets for bar before the patch:
foo[bar] = 4
foo(bar) = 4
foo.bar = 0

After:

foo[bar] = 4
foo(bar) = 4
foo.bar = 4

With the update, are there still concerns?

--
keywords: +patch
nosy: +kensington
Added file: http://bugs.python.org/file25275/fix-attr-ranges.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Vlado Boza

New submission from Vlado Boza :

Fix of this http://bugs.python.org/issue13703 is broken.

tl;dr: There only 256 different hash functions (compare it to size of 
_Py_HashSecret prefix and suffix). And whether keys collide or not depends only 
on the last 8 bits of prefix. 

Problem with current randomization of hash function is following:
Suffix does not influence whether two keys have some hash or not (it is xor-ed 
after everything). 
Everything except last 8 bits in prefix does not influence it also. Try adding 
0x474200 to prefix and see what happens (it will add 0x474200 to resulting 
hash). 

To make a DoS attack, attacker must do the following:
Generate sets of colliding keys for every 256 possible combinations of last 8 
bits. Try each one of these sets - one will have significantly bigger response 
time, and then repeat this one.

--
messages: 158736
nosy: Vlado.Boza
priority: normal
severity: normal
status: open
title: Hash function is not randomized properly
type: security

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Yuval Greenfield

New submission from Yuval Greenfield :

This is the line in question: 
http://hg.python.org/cpython/file/293180d199f2/Lib/http/server.py#l527

I was trying to test out a few html files using "python -m http.server" and it 
took 4 seconds for each request, it was completely unusable. I had to do hula 
hoops to find out that it was Python's fault. The function self.address_string 
is used in every log, meaning every request makes a reverse DNS query before 
responding. This function failed for every request. Now I know this may be my 
network's fault but that doesn't mean the server has to die with it. I think 
the better solution would be to just print out the ip address like other 
popular servers do. There's no need to be fancy with server names in the log of 
our toy server, especially when it may come at such a high price.

--
components: Library (Lib)
messages: 158737
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Python http.server is dead slow using gethostbyaddr/getfqdn for each 
request
versions: Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Yuval Greenfield

Changes by Yuval Greenfield :


--
type:  -> performance

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Probably a duplicate of issue 6085.

--
nosy: +pitrou
resolution:  -> duplicate
status: open -> closed
superseder:  -> Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

2012-04-19 Thread Yuval Greenfield

Yuval Greenfield  added the comment:

I agree with Antoine on this. Though the suggested patch is wrong. I believe we 
should leave address_string alone. Simply stop the log_message method from 
using it.

Either way we'd be changing the log format but if we don't have to then we 
shouldn't completely change the meaning of a method while leaving its name 
intact.

--
nosy: +ubershmekel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14371] Add support for bzip2 compression to the zipfile module

2012-04-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> What's the status of your contrib form?

Oops. I put this off for a detailed study and forgotten.

I will send the form, as only get to the printer and the scanner.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14371] Add support for bzip2 compression to the zipfile module

2012-04-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> Perhaps because your system's memory allocator is extremely good (or buf is 
> always very small), but b''.join() is far more robust.
> Another alternative is accumulating in a bytearray, since it uses 
> overallocation for linear time appending.

I thought, that it was in special optimization, mentioned in the
python-dev, but could not find this in the code. Perhaps it had not been
implemented.

In this particular case, the bytes appending is performed only once (and
probably a lot of appending with b''). Exceptions are possible only in
pathological cases, for example when compressed data is much larger
uncompressed data. The current implementation uses `buf += data`, if
someone wants to change it, then it's not me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14579] Possible vulnerability in the utf-16 decoder after error handling

2012-04-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

There is the crasher and leaker. When Python is not crashing, there is garbage 
(i.e. leakage of data) at the end of the decoded string. Indeed, I see an 
English text in some versions of Python.

There are many other errors in utf-16 decoder (see, for example, 
b'\xD8\x00\xDC'.decode('utf-16be')). I'm now finishing work on a new decoder, 
and after that take the bug fixing in 3.2.

--
Added file: http://bugs.python.org/file25276/utf16crasher.py

___
Python tracker 

___k = len(b'\x00\x01\x00\x00'.decode('utf-32be'))
for i in range(1000):
print(i, ascii((b'\xD8\x00\xDC\x00' * i + b'\xDC\x00' + b'\x00>' * 
2).decode('utf-16be', 'ignore')[i * k:]))
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Vlado Boza

Vlado Boza  added the comment:

E.g this strings collide for every prefix ending on 0xcd:
0x27fd5a18, 0x26fe78fa

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Dave Malcolm

Changes by Dave Malcolm :


--
nosy: +dmalcolm

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-19 Thread Charles-François Natali

Charles-François Natali  added the comment:

> v3 patch, based on feedback from the review here: 
> http://bugs.python.org/review/14532/show

Looks good to me.
One last thing (sorry for not bringing this up earlier): I don't like
bikeshedding, but at least to me, `time_independent_equals` is a bit
too long to type, and sounds reductive (we don't want to specifically
avoid only timing attacks, but provide a way to compare digests
securely).
What do you (all) think of something shorter, like `secure_compare`,
`secure_equals`, or something along those lines?
Note that I'm not good at finding names, so if others are fine with
the current one, I won't object ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14623] Shutdown exception in daemon thread

2012-04-19 Thread Mike Hobbs

New submission from Mike Hobbs :

This issue is very similar to the issue original reported in issue1722344, 
except that it occurs in daemon threads. Here's a sample exception:

Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/local/lib/python2.7/threading.py", line 505, in run
  File "/opt/8b/libr8/eb/util/graphite.py", line 86, in run
  File "/usr/local/lib/python2.7/Queue.py", line 168, in get
  File "/usr/local/lib/python2.7/threading.py", line 237, in wait
: 'NoneType' object is not callable

Investigating line 237 in threading.py shows that RuntimeError must have been 
set to None. The issue appears to be that Py_Finalize wipes all globals while 
there are still daemon threads running. Would it be correct to terminate daemon 
threads prior to wiping the globals, since the threads won't be able to 
accomplish much anyway?

--
components: Interpreter Core
messages: 158746
nosy: mhobbs
priority: normal
severity: normal
status: open
title: Shutdown exception in daemon thread
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-19 Thread Jon Oberheide

Jon Oberheide  added the comment:

I have used the name "secure_compare" in the past for such a function. That 
said, I don't have strong feelings either way about the naming, so I'll yield 
to the others.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14624] Faster utf-16 decoder

2012-04-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

I propose a patch, which accelerates the utf-16 decoder. With PEP 393 utf-16 
decoder slowed down a few times (3-4x), this patch returns the performance at 
the level of Python 3.2 and even higher (+10-30% over 3.2).

In addition, it fixes a few bugs in the utf-16 decoder. Also as a side effect 
is possible acceleration of other decoders.

--
components: Interpreter Core
files: decode_utf16.patch
keywords: patch
messages: 158748
nosy: storchaka
priority: normal
severity: normal
status: open
title: Faster utf-16 decoder
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file25277/decode_utf16.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14625] Faster utf-32 decoder

2012-04-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

I suggest two variants of patch, accelerating the utf-32 decoder. With PEP 393 
utf-32 decoder slowed down up to 2x, these patches returns a performance at the 
level of Python 3.2 and even much higher (2-3x over 3.2). The variant A is 
simpler, but the variant B is a little faster (+8-15%).

--
components: Interpreter Core
files: decode_utf32_a.patch
keywords: patch
messages: 158749
nosy: storchaka
priority: normal
severity: normal
status: open
title: Faster utf-32 decoder
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file25278/decode_utf32_a.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14625] Faster utf-32 decoder

2012-04-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file25279/decode_utf32_b.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14624] Faster utf-16 decoder

2012-04-19 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14624] Faster utf-16 decoder

2012-04-19 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14625] Faster utf-32 decoder

2012-04-19 Thread STINNER Victor

STINNER Victor  added the comment:

See also #14624 for UTF-16 decoder.

--
nosy: +haypo, pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14624] Faster utf-16 decoder

2012-04-19 Thread STINNER Victor

STINNER Victor  added the comment:

See also #14625 for UTF-32 decoder.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14381] Intern certain integral floats for memory savings and performance

2012-04-19 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

return *(PY_LONG_LONG*)&fval == 0;
There is no aliasing, because there are no pointer variables in existence.
If we did this:

double *pfval = &fval;
PY_LONG_LONG *pl = (PY_LONG_LONG*)pfval
return *pfval == 0

Then we would have aliasing.  Because "pfval" in this example doesn't exist but 
is merely a temporary, there is no aliasing.

As for IEEE compatibility, I don't think we could have our own floating point 
formatting library if we didn't make that assumption, but I might be wrong 
about that.  On the other hand, I don't think there is a supported python 
architecture that defines positive zero as anything else than bitwise zero.  
And should such a platform be found, it is easy enough to disable this code for 
it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Michal Petrucha

Changes by Michal Petrucha :


--
nosy: +konk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14624] Faster utf-16 decoder

2012-04-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See also issue #14579 for utf-16 decoder bugs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Charles-François Natali

Charles-François Natali  added the comment:

> Here is a complete patch + tests for 2.7.

I like the test.

However there's something I find strange with the patch:
"""
diff --git a/Lib/threading.py b/Lib/threading.py
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -887,7 +887,7 @@ def _after_fork():
 ident = _get_ident()
 thread._Thread__ident = ident
 new_active[ident] = thread
-else:
+elif not isinstance(thread, _DummyThread):
 # All the others are already stopped.
 thread._Thread__stop()
"""

Is it really the caller's job to check that the thread is not a dummy thread?
IMO it should be _DummyThread's stop() method that does the right thing, either 
by overriding Thread's stop() method in _DummyThread or by puting the check 
inside Thread.stop(), like what's done inside thread._reset_internal_locks():
"""
 if hasattr(self, '_Thread__block'):  # DummyThread deletes self.__block
 self.__block.__init__()
 self.__started._reset_internal_locks()
"""

--
nosy: +neologix

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14623] Shutdown exception in daemon thread

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Would it be correct to terminate daemon threads prior to wiping the
> globals, since the threads won't be able to accomplish much anyway?

Daemon threads are not actually "terminated" by the Python interpreter, they 
just keep running in the background until the process exits.
The situation should be much better in Python 3.2, where daemon threads are 
frozen (their execution is halted) when the interpreter starts to shutdown.

I don't think this will be ever fixed in 2.7, though. It's a slightly delicate 
change.

--
nosy: +pitrou
resolution:  -> wont fix
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le jeudi 19 avril 2012 à 21:11 +, Charles-François Natali a écrit :
> IMO it should be _DummyThread's stop() method that does the right
> thing, either by overriding Thread's stop() method in _DummyThread or
> by puting the check inside Thread.stop(), like what's done inside
> thread._reset_internal_locks():

I don't think _DummyThread can override __stop(), because of the name
mangling of __private methods. However, the hasattr() approach would
probably work.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

New patch with the hasattr() approach.

--
Added file: http://bugs.python.org/file25280/dummythreadafterfork2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14613] time.time can return NaN

2012-04-19 Thread STINNER Victor

Changes by STINNER Victor :


--
title: time.time can return None or NaN -> time.time can return NaN

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14579] Vulnerability in the utf-16 decoder after error handling

2012-04-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Here is the bugs in the utf-16 decoder:

1. `aligned_end` is not updated after calling error handler.

2. Possible silent reading of one byte over the bytes array limit when decoding 
of a surrogate pair. b'\xD8\x00\xDC'.decode('utf-16be')

3. Error handlers receive data without last byte.

4. After handling truncate data error it is impossible to continue decoding 
(unlike all the other decoders).

--
title: Possible vulnerability in the utf-16 decoder after error handling -> 
Vulnerability in the utf-16 decoder after error handling

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Dave Malcolm

Dave Malcolm  added the comment:

Thanks for filing this bug report.

I'm not seeing the equal hashes you describe.

I'm using this recipe to hardcode a specific prefix and print the hashes using 
it:
$ gdb --eval-command="break _PyRandom_Init" --eval-command="run" 
--eval-command="print _Py_HashSecret" --eval-command="set 
_Py_HashSecret.prefix=0xcdcdcdcd" --eval-command="print _Py_HashSecret" 
--eval-command="continue" -eval-command="continue" --args python -c 
"a='\x27\xfd\x5a\x18'; b='\x26\xfe\x78\xfa'; print(hash(a)); print(hash(b))"


On a 32-bit build of Python 2.7.3 (i686), if I set 
_Py_HashSecret.prefix=0xcdcdcdcd, I get non-equal hashes for the data you 
specify (output trimmed somewhat for conciseness):

  $1 = {prefix = 0, suffix = 0}
  $2 = {prefix = -842150451, suffix = 0}
  Continuing.
  -121255142
  -1199906326

Similarly, on a 64-bit build of Python 2.7.3 (x86_64), I get non-equal hashes:
  $1 = {prefix = 0, suffix = 0}
  $2 = {prefix = 3452816845, suffix = 0}
  -3992804574342296806
  -8147489705433570838

Did I misunderstand the report?  Thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14579] Vulnerability in the utf-16 decoder after error handling

2012-04-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The proposed patch will fix only the first of these bugs. The patch in issue 
#14624 fixes all bugs for Python 3.3. For Python 3.2 soon I will make a patch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Charles-François Natali

Charles-François Natali  added the comment:

> New patch with the hasattr() approach.

LGTM.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset ab9d6c4907e7 by Antoine Pitrou in branch '2.7':
Issue #14308: Fix an exception when a "dummy" thread is in the threading 
module's active list after a fork().
http://hg.python.org/cpython/rev/ab9d6c4907e7

New changeset 41c64c700e1e by Antoine Pitrou in branch '3.2':
Issue #14308: Fix an exception when a "dummy" thread is in the threading 
module's active list after a fork().
http://hg.python.org/cpython/rev/41c64c700e1e

New changeset e3ea462cb181 by Antoine Pitrou in branch 'default':
Issue #14308: Fix an exception when a dummy thread is in the threading module's 
active list after a fork().
http://hg.python.org/cpython/rev/e3ea462cb181

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Richard Oudkerk

Richard Oudkerk  added the comment:

> I don't think _DummyThread can override __stop(), because of the name
> mangling of __private methods. However, the hasattr() approach would
> probably work.

Wouldn't a _DummyThread._Thread__stop() method override Thread.__stop()?  Like

>>> class A(object):
... def foo(self):
... self.__bar()
... def __bar(self):
... print "original"
...
>>> class B(A):
... def _A__bar(self):
... print "overridden"
...
>>> B().foo()
overridden

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14308] '_DummyThread' object has no attribute '_Thread__block'

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Wouldn't a _DummyThread._Thread__stop() method override Thread.__stop()?

Probably, but that would be quite ugly IMHO.
I've now committed the patch as-is in 2.7. In 3.2 it turned out easier: __stop 
is now spelt _stop, so can be overriden without any hacks.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-04-19 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f554043badec by Larry Hastings in branch 'default':
Issue #14127: Add st_{cma}time_ns fields to os.stat() result object.
http://hg.python.org/cpython/rev/f554043badec

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2012-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

The patch broke egenix-mx-base, since it relies on the customize_compiler() 
being available in distutils.ccompiler:

https://www.egenix.com/mailman-archives/egenix-users/2012-April/114838.html

If you make such changes to dot releases, please make absolutely sure that when 
you move functions from one module to another, you keep backwards compatibility 
aliases around.

--
nosy: +lemburg
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2012-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Here's the quote from mxSetup.py:

# distutils changed a lot in Python 2.7 due to many
# distutils.sysconfig APIs having been moved to the new
# (top-level) sysconfig module.
from sysconfig import \
 get_config_h_filename, parse_config_h, get_path, \
 get_config_vars, get_python_version, get_platform

# This API was moved from distutils.sysconfig to distutils.ccompiler
# in Python 2.7
from distutils.ccompiler import customize_compiler

So in 2.7 the function was moved from sysconfig to ccompiler (where it 
belongs), and now you're reverting the change in the third dot release.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2012-04-19 Thread Éric Araujo

Éric Araujo  added the comment:

Sorry for not thinking about this.  I’ll be more careful.

--
stage: committed/rejected -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2012-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Éric Araujo wrote:
> 
> Sorry for not thinking about this.  I’ll be more careful.

No need to be sorry; these things can happen.

What I don't understand is this line in the news section:

"Complete the revert back to only having one in distutils.sysconfig as
 7.12 +  is the case in 3.x."

Back when I discussed these changes with Tarek, we both agreed that
customize_compiler() is better placed into the ccompiler module
than the sysconfig module, so I think the one in the sysconfig
module should be replaced with a reference to the version in the
ccompile module - in both 2.7 and 3.x.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2012-04-19 Thread Ned Deily

Ned Deily  added the comment:

That's unfortunate.  But the documented location for customize_compiler is and, 
AFAIK, had always been in distutils.sysconfig.  It was an inadvertent 
consequence of the bad revert during the 2.7 development cycle that a second 
copy was made available in distutils.ccompiler.  That change was not supposed 
to be released in 2.7 and was never documented.  So I don't think there is 
anything that can or needs to be done as this point in Python itself.  Other 
opinions?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +PaulMcMillan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-04-19 Thread Larry Hastings

Larry Hastings  added the comment:

Sorry about the delay; laptop died, finally dealt with reviving the data off 
it.  Also: fixed spelling error in title.

--
title: add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), 
os.*utimens*() expects a number of nanoseconds -> add st_*time_ns fields to 
os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of 
nanoseconds

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14624] Faster utf-16 decoder

2012-04-19 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Serhiy: can you please submit a contributor form?

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread STINNER Victor

STINNER Victor  added the comment:

I don't understand this issue: can you write a short script to test a 
collision? 

"E.g this strings collide for every prefix ending on 0xcd"

Do you mean that prefix & 0xff == 0xcd?

"0x27fd5a18, 0x26fe78fa"

Is it a byte string or an Unicode string? b'\x27\xfd\x5a\x18' and 
b'\x26\xfe\x78\xfa'?

--

Using PYTHONHASHSEED environment variable, it's easy to find two values 
generating the same _Py_HashSecret. Just one example:

PYTHONHASHSEED=3035016679:
* _Py_HashSecret = {0xcd5192eff3fd4d58, 0x3926b1431b200720}
PYTHONHASHSEED=4108758503:
*  _Py_HashSecret = {0xcd5192eff3fd4d58, 0x3926b1431b200720}

--

I wrote find_hash_collision.py to try to compute a collision, but the programs 
fail with:
---
Fail to generate a new seed!
# seeds = 65298
---
So it fails to generate a new random seed after testing 65298 different seeds. 
I ran the script with a function generating a seed, a seed generate a prefix 
"ending with 0xDC".

See attached program: it generates a random seed. Uncomment "seed = 
generate_seed_0xCD()" if the prefix must ends with 0xCD byte.

--
Added file: http://bugs.python.org/file25281/find_hash_collision.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2012-04-19 Thread Ned Deily

Ned Deily  added the comment:

And to recap the history here, there was a change in direction for Distutils 
during the 2.7 development cycle, as decided at the 2010 language summit, in 
particular to revert feature changes in Distutils for 2.7 to its 2.6.x state 
and, going forward, "Distutils in Python will be feature-frozen".

http://mail.python.org/pipermail/python-dev/2010-March/098135.html

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14613] time.time can return NaN

2012-04-19 Thread STINNER Victor

STINNER Victor  added the comment:

> So NaN is a possible result from time.time()?

Oops. I don't know if it is possible. I just know that it cannot return None :-)

_PyTime_gettimeofday() fills a structure having two integer fields (tv_sec, 
tv_usec), and floattime() uses these fields to compute a double:

static PyObject*
floattime(void)
{
_PyTime_timeval t;
_PyTime_gettimeofday(&t);
return PyFloat_FromDouble((double)t.tv_sec + t.tv_usec * 1e-6);
}

I don't see how "(double)t.tv_sec + t.tv_usec * 1e-6" can generate NaN.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14386] Expose dict_proxy internal type as types.MappingProxyType

2012-04-19 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 34af3e74292d by Victor Stinner in branch 'default':
Close #14386: Register types.MappingProxyType as a Mapping
http://hg.python.org/cpython/rev/34af3e74292d

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

2012-04-19 Thread Larry Hastings

New submission from Larry Hastings :

There are some functions in the os module that do much the same thing but 
differ only in minor ways, like

* whether or not they follow symbolic links (stat vs lstat)
* taking an extra "dir_fd" parameter (chmod vs fchmodat(3.3))

It would be better if we consolidated these variations into one function which 
took keyword-only parameters that allow access to the alternate functionality.

Here is a sample of the new possible function signatures, as originally 
proposed by Serhiy Storchaka:

access(path, mode, *, followlinks=True, dirfd=None, eaccess=False)
chmod(path, mode, *, followlinks=True, dirfd=None)
chown(path, uid, gid, *, followlinks=True, dirfd=None)
link(srcpath, dstpath, *, followlinks=True, srcdirfd=None, dstdirfd=None)
mkdir(path, mode=0o777, *, dirfd=None)
mknod(path, mode=0o600, device=0, *, dirfd=None)
open(path, flag, mode=0o777, *, dirfd=None)
readlink(path, *, dirfd=None)
rename(oldpath, newpath, *, olddirfd=None, newdirfd=None)
stat(path, *, followlinks=True, dirfd=None)
symlink(src, dst, *, dirfd=None)
unlink(path, *, removedir=False, dirfd=None)
utimes(path[, (atime, mtime)], *, ns=False, dirfd=None)
mkfifoat(path, mode=0o666, *, followlinks=True, dirfd=None)

My opinion about naming: PEP 8 suggests underscores to separate words in 
non-class identifiers.  So I'd spell those "dir_fd", "src_dir_fd" (etc), 
"remove_dir", and "follow_symlinks".

(While thinking about this, I remembered the infrequently-cited maxim "no 
boolean parameters".  But that's more a guideline than a rule, and it tends to 
be a complaint about how the meaning of the parameter is unclear at a call 
site.  As these will be keyword-only parameters I think their meanings will be 
perfectly clear, so I shan't worry about it.)

--
messages: 158777
nosy: larry
priority: normal
severity: normal
status: open
title: os module: use keyword-only arguments for dir_fd and nofollow to reduce 
function count

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Vlado Boza

Vlado Boza  added the comment:

My bad (I checked only function in C++, not result in python).
This should work on 32bit:
Prefix: anything ending on 0x00
Suffix: anything
Strings: "\x00\xcf\x0b\x96\x19", "\x00\x6d\x29\x45\x18"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

2012-04-19 Thread Larry Hastings

Changes by Larry Hastings :


--
nosy: +storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

2012-04-19 Thread Larry Hastings

Larry Hastings  added the comment:

storchaka: sorry for the long delay, somehow I missed your reply in 
python-ideas.)

You said you envision this as a big patch.  Could I convince you to try and 
make a series of smaller patches?  It should be easy to break up into small 
pieces--do one patch adding dir_fd, the next with follow_symlinks, etc.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Vlado Boza

Vlado Boza  added the comment:

For example take this script (on 32bit):
ha = hash("\x00\xcf\x0b\x96\x19")
hb = hash("\x00\x6d\x29\x45\x18")
if ha == hb:
  print "collision"

And run following:
for i in `seq 0 25`; do echo $i; for j in `seq 0 100`; do ./python -R x.py; 
done; done;

It gives collison too many times (around 9 out of 2500).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Dave Malcolm

Dave Malcolm  added the comment:

$ gdb --eval-command="break _PyRandom_Init" --eval-command="run" 
--eval-command="print _Py_HashSecret" --eval-command="set 
_Py_HashSecret.prefix=0xcdcdcd00" --eval-command="print _Py_HashSecret" 
--eval-command="continue" -eval-command="continue" --args python -c 
'a="\x00\xcf\x0b\x96\x19"; b="\x00\x6d\x29\x45\x18"; print(hash(a)); 
print(hash(b))'

On 32-bit:
$1 = {prefix = 0, suffix = 0}
$2 = {prefix = -842150656, suffix = 0}
1220138288
1220138288

On 64-bit:
$1 = {prefix = 0, suffix = 0}
$2 = {prefix = 3452816640, suffix = 0}
Continuing.
4087671194599937328
-167939011306192

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14627] Fatal Python Error when Python startup is interrupted by CTRL+c

2012-04-19 Thread STINNER Victor

New submission from STINNER Victor :

If you press CTRL+c while Python is starting, you may get such error:

^CFatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "", line 990, in _find_and_load
  File "", line 571, in load_module
  File "", line 228, in module_for_loader_wrapper
  File "", line 456, in _load_module
  File "/home/haypo/prog/python/default/Lib/io.py", line 90, in 
RawIOBase.register(FileIO)
  File "/home/haypo/prog/python/default/Lib/abc.py", line 155, in register
if issubclass(subclass, cls):
  File "/home/haypo/prog/python/default/Lib/abc.py", line 201, in 
__subclasscheck__
elif subclass in cls._abc_negative_cache:
KeyboardInterrupt
Abandon

--
messages: 158782
nosy: brett.cannon, haypo
priority: normal
severity: normal
status: open
title: Fatal Python Error when Python startup is interrupted by CTRL+c
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread STINNER Victor

STINNER Victor  added the comment:

> For example take this script (on 32bit): (...)
> It gives collison too many times (around 9 out of 2500).

I tried this script on Linux 32 bits and Linux 64 bits: I didn't see any 
collision. What is your operating system and the version of your operating 
system please?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Michal Petrucha

Michal Petrucha  added the comment:

@dmalcolm:
As for the gdb example, you need to add --eval-command="set 
_Py_HashSecret_Initialized=1", otherwise _Py_HashSecret will get overwritten 
immediately after it is set by gdb, either to 0 if run without the -R switch, 
or to a random value.

With the fresh pair of values Vlado provided, I managed to reproduce the 
collisions on Python 2.7.3, i686 (output trimmed like you did):

for __PREFIX in 0x0 0x4700 0xdead00 0xcafe00; do gdb --eval-command="break 
_PyRandom_Init" --eval-command="run" --eval-command="print _Py_HashSecret" 
--eval-command="set _Py_HashSecret.prefix=${__PREFIX}" --eval-command="set 
_Py_HashSecret_Initialized=1" --eval-command="print _Py_HashSecret" 
--eval-command="continue" -eval-command="continue" --args ./python -c 
"a='\x00\xcf\x0b\x96\x19'; b='\x00\x6d\x29\x45\x18'; print(hash(a)); 
print(hash(b))"; done

$1 = {prefix = 0, suffix = 0}
$2 = {prefix = 0, suffix = 0}
Continuing.
1220138288
1220138288


$1 = {prefix = 0, suffix = 0}
$2 = {prefix = 18176, suffix = 0}
Continuing.
-1483212240
-1483212240


$1 = {prefix = 0, suffix = 0}
$2 = {prefix = 14593280, suffix = 0}
Continuing.
-972665808
-972665808


$1 = {prefix = 0, suffix = 0}
$2 = {prefix = 13303296, suffix = 0}
Continuing.
1003122480
1003122480

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14621] Hash function is not randomized properly

2012-04-19 Thread Vlado Boza

Vlado Boza  added the comment:

>I tried this script on Linux 32 bits and Linux 64 bits: I didn't see any 
>>collision. What is your operating system and the version of your >operating 
>system please?

uname -a
Linux 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 
x86_64 GNU/Linux


Anyway you should be able to do following (in 32bits):
- generate two colliding keys (with some random seed)
- try these keys with different random seeds and they will collide ~1 out of 
256 times

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8885] markupbase declaration errors aren't recoverable

2012-04-19 Thread Ezio Melotti

Ezio Melotti  added the comment:

HTMLParser shouldn't raise errors anymore, so the "error" method (and probably 
the HTMLParseError exception too) should be deprecated along with the 
non-strict mode on 3.3.

--
assignee:  -> ezio.melotti
nosy: +ezio.melotti
type: behavior -> enhancement
versions: +Python 3.3 -Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue755660] allow HTMLParser to continue after a parse error

2012-04-19 Thread Ezio Melotti

Ezio Melotti  added the comment:

HTMLParser should now be able to parse invalid HTML too, so this patch is not 
necessary anymore.

--
assignee:  -> ezio.melotti
nosy: +ezio.melotti
resolution:  -> out of date
stage: patch review -> committed/rejected
status: open -> closed
versions: +Python 3.3 -Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >