[issue18745] Test enum in test_json is ignorant of infinity value

2013-09-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 50e583f20d78 by Ethan Furman in branch 'default':
Close #18745: Improve enum tests in test_json for infinities and NaN.
http://hg.python.org/cpython/rev/50e583f20d78

--
nosy: +python-dev
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



[issue9709] test_distutils warning: initfunc exported twice on Windows

2013-09-02 Thread Stefan Krah

Stefan Krah added the comment:

Is the distutils freeze still in place? If not, I'll commit initfunc2.patch.

--

___
Python tracker 

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



[issue18828] urljoin behaves differently with custom and standard schemas

2013-09-02 Thread Berker Peksag

Berker Peksag added the comment:

How about adding a codecs.register like public API for 3.4+?

import urllib.parse

urllib.parse.schemes.register('redis', 'rtmp')

or:

urllib.parse.urljoin('redis://localhost:6379/0', '/1', scheme='redis')

or just:

urllib.parse.schemes.extend(['redis', 'rtmp'])

--
nosy: +berker.peksag

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2013-09-02 Thread Matěj Stuchlík

Matěj Stuchlík added the comment:

Doing 'valgrind --suppressions=valgrind-python.supp ./python 
Lib/tests/regrtest.py test_ssl.py' I'm getting

==11944== LEAK SUMMARY:
==11944==definitely lost: 32 bytes in 1 blocks
==11944==indirectly lost: 392 bytes in 16 blocks
==11944==  possibly lost: 27,008 bytes in 58 blocks
==11944==still reachable: 4,267,092 bytes in 4,124 blocks
==11944== suppressed: 32 bytes in 1 blocks

and as far as I can tell the leak is introduced by this patch, I can't seem to 
figure out what could be causing it though.

--
nosy: +sYnfo

___
Python tracker 

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



[issue15018] Incomplete Python LDFLAGS and CPPFLAGS used for extension modules on posix

2013-09-02 Thread koobs

Changes by koobs :


--
nosy: +koobs

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2013-09-02 Thread Christian Heimes

Christian Heimes added the comment:

I can't reproduce the memory leak. valgrind's output doesn't show suspicious 
memory leaks.

./configure --with-pydebug --config-cache
valgrind --suppressions=Misc/valgrind-python.supp ./python Lib/test/test_ssl.py

Python 3.4 tip
--

==26085== HEAP SUMMARY:
==26085== in use at exit: 1,286,703 bytes in 3,778 blocks
==26085==   total heap usage: 210,241 allocs, 206,463 frees, 62,923,839 bytes 
allocated
==26085== 
==26085== LEAK SUMMARY:
==26085==definitely lost: 0 bytes in 0 blocks
==26085==indirectly lost: 0 bytes in 0 blocks
==26085==  possibly lost: 1,148,038 bytes in 555 blocks
==26085==still reachable: 138,665 bytes in 3,223 blocks
==26085== suppressed: 0 bytes in 0 blocks


Python 3.4.0a1 (without patch)
--
==32513== HEAP SUMMARY:
==32513== in use at exit: 1,708,298 bytes in 4,120 blocks
==32513==   total heap usage: 237,965 allocs, 233,845 frees, 94,637,130 bytes 
allocated
==32513== 
==32513== LEAK SUMMARY:
==32513==definitely lost: 0 bytes in 0 blocks
==32513==indirectly lost: 0 bytes in 0 blocks
==32513==  possibly lost: 1,568,077 bytes in 893 blocks
==32513==still reachable: 140,221 bytes in 3,227 blocks
==32513== suppressed: 0 bytes in 0 blocks
==32513== Rerun with --leak-check=full to see details of leaked memory


Python 2.7 tip
--

==3184== HEAP SUMMARY:
==3184== in use at exit: 6,411,895 bytes in 4,757 blocks
==3184==   total heap usage: 16,245 allocs, 11,488 frees, 32,948,412 bytes 
allocated
==3184== 
==3184== LEAK SUMMARY:
==3184==definitely lost: 0 bytes in 0 blocks
==3184==indirectly lost: 0 bytes in 0 blocks
==3184==  possibly lost: 1,823,596 bytes in 1,505 blocks
==3184==still reachable: 4,588,299 bytes in 3,252 blocks
==3184== suppressed: 0 bytes in 0 blocks

--

___
Python tracker 

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



[issue18900] Add the random.distrib module

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> In light of Raymond's comments on code bloat in issue18844, perhaps this 
> module could be added to PyPi to see whether or not there's interest in this 
> kind of functionality?

Agree. At first look there are no module which provides such features on PyPI. 
On the second hand NumpPy provides efficient C-implemented functions which are 
2-10 times faster than proposed pure Python iterators. Due to this fact I 
withdraw my proposition. Anyone who need a performance in random generation 
with specific distribution can use NumPy.

--
resolution:  -> 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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2013-09-02 Thread Matěj Stuchlík

Matěj Stuchlík added the comment:

Oh, I only checked the particular commit that fixed this issue in 2.6 
(50803d881a92). I am not getting any leaks in 2.6 tip either, so I guess it was 
fixed somewhere along the way.

Sorry for the confusion!

--

___
Python tracker 

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



[issue18550] internal_setblocking() doesn't check return value of fcntl()

2013-09-02 Thread Ronald Oussoren

Ronald Oussoren added the comment:

oops. This should be the right patch.

--
Added file: http://bugs.python.org/file31554/issue-18550.txt

___
Python tracker 

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



[issue18693] help() not helpful with enum

2013-09-02 Thread Ronald Oussoren

Ronald Oussoren added the comment:

That help() is confused by __dir__ is documented in #16938. 

AFAIK help is fairly fragile in its expectations of the attributes present on 
classes and the correspondence between dir(cls) and list(cls.__dict__), and 
that is something that could be fixed in pydoc and/or inspect.

--

___
Python tracker 

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



[issue13323] urllib2 does not correctly handle multiple www-authenticate headers in an HTTP response

2013-09-02 Thread Sigmund Augdal

Sigmund Augdal added the comment:

Can someone please apply this patch or provide a reason why it should not be 
applied?

--
nosy: +Sigmund.Augdal

___
Python tracker 

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



[issue15310] urllib: Support for multiple WWW-Authenticate headers and/or multiple challenges per header

2013-09-02 Thread Sigmund Augdal

Sigmund Augdal added the comment:

I'm also affected by this. Could someone please apply the patch or provide some 
reason why it could not be applied?

--
nosy: +Sigmund.Augdal

___
Python tracker 

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



[issue13323] urllib2 does not correctly handle multiple www-authenticate headers in an HTTP response

2013-09-02 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Sigmund: Sorry for the delay. I shall act on this.

--

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which combines both Kang-Hao's patches, synchronized with tip, 
fixed and optimized.

Unfortunately even optimized this patch slowdown encoding/decoding some data. 
Here are some benchmark results (benchmarking tools are here: 
https://bitbucket.org/storchaka/cpython-stuff/src/default/bench).

3.3  3.4  3.4
 unpatchedpatched

969 (+12%)   978 (+11%)   1087   encode  utf-16le  'A'*1
2453 (-62%)  2356 (-61%)  923encode  utf-16le  '\u0100'*1
222 (+12%)   224 (+11%)   249encode  utf-16le'\U0001'+'\u0100'*
784 (+6%)791 (+5%)831encode  utf-16be  'A'*1
750 (-4%)752 (-4%)719encode  utf-16be  '\u0100'*1
233 (+2%)235 (+1%)238encode  utf-16be'\U0001'+'\u0100'*

531 (-7%)545 (-9%)494encode  utf-32le  'A'*1
383 (-38%)   385 (-38%)   239encode  utf-32le  '\u0100'*1
324 (-24%)   325 (-25%)   245encode  utf-32le'\U0001'+'\u0100'*
544 (-10%)   545 (-10%)   492encode  utf-32be  'A'*1
384 (-38%)   384 (-38%)   239encode  utf-32be  '\u0100'*1
325 (-25%)   325 (-25%)   245encode  utf-32be'\U0001'+'\u0100'*

682 (+5%)679 (+5%)715decode  utf-16le  'A'*1
607 (+1%)610 (+1%)614decode  utf-16le  '\u0100'*1
550 (+1%)554 (+0%)556decode  utf-16le'\U0001'+'\u0100'*
609 (+0%)600 (+2%)610decode  utf-16be  'A'*1
464 (+1%)466 (+1%)470decode  utf-16be  '\u0100'*1
432 (+1%)431 (+1%)435decode  utf-16be'\U0001'+'\u0100'*

103 (+272%)  374 (+2%)383decode  utf-32le  'A'*1
91 (+264%)   390 (-15%)   331decode  utf-32le  '\u0100'*1
90 (+257%)   393 (-18%)   321decode  utf-32le'\U0001'+'\u0100'*
103 (+269%)  393 (-3%)380decode  utf-32be  'A'*1
91 (+263%)   406 (-19%)   330decode  utf-32be  '\u0100'*1
90 (+257%)   393 (-18%)   321decode  utf-32be'\U0001'+'\u0100'*

Performance of utf-16 decoding is not changed. utf-16 encoder is 2.5 times 
slowed for UCS2 data (it was just memcpy) but still 3+ times faster than 2.7 
and 3.2 (issue15026). Due to additional optimization it now even slightly 
faster for some other data. There is a patch for speed up UTF-32 encoding 
(issue15027), it should help to compensate it's performance degradation. UTF-32 
decoder already 3-4 times faster than in 3.3 (issue14625).

I don't see performance objection against this patch.

--
Added file: http://bugs.python.org/file31555/utf_16_32_surrogates_2.patch

___
Python tracker 

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-09-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +needs review

___
Python tracker 

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



[issue9709] test_distutils warning: initfunc exported twice on Windows

2013-09-02 Thread Éric Araujo

Éric Araujo added the comment:

The feature freeze was lifted at PyCon 2013.  This patch can be committed in 
the default branch.  Could you add a test?

--
assignee: tarek -> eric.araujo
versions:  -3rd party, Python 2.7, Python 3.3

___
Python tracker 

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



[issue9709] test_distutils warning: initfunc exported twice on Windows

2013-09-02 Thread Éric Araujo

Éric Araujo added the comment:

Ignore my comment about a test, you already replied to that :)  Please commit.

--
assignee: eric.araujo -> skrah
stage: needs patch -> commit review

___
Python tracker 

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



[issue8821] Range check on unicode repr

2013-09-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> works for me
stage:  -> committed/rejected
status: pending -> closed

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-09-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

You should be able to squeeze out some extra cycles by
avoiding the bit calculations using a simple range check
for ch >= 0xd800:

+# if STRINGLIB_MAX_CHAR >= 0xd800
+if (((ch1 ^ 0xd800) &
+ (ch1 ^ 0xd800) &
+ (ch1 ^ 0xd800) &
+ (ch1 ^ 0xd800) & 0xf800) == 0)
+break;
+# endif

--

___
Python tracker 

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



[issue18905] pydoc -p 0 says the server is available at localhost:0

2013-09-02 Thread Wieland Hoffmann

New submission from Wieland Hoffmann:

In Python 3 one can use `pydoc -p 0` to start a pydoc HTTP server on an 
arbitrary unused port. This works (somewhat) in Python 2 as well, except that 
pydoc doesn't tell you which port it's listening on. Applying the attached 
patch makes pydoc print the correct port.

--
components: Library (Lib)
files: pydoc-port.patch
keywords: patch
messages: 196789
nosy: Wieland.Hoffmann
priority: normal
severity: normal
status: open
title: pydoc -p 0 says the server is available at localhost:0
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file31556/pydoc-port.patch

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I were blind. Thank you Marc-Andre. Here is corrected patch. Unfortunately 
it 1.4-1.5 times slower on UTF-16 encoding UCS2 strings than previous wrong 
patch.

--
Added file: http://bugs.python.org/file31557/utf_16_32_surrogates_3.patch

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-09-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: http://bugs.python.org/file31555/utf_16_32_surrogates_2.patch

___
Python tracker 

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



[issue18726] json functions have too many positional parameters

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

But what you will do with discrepancies between Python 2, Python 3 and 
simplejson?

--

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Eli Bendersky

New submission from Eli Bendersky:

There were numerous discussions and issues in the past about the cross-test 
dependencies that sometimes exist because some tests need to muck with import 
caches (both on the Python and C level). Some examples:

http://mail.python.org/pipermail/python-dev/2013-January/123409.html
http://mail.python.org/pipermail/python-dev/2013-August/127766.html

Issue #15651 is an example of a hack that has to stay in the code to allow 
tests to pass. Other things are also difficult - such as simulating situations 
where some optional modules don't exist (like pyexpat).



I suggest to add a capability to regrtest that will allow certain tests to 
request always being run inside a subprocess. Most of the infrastructure is 
already in place, since this is what regrtest uses to run with -jN today.

An alternative would be to add some test.support utility to help with this, but 
then test execution would not be uniform between -j1 and -jN and also some 
things would be difficult to track, such as -R executions (currently all -R 
runs of a single test have to be within a single process for the refcount 
tracking to work).

--
assignee: eli.bendersky
components: Tests
messages: 196793
nosy: eli.bendersky, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Create a way to always run tests in subprocesses within regrtest
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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue18726] json functions have too many positional parameters

2013-09-02 Thread Ezio Melotti

Ezio Melotti added the comment:

> I have not seen any requests for this change.

That's probably because either people have not realized that their code might 
be buggy, or because they have not realized that keyword-only args might be a 
solution to this problem (or maybe they did but didn't bother suggesting it).

--

___
Python tracker 

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



[issue16938] pydoc confused by __dir__

2013-09-02 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +eli.bendersky, ethan.furman

___
Python tracker 

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



[issue18828] urljoin behaves differently with custom and standard schemas

2013-09-02 Thread Madison May

Madison May added the comment:

If nothing else, we should document the work around for this issue.

>>> import urllib.parse
>>> urllib.parse.uses_relative.append('redis')
>>> urllib.parse.uses_netloc.append('redis')
>>> urllib.parse.urljoin('redis://localhost:6379/0', '/1')
'redis://localhost:6379/1'

--

___
Python tracker 

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



[issue18553] os.isatty() is not Unix only

2013-09-02 Thread Dmi Baranov

Dmi Baranov added the comment:

isatty is a part of of POSIX sub-system at Windows > 5.x (AKA 2000) [1] (file 
handling equivalents [2]). I think, we need to remove availability note here.

[1] http://msdn.microsoft.com/en-us/library/f4s0ddew.aspx
[2] http://msdn.microsoft.com/en-us/library/kdfaxaay.aspx

--
nosy: +dmi.baranov

___
Python tracker 

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



[issue18828] urljoin behaves differently with custom and standard schemas

2013-09-02 Thread Madison May

Madison May added the comment:

>How about adding a codecs.register like public API for 3.4+?

A codecs style register function seems like an excellent solution to me.

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Isn't this a duplicate of issue5166?

--

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-09-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 02.09.2013 18:56, Serhiy Storchaka wrote:
> 
> Oh, I were blind. Thank you Marc-Andre. Here is corrected patch. 
> Unfortunately it 1.4-1.5 times slower on UTF-16 encoding UCS2 strings than 
> previous wrong patch.

I think it would be faster to do this in two steps:

1. check the ranges of the input

2. do a memcpy() if there are no lone surrogates

Part 1 can be further optimized by adding a simple range
check (ch >= 0xd800).

--

___
Python tracker 

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



[issue18726] json functions have too many positional parameters

2013-09-02 Thread Bob Ippolito

Bob Ippolito added the comment:

Other than when subclassing (which is actively discouraged), I haven't seen 
anyone try and use positional args for these APIs. I simply don't think this is 
an issue in practice. If you go far enough back in simplejson history, these 
module-global functions were actually keyword-only.

--

___
Python tracker 

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



[issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter

2013-09-02 Thread John Nagle

New submission from John Nagle:

urllib2.open for an FTP url does not obey the timeout parameter.

Attached test program times out on FTP open after 21 seconds, even though the 
specified timeout is 60 seconds.  Timing is consistent; times have ranged from 
21.03 to 21.05 seconds. Python documentation 
(http://docs.python.org/2/library/urllib2.html) says "The optional timeout 
parameter specifies a timeout in seconds for blocking operations like the 
connection attempt (if not specified, the global default timeout setting will 
be used). This actually only works for HTTP, HTTPS and FTP connections."  The 
documentation for Python 3 reads the same.

Open of ftp://ftp.sec.gov/edgar/daily-index failed after 21.05 seconds: 


This was on Windows 7, but the same result is observed on Linux.  

(The FTP server at the U.S. Securities and Exchange Commission is now imposing 
a 20-second connection delay during busy periods.  This is causing our Python 
code that retrieves new SEC filings to fail.  It may be necessary to run the 
program at different times of the day to reproduce the problem.)

--
components: Library (Lib)
files: edgartimeouttest.py
messages: 196800
nosy: nagle
priority: normal
severity: normal
status: open
title: urllib2.open FTP open times out at 20 secs despite timeout parameter
versions: Python 2.7
Added file: http://bugs.python.org/file31558/edgartimeouttest.py

___
Python tracker 

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



[issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter

2013-09-02 Thread John Nagle

John Nagle added the comment:

Reproduced problem in Python 3.3 (Win32). Error message there is:

Open of ftp://ftp.sec.gov/edgar/daily-index failed after 21.08 seconds: 


So this is broken in both Python 2.7 and Python 3.3.

--
versions: +Python 3.3
Added file: http://bugs.python.org/file31559/edgartimeouttest3.py

___
Python tracker 

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



[issue13107] Text width in optparse.py can become negative

2013-09-02 Thread Dmi Baranov

Dmi Baranov added the comment:

I think "ugly look is better than silence" here. Elazar, can you touch a 
optparse too (with some tests - test.support.EnvironmentVarGuard context 
manager will be helpful here)?

--
nosy: +dmi.baranov

___
Python tracker 

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



[issue18808] Thread.join returns before PyThreadState is destroyed

2013-09-02 Thread Zsolt Cserna

Changes by Zsolt Cserna :


--
nosy: +csernazs

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, it isn't faster. I tested this variant, it is 1.5x slower.

And simple range checking actually is slower.

--

___
Python tracker 

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



[issue13107] Text width in optparse.py can become negative

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I think "ugly look is better than silence" here.

Agree. We have two possibilities:

1. Decrease an indentation. There is a lot of blank spaces below option's names.

2. Set some minimal width (10 or 20 characters) and let lines wrap out.

For better look we should use both methods.

--

___
Python tracker 

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



[issue18726] json functions have too many positional parameters

2013-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If no one uses positional arguments then converting parameters to keyword-only 
will not break any code.

--

___
Python tracker 

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



[issue18726] json functions have too many positional parameters

2013-09-02 Thread Bob Ippolito

Bob Ippolito added the comment:

My evidence is only anecdotal. I haven't actively searched for code that uses 
json/simplejson to try and find cases that are using positional arguments.

One way to test this assumption would be to release a version of simplejson 
that deprecates using positional arguments and see if anyone notices. If you 
feel strongly about it, submit a pull request, and I'll review it (although my 
availability is spotty for the next two months due to travel).

--

___
Python tracker 

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



[issue18893] invalid exception handling in Lib/ctypes/macholib/dyld.py

2013-09-02 Thread Madison May

Madison May added the comment:

Seems like a simple fix -- patch attached.

--
keywords: +patch
nosy: +madison.may
Added file: http://bugs.python.org/file31560/issue18893.diff

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-09-02 Thread Eli Bendersky

Eli Bendersky added the comment:

As Serhiy points out, this is a duplicate of #5166

--
superseder:  -> ElementTree and minidom don't prevent creation of not 
well-formed XML

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-09-02 Thread Eli Bendersky

Changes by Eli Bendersky :


--
resolution:  -> duplicate
stage: needs patch -> 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



[issue5166] ElementTree and minidom don't prevent creation of not well-formed XML

2013-09-02 Thread Eli Bendersky

Changes by Eli Bendersky :


--
nosy: +eli.bendersky

___
Python tracker 

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



[issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter

2013-09-02 Thread Charles-François Natali

Charles-François Natali added the comment:

Actually, I think urllib (actually ftplib) handles the timeout correctly.

Here's the result on my Linux box (replacing the server with localhost, with a 
firewall rule to drop packets to ftp port):

$ ./python ~/edgartimeouttest3.py 
Open of ftp://localhost/daily-index failed after 60.09 seconds: 

And indeed, here's what strace shows:

$ strace -ttT ./python ~/edgartimeouttest3.py 
23:15:46.953116 connect(3, {sa_family=AF_INET, sin_port=htons(21), 
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in 
progress) <0.66>
23:15:46.953257 poll([{fd=3, events=POLLOUT}], 1, 6) = 0 (Timeout) 
<60.011497>

See, we - correctly - pass 60s to poll()/select().

Now, I think I know what's going on in your case.
It's likely that your TCP/IP stack settings have shorter timeouts than mine, so 
the kernel reports a timeout on the socket *before the timeout expires*:

If I reduce the SYN retries limit (on Linux):
# sysctl net.ipv4.tcp_syn_retries=1
net.ipv4.tcp_syn_retries = 1

I now get:
$ ./python ~/edgartimeouttest3.py 
Open of ftp://localhost/daily-index failed after 3.03 seconds: 

3s timeout, and yet, we still pass 60 seconds to poll():

23:19:43.756823 connect(3, {sa_family=AF_INET, sin_port=htons(21), 
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in 
progress) <0.99>
23:19:43.757034 poll([{fd=3, events=POLLOUT}], 1, 6) = 1 ([{fd=3, 
revents=POLLOUT|POLLERR|POLLHUP}]) <3.003306>

In short, the kernel reports a timeout on the socket because it reached the 
maximum number of retries for SYN packets.

And actually, you can check that the timeouts are correctly processed by 
passing a smaller value: if it's smaller than the TCP/IP retries limit, you'll 
get exactly the expected timeout.

So I think it's not a Python bug, but rather an issue with your TCP/IP stack 
settings.

On Linux, can you try to increase the following sysctls:
# sysctl net.ipv4.tcp_syn_retries=7
# net.ipv4.tcp_retries1=7

And see if this solves your problem?

(BTW, are you "the" John Nagle?)

--
nosy: +neologix

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Eli Bendersky

Eli Bendersky added the comment:

A question that comes up is how should a module signal to regrtest that it 
needs to be run in a subprocess?

The most natural approach is to have a special attribute set in the module's 
global dict (for example: __REGRTEST_SUBPROCESS__ = True); however, there's a 
slight problem with this approach - regrtest has to import the module to see 
this attribute, and the module may do some work in its top-level code 
(commonly, imports) that already needs to be done within a subprocess.

One solution is to use a different approach, such as a separate file alongside 
the test file (i.e. test_foo.regrtest_subprocess alongside test_foo.py). This 
is quite ugly but "safe".

A different solution is to require modules that want to be executed in a 
subprocess to not do any top-level work; modules can already define a custom 
test_main function that regrtest discovers - we can require for this feature to 
work that modules do all their work through this function, rather than in the 
global scope.

--
stage: needs patch -> 
type: enhancement -> 

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Nick Coghlan

Nick Coghlan added the comment:

An easier hack is likely just a new "always run in subprocess" container
with submodule names in regrtest.py. It's not elegant, but it will work.

--

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Nick Coghlan

Nick Coghlan added the comment:

Although the "well, don't do that then" alternative also sounds reasonable,
and better localises the information about how the test should run.

--

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Eli Bendersky

Eli Bendersky added the comment:

> An easier hack is likely just a new "always run in subprocess" container
> with submodule names in regrtest.py. It's not elegant, but it will work.
>

True, that's also an option. I had it in mind in the beginning, but it's
too hacky for my tastes :-) Not doing state-changing stuff in the global
scope is a good practice anyway, so the restriction should be too horrible.

Do we have some sort of conventions of outside-discoverable module
attributes (like the __REGRTEST_SUBPROCESS__ proposed above)? I.e. in terms
of naming, type, expected values?

--

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Eli Bendersky

Changes by Eli Bendersky :


--
Removed message: http://bugs.python.org/msg196813

___
Python tracker 

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-02 Thread Eli Bendersky

Eli Bendersky added the comment:

> An easier hack is likely just a new "always run in subprocess" container
> with submodule names in regrtest.py. It's not elegant, but it will work.
>

True, that's also an option. I had it in mind in the beginning, but it's
too hacky for my tastes :-) Not doing state-changing stuff in the global
scope is a good practice anyway, so the restriction should not be too horrible.

Do we have some sort of conventions of outside-discoverable module
attributes (like the __REGRTEST_SUBPROCESS__ proposed above)? I.e. in terms
of naming, type, expected values?

--

___
Python tracker 

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



[issue17930] Search not needed in combinations_with_replacement

2013-09-02 Thread Tim Peters

Tim Peters added the comment:

I'm closing this.  While it makes a big difference for a cwr coded in Python, 
it turn out to be minor in C.  The extra complications (more state to remember 
and update across next() invocations) isn't worth the minor speedup in C.

--
resolution:  -> rejected
stage: needs patch -> 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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

New submission from Elazar Gershuni:

Inner sections "leak" out from enum to the general datatypes index:
http://docs.python.org/3.4/library/datatypes.html

(sections 8.14 - 8.17)

--
assignee: docs@python
components: Documentation
messages: 196816
nosy: docs@python, elazar
priority: normal
severity: normal
status: open
title: Enum docs: sections leak out

___
Python tracker 

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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Elazar Gershuni added the comment:

here's a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file31561/enumcontain.patch

___
Python tracker 

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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Eli Bendersky

Changes by Eli Bendersky :


--
nosy: +eli.bendersky, ethan.furman

___
Python tracker 

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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Eli Bendersky

Changes by Eli Bendersky :


--
stage:  -> patch review
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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Added file: http://bugs.python.org/file31562/enumindent.patch

___
Python tracker 

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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Added file: http://bugs.python.org/file31563/enumplusminor.patch

___
Python tracker 

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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Added file: http://bugs.python.org/file31564/enumplusminor.patch

___
Python tracker 

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



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Removed file: http://bugs.python.org/file31563/enumplusminor.patch

___
Python tracker 

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



[issue17862] itertools.chunks(iterable, size, fill=None)

2013-09-02 Thread Jakub Stasiak

Jakub Stasiak added the comment:

I'm just gonna leave my implementation of chunk function (not sure about the 
name yet) here, it's basically what itertools.chunks from the previous patch is 
but it works for arbitrary iterables + few tests and documentation. The last 
chunk is currently truncated if there are not enough elements to fill it 
completely.

--
nosy: +jstasiak
Added file: http://bugs.python.org/file31565/itertools.chunk.patch

___
Python tracker 

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



[issue18909] Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp

2013-09-02 Thread Christoph Gohlke

New submission from Christoph Gohlke:

Using 64 bit CPython 2.6.6, 2.7.5, 3.2.5 or 3.3.2, numpy 1.7.1 and matplotlib 
1.3.0 on Windows 8 64 bit, the following script segfaults most of the times: 

```
# allocate ~4GB fragmented data
import numpy
a = [numpy.zeros(2**i, 'uint8') for i in range(1, 31)]
b = [numpy.zeros(131072, 'float64') for i in range(2048)]

# plot using TkAgg
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot
pyplot.plot()
pyplot.show()
```

```
Fatal Python error: Segmentation fault

Current thread 0x00036c5c:
  File "X:\Python33\lib\site-packages\matplotlib\backends\tkagg.py", line 17 in 
blit
  File "X:\Python33\lib\site-packages\matplotlib\backends\backend_tkagg.py", 
line 349 in draw
  File "X:\Python33\lib\site-packages\matplotlib\backends\backend_tkagg.py", 
line 276 in resize
  File "X:\Python33\lib\tkinter\__init__.py", line 1475 in __call__
  File "X:\Python33\lib\tkinter\__init__.py", line 965 in update
  File "X:\Python33\lib\site-packages\matplotlib\backends\backend_tkagg.py", 
line 574 in show
  File "X:\Python33\lib\site-packages\matplotlib\backend_bases.py", line 87 in 
__call__
  File "X:\Python33\lib\site-packages\matplotlib\pyplot.py", line 145 in show
  File "tk_crash_win-amd64.py", line 14 in 
```

The pointer returned by Python's _tkinter.tkapp.interpaddr() is often wrong 
because the 64 bit pointer is cast to 32 bit long and returned as PyInt. 
Instead, the pointer should be cast to Py_ssize_t and returned as PyLong on 
win-amd64.

The following patches for win-amd64-py2.7.5 and win-amd64-py3.3.2 fix the issue:

```
--- a/Modules/_tkinter.cSun Sep 01 19:06:35 2013 -0400
+++ b/Modules/_tkinter.cMon Sep 02 17:44:53 2013 -0700
@@ -2814,7 +2814,7 @@
 if (!PyArg_ParseTuple(args, ":interpaddr"))
 return NULL;

-return PyInt_FromLong((long)Tkapp_Interp(self));
+return PyInt_FromSsize_t((Py_ssize_t)Tkapp_Interp(self));
 }
```

```
--- a/Modules/_tkinter.cSun Sep 01 19:03:41 2013 -0400
+++ b/Modules/_tkinter.cMon Sep 02 17:44:02 2013 -0700
@@ -2688,7 +2688,7 @@
 if (!PyArg_ParseTuple(args, ":interpaddr"))
 return NULL;

-return PyLong_FromLong((long)Tkapp_Interp(self));
+return PyLong_FromSsize_t((Py_ssize_t)Tkapp_Interp(self));
 }
```

Updated _tkinter.pyd files are available at 
.

--
messages: 196819
nosy: cgohlke
priority: normal
severity: normal
status: open
title: Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp
type: crash
versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue18909] Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp

2013-09-02 Thread Christoph Gohlke

Changes by Christoph Gohlke :


Added file: 
http://bugs.python.org/file31568/fix_tkapp_interpaddr-win-amd64-py3.3.diff

___
Python tracker 

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



[issue18909] Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp

2013-09-02 Thread Christoph Gohlke

Changes by Christoph Gohlke :


Added file: http://bugs.python.org/file31566/tkapp_interpaddr_crash_win-amd64.py

___
Python tracker 

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



[issue18909] Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp

2013-09-02 Thread Christoph Gohlke

Changes by Christoph Gohlke :


--
keywords: +patch
Added file: 
http://bugs.python.org/file31567/fix_tkapp_interpaddr-win-amd64-py2.7.diff

___
Python tracker 

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



[issue18910] IDLE: Unit test for textView.py

2013-09-02 Thread Phil Webster

New submission from Phil Webster:

Started writing the tests for textView.py.

--
components: IDLE
files: test_textview.patch
keywords: patch
messages: 196820
nosy: JayKrish, Todd.Rovito, philwebster, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Unit test for textView.py
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31569/test_textview.patch

___
Python tracker 

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



[issue18219] csv.DictWriter is slow when writing files with large number of columns

2013-09-02 Thread Mikhail Traskin

Mikhail Traskin added the comment:

Peter, thank you for letting me know that views work with list, I was not aware 
of this. This is indeed the best solution and it also keeps the DictWriter 
interface unchanged.

Terry, attached patch contains the DictWriter change and a test case in 
test_csv.py.

--
Added file: http://bugs.python.org/file31570/csvdictwriter.v4.patch

___
Python tracker 

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



[issue18553] os.isatty() is not Unix only

2013-09-02 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Agree

--
nosy: +asvetlov

___
Python tracker 

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



[issue17997] ssl.match_hostname(): sub string wildcard should not match IDNA prefix

2013-09-02 Thread Toshio Kuratomi

Toshio Kuratomi added the comment:

So, is this a security issue?  I've been wondering if I should apply the 
attached patch to the backports-ssl_match_hostname module on pypi.  I was 
hoping there'd be some information here as to whether this will be going into 
the stdlib in the future.

Thus far, ssl_match_hostname has just been a backport of the match_hostname 
function but if this is a security problem, I could press for us to diverge 
from the python3 stdlib.  It would be easier to make the case if this is seen 
as a critical problem that will need to be fixed even if the current patch 
might not be the eventual fix.

--
nosy: +a.badger

___
Python tracker 

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



[issue18911] minidom does not encode correctly when calling Document.writexml

2013-09-02 Thread Brian Vanderburg

New submission from Brian Vanderburg:

When I have unicode data to save, it seems that it does not save correctly, 
giving an encode error. I know this exists on 2.7 and from checking the code in 
xml/dom/minidom.py it looks like it does in 3.2 as well.

The method call that seem to be problematic is doc.writexml(open(filename, 
"wb"), "", "  ", "utf-8")

Currently I found this to work: doc.writexml(codecs.open(filename, "w", 
"utf-8"), "", "  ", "utf-8")

It seems like this should be handled by the writexml method since it already 
has the specified encoding.

--
components: XML
messages: 196824
nosy: brianvanderburg2
priority: normal
severity: normal
status: open
title: minidom does not encode correctly when calling Document.writexml
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