[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Neil Girdhar added the comment:

Another bug, another test.

--
Added file: http://bugs.python.org/file37926/starunpack29.diff

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



[issue23348] distutils.LooseVersion fails to compare two valid versions

2015-01-30 Thread Guillaume

Guillaume added the comment:

Do you mean http://bugs.python.org/issue14894 ?

--

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



[issue23284] Improve termcap detection in setup.py

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

FWIW, even 
http://www.linuxfromscratch.org/lfs/view/stable/chapter06/readline.html
enforces -ncurses linking of readline.

[They should be compiling ncurses with tinfo split out though and
 use -tinfo instead.]

--

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



[issue23351] socket.settimeout(5.0) does not have any effect

2015-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The test script works on Ubuntu 14.10 as well.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Neil Girdhar added the comment:

Fixed a bug in ceval.c; added a test to test_unpack_ex.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Changes by Neil Girdhar mistersh...@gmail.com:


Added file: http://bugs.python.org/file37924/starunpack28.diff

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Changes by Neil Girdhar mistersh...@gmail.com:


Added file: http://bugs.python.org/file37925/starunpack28.diff

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



[issue23353] gnerator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

I simplified the script even more: 287 lines (6 functions/generators, 7 
classes/exceptions) = 28 lines (1 generator)!

--
Added file: http://bugs.python.org/file37923/excinfo_bug6.py

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



[issue23348] distutils.LooseVersion fails to compare two valid versions

2015-01-30 Thread Éric Araujo

Éric Araujo added the comment:

Thanks for the report.  I think there’s already a long discussion in another 
ticket but don’t have time to search right now.

--
resolution:  - duplicate

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Guido van Rossum

Guido van Rossum added the comment:

For the PEP update, please check out the PEP repo at hg.python.org and send
a patch to p...@python.org.
On Jan 30, 2015 3:54 AM, Neil Girdhar rep...@bugs.python.org wrote:


 Neil Girdhar added the comment:

 Is it possible to edit the PEP to reflect the current design decisions?

 Specifically:

 * Remove: Because of the new levity for * and ** unpackings, it may be
 advisable to lift some or all of these restrictions. (in both abstract and
 specification)
 * Extend: Currently duplicate arguments raise TypeError.  This remains
 true for duplicate arguments provided through multiple keyword argument
 unpackings, e.g. f(**{'x': 2}, **{'x': 3})
 * Add some examples of dictionary overriding to the list of examples:

  {'x': 1, **{'x': 2}}
 {'x': 2}

  {**{'x': 2}, 'x': 1}
 {'x': 1}

 * Remove if the restrictions are kept (they are)
 * Remove If they are removed completely...
 * In disadvantages, remove if the current are kept (they are).  Don't
 write * unpackings, write iterable unpackings
 * Remove if the current restrictions are lifted
 * Remove Implementation section (it's done!)
 * Add to specification: f(*x for x in it) and f(**x for x in it) remain
 SyntaxErrors.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue2292
 ___


--

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Changes by Neil Girdhar mistersh...@gmail.com:


Removed file: http://bugs.python.org/file37924/starunpack28.diff

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



[issue23349] PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

Looks good, here's a patch with tests.

--
Added file: http://bugs.python.org/file37927/issue23349-2.diff

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



[issue14894] distutils.LooseVersion fails to compare number and a word

2015-01-30 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
assignee: eric.araujo - 
versions: +Python 3.5 -Python 3.3, Python 3.4

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Backported tests exposed off-by-one error in PyUnicode_FromFormatV. This error 
was fixed in 3.x in changeset ac768c8e13ac (issue7228).

--

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



[issue23348] distutils.LooseVersion fails to compare two valid versions

2015-01-30 Thread Éric Araujo

Éric Araujo added the comment:

Yes, thanks. Please weigh in on the other ticket.

--
status: open - closed
superseder:  - distutils.LooseVersion fails to compare number and a word

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Joshua Landau

Joshua Landau added the comment:

Special-cased `(*i for i in x)` to use YIELD_FROM instead of looping. Speed 
improved, albeit still only half as fast as chain.from_iterable.

Fixed error message check in test_syntax and removed semicolons.

--
Added file: http://bugs.python.org/file37928/starunpack30.diff

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 245c9f372a34 by Serhiy Storchaka in branch '2.7':
Issue #23055: Fixed read-past-the-end error in PyUnicode_FromFormatV.
https://hg.python.org/cpython/rev/245c9f372a34

New changeset 9fe1d861f486 by Serhiy Storchaka in branch '3.2':
Issue #23055: Fixed read-past-the-end error in PyUnicode_FromFormatV.
https://hg.python.org/cpython/rev/9fe1d861f486

--

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



[issue20416] Marshal: special case int and float, don't use references

2015-01-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are results of the benchmark which measures dump and load time for all pyc 
files in the stdlib (including tests).

https://bitbucket.org/storchaka/cpython-stuff/src/default/marshal/marshalbench.py

$ find * -name __pycache__ -exec rm -rf '{}' +
$ ./python -m compileall -qq -r 99 Lib
$ find Lib -name '*.pyc' | xargs ./python marshalbench.py

Without the patch:

ver.  dumps   loads  size
  770.3   19941.2
0 695.7  1178.4   19941.2
1 680.4  1180.9   19941.2
2 635.9  1115.9   19941.2
3 896.3   757.3   19941.2
4 748.0   700.6   19941.2

With marshal3_numbers.patch:

ver.  dumps   loads  size
  750.5   19946.1
0 690.2  1173.7   19946.1
1 678.2  1166.6   19946.1
2 630.9  1105.2   19946.1
3 873.2   751.5   19946.1
4 724.6   687.6   19946.1

With marshal_refs_by_value.patch:

ver.  dumps   loads  size
  780.2   19935.8
0 712.7  1202.6   19935.8
1 713.8  1195.1   19935.8
2 676.5  1126.0   19935.8
3 686.1   762.7   19935.8
4 515.1   697.6   19935.8

--

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

I think in 2.7 there's a slight problem since e6b9e277fbf4:

[1/1] test_unicode
Debug memory block at address p=0x7f4ebba3fae0: API 'o'
100 bytes originally requested
The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.
The 8 pad bytes at tail=0x7f4ebba3fb44 are not all FORBIDDENBYTE (0xfb):
at tail+0: 0x00 *** OUCH
at tail+1: 0xfb
at tail+2: 0xfb
at tail+3: 0xfb
at tail+4: 0xfb
at tail+5: 0xfb
at tail+6: 0xfb
at tail+7: 0xfb
The block was made by call #659785 to debug malloc/realloc.
Data at p: 20 20 20 20 20 20 20 20 ... 20 20 20 20 20 31 32 33
Fatal Python error: bad trailing pad byte
Aborted (core dumped)

--
nosy: +skrah

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-01-30 Thread Richard Hansen

Richard Hansen added the comment:

 People might rely on the fact that contiguous implies suboffsets==NULL.

Cython (currently) relies on all-negatives being acceptable and equivalent to 
suboffsets==NULL.  See:
https://github.com/cython/cython/pull/367
http://thread.gmane.org/gmane.comp.python.cython.devel/15569

--

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, I think following patch will help.

--
Added file: http://bugs.python.org/file37929/issue23055_2.patch

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

issue23055_2.patch looks good.

--

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



[issue11578] Increase test coverage for timeit.py

2015-01-30 Thread koobs

Changes by koobs koobs.free...@gmail.com:


--
versions: +Python 2.7

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e5d79e6deeb5 by Serhiy Storchaka in branch '2.7':
Issue #23055: Fixed off-by-one error in PyUnicode_FromFormatV.
https://hg.python.org/cpython/rev/e5d79e6deeb5

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy:  -eric.araujo

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



[issue11578] Increase test coverage for timeit.py

2015-01-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka

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



[issue20306] Lack of pw_gecos field in Android's struct passwd causes cross-compilation for the pwd module to fail

2015-01-30 Thread Matt Frank

Matt Frank added the comment:

Apologies.  That last patch includes diffs to generated files (configure and 
pyconfig.h.in).  This version just patches Modules/pwdmodule.c and configure.ac.

After applying the patch please run autoheader and autoconf to correctly 
regenerate configure and pyconfig.h.in.

--
Added file: 
http://bugs.python.org/file37930/pw_gecos-field-workaround-with-config_ac-mods.patch

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Stefan for pointing on tests failure.

--

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

I think I still get a problem in 2.7:

[1/1] test_unicode
==23430== Invalid read of size 1
==23430==at 0x484541: PyUnicodeUCS2_FromFormatV (unicodeobject.c:736)
==23430==by 0x485C75: PyUnicodeUCS2_FromFormat (unicodeobject.c:1083)


736 for (f = format; *f; f++) {
(gdb) p format
$1 = 0x71d45f4 %
(gdb) p f
$2 = 0x71d45f6 


So format==%, first f++ happens at 738, second f++ happens implicitly
at the end of the for loop. The *f condition in 736 is then an invalid
read.


Perhaps use while for the outer loop and a break? (It's just my
personal preference, I sometimes get confused by incrementing
at the end and also inside for loops.)

--

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



[issue22986] Improved handling of __class__ assignment

2015-01-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0d25de5919e by Benjamin Peterson in branch 'default':
allow changing __class__ between a heaptype and non-heaptype in some cases 
(closes #22986)
https://hg.python.org/cpython/rev/c0d25de5919e

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue23349] PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers

2015-01-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a9305102c892 by Stefan Krah in branch '2.7':
Issue #23349: Fix off-by-one error in PyBuffer_ToContiguous(). Initial patch
https://hg.python.org/cpython/rev/a9305102c892

--
nosy: +python-dev

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



[issue16318] FTP_TLS in ftplib not supporting prot_p storlines in FTP7.5

2015-01-30 Thread Lukasz Szybalski

Lukasz Szybalski added the comment:

Hello,
We are having issues usign ftplib for implicit TLS over port 990

I'm referencing a solution that states 

For the implicit FTP TLS/SSL(defualt port 990), our client program must build 
a TLS/SSL connection right after the socket is created. But python's class 
FTP_TLS doesn't reload the connect function from class FTP. We need to fix it:



http://stackoverflow.com/questions/12164470/python-ftp-tls-connection-issue

{{{
#ImplicityTLS.py
from ftplib import FTP_TLS
import socket
import ssl

class tyFTP(FTP_TLS):
def __init__(self, host='', user='', passwd='', acct='', keyfile=None, 
certfile=None, timeout=60):
FTP_TLS.__init__(self, host, user, passwd, acct, keyfile, certfile, 
timeout)
def connect(self, host='', port=0, timeout=-999):
if host != '':
self.host = host
if port  0:
self.port = port
if timeout != -999:
self.timeout = timeout

try: 
self.sock = socket.create_connection((self.host, self.port), 
self.timeout)
self.af = self.sock.family
self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, 
ssl_version=ssl.PROTOCOL_TLSv1)
self.file = self.sock.makefile('rb')
self.welcome = self.getresp()
except Exception as e:
print e
return self.welcome
}}}


Then from my main application I did this:

{{{
from ImplicityTLS import tyFTP
server = tyFTP()
server.connect(host=x, port=990)
server.login(user=, passwd=f)
server.prot_p()
}}}

--
nosy: +lszyba1

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



[issue8534] multiprocessing not working from egg

2015-01-30 Thread Davin Potts

Davin Potts added the comment:

The example demonstrating the issue is reproducible on Windows (tested on 
Windows 7 64-bit, specifically) with 2.7.9.  Complications arising from how 
multiprocessing creates new processes on Windows combined with conventions in 
the import system in 2.7.9 result in the problem being triggered here.

This issue is specific to Windows platform use:  It was not possible to 
reproduce the issue on OS X nor Linux with 2.7.9.

As played out in the discussion around issue10845 (long since closed), 
solutions were devised and put into place as part of PEP451, exposed first in 
Python 3.4.  And so it was not possible to reproduce this issue with default 
(3.5) on Windows 7.

It is very much appreciated anytime such a nice, clean demonstration code is 
provided and more than doubly so anytime a proposed patch is also offered.  
While the supplied/proposed patch does provide some workaround it is not yet a 
comprehensive solution and appears to potentially cause complications in other 
scenarios.  The current best effort at a comprehensive solution is reflected in 
the changes designed and now implemented in 3.4.

Two aspects to the resolution on this issue:
* For the 2.x branches, it is unlikely that we will see a backport of PEP451 
and so a more comprehensive solution might depend upon some other fundamental 
changes to how multiprocessing operates on Windows platforms but there are no 
such plans to invest that level of effort into 2.7.  It is still possible that 
someone might become so motivated about multiprocessing+Windows+2.7 but that 
seems ever more unlikely.
* For the 3.x branches, we have verified that changes in 3.4 have resulted in a 
fix for this particular issue.  Overall, marking this as fixed in 3.[4-5].

--
nosy: +davin
resolution:  - fixed
stage: needs patch - resolved
status: open - closed

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



[issue11578] Increase test coverage for timeit.py

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

I think all 2.7 bots are broken. :)

--
nosy: +skrah

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-01-30 Thread Sebastian Berg

Sebastian Berg added the comment:

Numpy does not understand suboffsets. The buffers we create will always have 
them NULL. The other way around To be honest, think it is probably ignoring 
the whole fact that they might exist at all :/, really needs to be fixed if it 
is the case.

--

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
status: closed - open

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



[issue23350] Content-length is incorrect when request body is a list or tuple

2015-01-30 Thread Demian Brecht

Demian Brecht added the comment:

On 2015-01-29 9:51 PM, Martin Panter wrote:
 The documentation currently says “Content-Length header should be explicitly 
 provided when the body is an iterable”. See Lib/urllib/request.py:1133 for 
 how it is done for urlopen(), using memoryview(), which is probabaly more 
 correct.

Sure, entirely disabling computing the content length if the body is an
iterable is one way to address it, but I'm not convinced that it's
better. If the ability is there to compute the content length, why not
do so?

The current implementation /should/ be correct whether elements are
bytes or strings (the default encoding doesn't allow for multi-byte
chars, so len(raw_string) should equal len(encoded_string)) when encoded
using the new block of encoding code I added in the patch.

Is there something that I'm missing? I could possibly see an argument
for performance as you're iterating over each element in the list, but
that would be entirely circumvented if the user defines the content
length up front.

--

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



[issue14613] time.time can return NaN

2015-01-30 Thread matham

matham added the comment:

Ok, first, I was able to make it happen outside of kivy using only my code. 
However, I'm not sure it's of much help because it's using my ffmpeg based code 
(https://github.com/matham/ffpyplayer) which is not a simple script :)

The issue happens when ffmpeg emits logs through a c(cython) callback which 
calls the python logging code. But it only happened when I played a specific 
video. That's why i doubt I'd be able to make it happen in a sterile 
environment with a simple script. Also, I'm pretty sure that the log calling 
code is executed from ffmpeg's internal secondary threads (which I protect it 
with a mutex).

Anyway, I decided to upgrade my ffmpeg libraries to the most recent ffmpeg 
version and the problem went away. So was this maybe some bug in older ffmpeg 
which corrupted python? If you're interested in replicating it with the older 
ffmpeg, I can post some code using my ffpyplayer library.

--

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



[issue11578] Increase test coverage for timeit.py

2015-01-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aa6f8e067ec3 by Serhiy Storchaka in branch '2.7':
Use float division to avoid deprecation warning in test_timeit (issue #11578).
https://hg.python.org/cpython/rev/aa6f8e067ec3

--

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

Last major change related to generators in Python/ceval.c:
---
changeset:   47594:212a1fee6bf9
parent:  47585:b0ef00187a7e
user:Benjamin Peterson benja...@python.org
date:Wed Jun 11 15:59:43 2008 +
files:   Doc/library/dis.rst Doc/library/inspect.rst Doc/library/sys.rst 
Doc/reference/datamodel.rst Include/frameobject.h Include/opcode.h 
Lib/doctest.py Li
description:
#3021: Antoine Pitrou's Lexical exception handlers
---

This change introduced SWAP_EXC_STATE() and SAVE_EXC_STATE().

--
title: gnerator bug with exception: tstate-exc_value is not cleared after an 
except block - generator bug with exception: tstate-exc_value is not cleared 
after an except block

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



[issue20169] random module doc page has broken links

2015-01-30 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
versions: +Python 3.5 -Python 3.3

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +pitrou, serhiy.storchaka

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



[issue17188] Document 'from None' in raise statement doc.

2015-01-30 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
stage: needs patch - patch review
versions: +Python 3.5 -Python 3.3

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

Attached gen_exc_value_py27.patch: Patch for Python 2.7. No unit test yet.

The full test suite of trollius pass on the patched Python 2.7 and on the 
patched Python 3.5. The full test suite of asyncio also pass on the patched 
Python 3.5.

--
Added file: http://bugs.python.org/file37932/gen_exc_value_py27.patch

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



[issue23350] Content-length is incorrect when request body is a list or tuple

2015-01-30 Thread Martin Panter

Martin Panter added the comment:

Sorry my comment was a bit rushed. I wasn’t saying this feature shouldn’t be 
added. I guess I was pointing out two things:

1. Someone should updated the documentation to say that Content-Length no 
longer has to be explicitly provided for lists and tuples.

2. Perhaps you could consider using the same len(memoryview) * 
memoryview.itemsize technique used in urllib, so that the length of e.g. 
array.array(I, range(3)) is correct. But that is tangential to what you are 
trying to achieve, and now I realize coping with Latin-1 encoding at the same 
time might make it a bit too complicated, so perhaps don’t worry about it :)

--

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



[issue14613] time.time can return NaN

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

I'm interested to investigate this issue, but right now I have no idea how to 
reproduce it. If I cannot reproduce the issue, I cannot investigate it.

Are you able to write a short Python script to reproduce the issue? Did you 
modify manually the system time? It looks like your application uses Kivy. Many 
Kivy does some maths which causes issues with the FPU and the error is reported 
later in time.time()? (I don't see how...)

--

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

Attached gen_exc_value.patch changes how generators handle the currently 
handled exception (tstate-exc_value). The patch probably lacks tests to test 
the exact behaviour of sys.exc_info(). The 3 examples below can be used to 
write such tests. But before investing time on an implemenation, I would like 
to ensure that I correctly understood the bug and discuss how it should be 
fixed.

Currently, a generator inherits the currently handled exception from the 
caller (function calling next(), gen.send() or gen.throw()). With the patch, 
the generator and its caller don't share the exception anymore. The generator 
still remembers the current exception when it is interrupted by yield.

It's still possible to pass the exception from the caller to the generator 
using the throw() method of the generator. My patch doesn't change the 
behaviour of throw(): see the example 3 below.

The patch also fixes the initial issue: ./python -m test test_asyncio 
test_functools doesn't fail anymore.

Python 2.7 is also affected by the bug. I don't know yet if it's safe to change 
the behaviour of currently handled exception in Python 2 generators. It may 
break backward compatibility. We should probably check applications which 
heavily depends on generators. For example, the Trollius and Twisted projects 
use generators for coroutines in asynchronous programming.

The backward compatibility also matters in Python 3.4, so same question: should 
we change the behaviour of Python 3.4? Can it break applications?

In Python 3, the currently handled exception is more important than in Python 
2, because it is used to automatically fill the __context__ attribute of raised 
exceptions.

I didn't test the behaviour of yield-from yet, I don't know how my patch 
changes its behaviour.


Example 1:
---
import sys

def gen():
print(sys.exc_info())
yield

g = gen()
try:
raise ValueError
except Exception:
next(g)
---

Original output:
---
(class 'ValueError', ValueError(), traceback object at 0x7f22a1ab52c8)
---

With the patch:
---
(None, None, None)
---


Example 2:
---
import sys

def gen():
try:
yield
raise TypeError()
except:
print(sys.exc_info())
print(sys.exc_info())
yield

g = gen()
next(g)
try:
raise ValueError
except Exception:
next(g)
---

Original output:
---
(class 'TypeError', TypeError(), traceback object at 0x7fad239a22c8)
(class 'ValueError', ValueError(), traceback object at 0x7fad239a2288)
---

With the patch:
---
(class 'TypeError', TypeError(), traceback object at 0x7f278b174988)
(None, None, None)
---


Example 3:
---
import sys

def gen():
try:
try:
yield
except:
print(sys.exc_info())
raise TypeError()
except Exception as exc:
print(TypeError context:, repr(exc.__context__))
yield

g = gen()
next(g)
try:
raise ValueError
except Exception as exc:
g.throw(exc)
---

Original output:
---
(class 'ValueError', ValueError(), traceback object at 0x7f233f05e388)
TypeError context: ValueError()
(class 'ValueError', ValueError(), traceback object at 0x7f233f05e348)
---

With the patch (unchanged):
---
(class 'ValueError', ValueError(), traceback object at 0x7fdf356fead8)
TypeError context: ValueError()
(None, None, None)
---

--
keywords: +patch
versions: +Python 2.7
Added file: http://bugs.python.org/file37931/gen_exc_value.patch

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

Oh, by the way: keeping the exception after the except block is also a tricky 
reference leak. In Python 3, since exceptions store their traceback, this issue 
may keep a lot of objects alive too long, whereas they are expected to be 
destroyed much earlier.

When I started to investigate this issue, it took me 2 hours to begin to 
understand why so many objects were kept alive. It looks like a reference 
cycle, a reference leak, or other kind of complex memory leak. Clearing 
manually local variables (ex: self = None in methods) is not enough.

Python 2 has a sys.exc_clear() method which can be used to workaround this 
issue. It cannot be used in Python 3 since the function was removed in Python 3.

--

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

See also:

* PEP 3134: Exception Chaining and Embedded Tracebacks (Python 3.0)
* Issue #3021: Lexical exception handlers (Python 3.0) -- thread: 
https://mail.python.org/pipermail/python-3000/2008-May/013740.html
* PEP 380: Syntax for Delegating to a Subgenerator (Python 3.3)

--

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Currently, a generator inherits the currently handled exception from
 the caller 

This is expected, since this is how normal functions behave.

--

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

STINNER Victor added the comment:

  Currently, a generator inherits the currently handled exception from
  the caller

 This is expected, since this is how normal functions behave.

Do you see how to fix the issue without changing the behaviour?

--

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



[issue23354] Loading 2 GiLOC file which raises exception causes wrong traceback

2015-01-30 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue23355] rsplit duplicates split behavior

2015-01-30 Thread eryksun

eryksun added the comment:

The result of str.split and str.rsplit can differ depending on the optional 2nd 
parameter, maxsplit:

 'a b c'.split(None, 1)
['a', 'b c']
 'a b c'.rsplit(None, 1)
['a b', 'c']

https://docs.python.org/2/library/stdtypes.html#str.rsplit

--
nosy: +eryksun

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Attached patch fixes the test script and doesn't break any test.

--
Added file: http://bugs.python.org/file37933/gen_exc_state_restore.patch

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



[issue23353] generator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note the patch also fixes the reference leak in test_asyncio.

--

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



[issue23354] Loading 2 GiLOC file which raises exception causes wrong traceback

2015-01-30 Thread SoniEx2

New submission from SoniEx2:

I loaded a file with 2 GiLOC followed by assert False and this was the 
error/traceback:

Traceback (most recent call last):
  File test.py, line -2147483647, in module
AssertionError

--
components: Interpreter Core
messages: 235079
nosy: SoniEx2
priority: normal
severity: normal
status: open
title: Loading 2 GiLOC file which raises exception causes wrong traceback
type: behavior
versions: Python 3.4

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



[issue23355] rsplit duplicates split behavior

2015-01-30 Thread kai keliikuli

New submission from kai keliikuli:

'a b'.split() == 'a b'.rsplit()

--
messages: 235080
nosy: kai.keliikuli
priority: normal
severity: normal
status: open
title: rsplit duplicates split behavior
type: behavior
versions: Python 2.7

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



[issue23355] rsplit duplicates split behavior

2015-01-30 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue15955] gzip, bz2, lzma: add option to limit output size

2015-01-30 Thread Martin Panter

Martin Panter added the comment:

Nikolaus, do you still plan on doing the bzip module? If not, I could have a go 
when I get a chance. I’m also keen for the GzipFile decompression to be fixed, 
if anyone wants to review my gzip-bomb.patch.

--

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



[issue23320] devguide should mention rules about paragraph reflow in the documentation

2015-01-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

For normal paragraphs, long and short lines make no difference to Sphinx and 
subsequent output.  I would like to know and have documented when (how uneven 
the lines) a reflow is otherwise considered necessary.

--
nosy: +georg.brandl, terry.reedy

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



[issue23320] devguide should mention rules about paragraph reflow in the documentation

2015-01-30 Thread Georg Brandl

Georg Brandl added the comment:

For patches to be reviewed (whether submitted by a core developer or not), 
there should be as little spurious changes as possible.  In the final commit, 
it's ok, but not mandatory, to reflow the paragraphs.

--

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



[issue23308] a bug in Instructions section 4.1

2015-01-30 Thread Zachary Ware

Zachary Ware added the comment:

I'm not seeing any problem with any section 4.1.  If you can provide a direct 
link to the problem and a description of it, please reopen the issue.

--
nosy: +zach.ware
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue23316] Incorrect evaluation order of function arguments with *args

2015-01-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I expect left to right as documented (and designed by Guido).  His OK or 
clarification would be to intentionally do differently.

--
nosy: +terry.reedy

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



[issue11578] Increase test coverage for timeit.py

2015-01-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
status: open - closed

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



[issue23337] Run python with restricted rights

2015-01-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree that this would have been better asked on python-list.  However... I 
would like a better handle on when this occurs to either make it happens less 
or better document workarounds.  How did you install python?  The .msi 
installer from python.org?  Which directory? 34 or 64 bit? Which Windows 
version? Install for all users or just one account?  How start Idle?

In the meanwhile, at a Command Prompt command line,
 python -m idlelib -n 
should work.

--
components: +IDLE
nosy: +terry.reedy
stage:  - test needed
type: crash - behavior
versions: +Python 3.5

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



[issue23055] PyUnicode_FromFormatV crasher

2015-01-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
status: open - closed

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



[issue14613] time.time can return NaN

2015-01-30 Thread matham

matham added the comment:

Hi guys,

I'm running into this issue on windows 7 using python 2.7.8 (x86) from the 
python website.

The following exception occurs while cython code calls a python function which 
emits a log. When replaying the same code it happens consistently:

Traceback (most recent call last):
  File g:\python\dev2\kivy\kivy\core\image\img_ffpyplayer.py, line 28, in 
_log_callback
logger_func[level]('ImageLoaderFFPy: {}'.format(message))
  File E:\Python27\lib\logging\__init__.py, line 1186, in error
self._log(ERROR, msg, args, **kwargs)
  File E:\Python27\lib\logging\__init__.py, line 1278, in _log
record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, 
func, extra)
  File E:\Python27\lib\logging\__init__.py, line 1252, in makeRecord
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
  File E:\Python27\lib\logging\__init__.py, line 287, in __init__
self.msecs = (ct - long(ct)) * 1000
ValueError: cannot convert float NaN to integer

Even weirder, if I add a line like `print time.time()` right before `ct = 
time.time()` in logging\__init__.py no error occurs. But if I duplicate the 
print line twice, it crashes right there instead of raising an exception.

--
nosy: +matham

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



[issue23353] gnerator bug with exception: tstate-exc_value is not cleared after an except block

2015-01-30 Thread STINNER Victor

New submission from STINNER Victor:

Since my changeset a5efd5021ca1, the Python test suite starts to fail randomly. 
Running test_asyncio modifies sys.exc_info(): it is not (None, None, None) 
after the execution of test_asyncio. The problem comes from 
test_cancel_make_subprocess_transport_exec() of 
Lib/test/test_asyncio/test_subprocess.py.

I tried to write a simple script which does not depend on Python to reproduce 
the issue. See attached excinfo_bug2.py script.

Output:
---
exc_info after except (class '__main__.MyException', MyException(), 
traceback object at 0x7f09201ad7c8)
exc_info at exit (class '__main__.MyException', MyException(), traceback 
object at 0x7f09201abd08)
---

exc_info is supposed to be (None, None, None), at least at exit.

I will try to write an even simpler script to identify the bug.

--
files: excinfo_bug2.py
messages: 235033
nosy: haypo
priority: normal
severity: normal
status: open
title: gnerator bug with exception: tstate-exc_value is not cleared after an 
except block
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37922/excinfo_bug2.py

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

For the record: I'm myself guilty of accepting all-negative suboffsets
in memoryview.c (see init_slice()) and I think there's even a test for it.

However, while it's ok for a specific function to accept this
corner case, I'm not sure about is_contiguous().


People might rely on the fact that contiguous implies
suboffsets==NULL.


Sebastian, did this special case ever come up in the context of
NumPy?

--
nosy: +seberg

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



[issue23349] PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers

2015-01-30 Thread Stefan Krah

Changes by Stefan Krah ste...@bytereef.org:


--
nosy: +skrah

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



[issue23284] Improve termcap detection in setup.py

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

Ok thanks, I understand the issue now.  I'm focusing this issue
on the termcap detection.  For the other parts of the patch
you'd have to open separate issues.


As an aside, the ncurses maintainer seems to endorse a distro
enforced choice for libreadline's termcap:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602720

--
title: curses, readline, tinfo, and also --prefix, dbm, CPPFLAGS - Improve 
termcap detection in setup.py

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



[issue23351] socket.settimeout(5.0) does not have any effect

2015-01-30 Thread Charles-François Natali

Charles-François Natali added the comment:

 The way socket timeouts are implemented is by using select() to determine 
 whether the socket is ready for read/write. In this case, select() probably 
 marks the socket ready even though the queue is full, which later raises 
 EAGAIN.

Indeed, and this looks like a kernel bug.

Working as expected on a RHEL6:

$ python /tmp/test_unix_sock_timeout.py
('sending ', 0)
took 0.000s
('sending ', 1)
took 0.000s
('sending ', 2)
took 0.000s
('sending ', 3)
took 0.000s
('sending ', 4)
took 0.000s
('sending ', 5)
took 0.000s
('sending ', 6)
took 0.000s
('sending ', 7)
took 0.000s
('sending ', 8)
took 0.000s
('sending ', 9)
took 0.000s
('sending ', 10)
took 0.000s
('sending ', 11)
took 1.000s
Traceback (most recent call last):
  File /tmp/test_unix_sock_timeout.py, line 17, in module
s.sendto(hello, SOCKNAME)
socket.timeout: timed out

 About SO_SNDTIMEO and SO_RCVTIMEO, POSIX says it is implementation-defined 
 whether the SO_SNDTIMEO option can be set. Also, they would not necessarily 
 apply to other operations such as accept().

Exactly, the current way timeouts are implemented ar The Right Way, IMO.

--
Added file: http://bugs.python.org/file37919/test_unix_sock_timeout.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23351
___import itertools
import os
import socket
import time


SOCKNAME = /tmp/test.sock

if os.fork() == 0:
time.sleep(1)
s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
s.settimeout(1)
for i in itertools.count():
print(sending , i)
t0 = time.time()
try:
s.sendto(hello, SOCKNAME)
finally:
print(took {:.3f}s.format(time.time() - t0))
else:
os.remove(SOCKNAME)
s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
s.bind(SOCKNAME)
os.waitpid(-1, 0)___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Neil Girdhar added the comment:

Ready for a code review:

Blocked f(*x for x…) as requested.

Polished up parsermodule.c.

--
Added file: http://bugs.python.org/file37920/starunpack26.diff

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



[issue23285] PEP 475 - EINTR handling

2015-01-30 Thread Charles-François Natali

Charles-François Natali added the comment:

 With eintr-2.diff, fast!:

Victory \°/.

 Instrumented test_send, 3 socket.send calls, many socket.recv_into calls:

Yep, that's expected.
I think we should keep the default socket buffer size: it increases
the test coverage, and it's probably not worth trying to increase it
to make the test a bit faster, especially since it spends so much time
sleeping.

Antoine, I'm now happy with the patch, so we'll be waiting for your
decision on the PEP with Victor :-).

--
Added file: http://bugs.python.org/file37910/eintr-3.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23285
___diff -r fe0fddd6fd21 Lib/_pyio.py
--- a/Lib/_pyio.py  Sun Jan 18 11:17:39 2015 +0200
+++ b/Lib/_pyio.py  Thu Jan 29 22:20:01 2015 +
@@ -1006,10 +1006,7 @@
 current_size = 0
 while True:
 # Read until EOF or until read() would block.
-try:
-chunk = self.raw.read()
-except InterruptedError:
-continue
+chunk = self.raw.read()
 if chunk in empty_values:
 nodata_val = chunk
 break
@@ -1028,10 +1025,7 @@
 chunks = [buf[pos:]]
 wanted = max(self.buffer_size, n)
 while avail  n:
-try:
-chunk = self.raw.read(wanted)
-except InterruptedError:
-continue
+chunk = self.raw.read(wanted)
 if chunk in empty_values:
 nodata_val = chunk
 break
@@ -1060,12 +1054,7 @@
 have = len(self._read_buf) - self._read_pos
 if have  want or have = 0:
 to_read = self.buffer_size - have
-while True:
-try:
-current = self.raw.read(to_read)
-except InterruptedError:
-continue
-break
+current = self.raw.read(to_read)
 if current:
 self._read_buf = self._read_buf[self._read_pos:] + current
 self._read_pos = 0
@@ -1214,8 +1203,6 @@
 while self._write_buf:
 try:
 n = self.raw.write(self._write_buf)
-except InterruptedError:
-continue
 except BlockingIOError:
 raise RuntimeError(self.raw should implement RawIOBase: it 
should not raise BlockingIOError)
diff -r fe0fddd6fd21 Lib/distutils/spawn.py
--- a/Lib/distutils/spawn.pySun Jan 18 11:17:39 2015 +0200
+++ b/Lib/distutils/spawn.pyThu Jan 29 22:20:01 2015 +
@@ -137,9 +137,6 @@
 try:
 pid, status = os.waitpid(pid, 0)
 except OSError as exc:
-import errno
-if exc.errno == errno.EINTR:
-continue
 if not DEBUG:
 cmd = executable
 raise DistutilsExecError(
diff -r fe0fddd6fd21 Lib/multiprocessing/connection.py
--- a/Lib/multiprocessing/connection.py Sun Jan 18 11:17:39 2015 +0200
+++ b/Lib/multiprocessing/connection.py Thu Jan 29 22:20:01 2015 +
@@ -365,10 +365,7 @@
 def _send(self, buf, write=_write):
 remaining = len(buf)
 while True:
-try:
-n = write(self._handle, buf)
-except InterruptedError:
-continue
+n = write(self._handle, buf)
 remaining -= n
 if remaining == 0:
 break
@@ -379,10 +376,7 @@
 handle = self._handle
 remaining = size
 while remaining  0:
-try:
-chunk = read(handle, remaining)
-except InterruptedError:
-continue
+chunk = read(handle, remaining)
 n = len(chunk)
 if n == 0:
 if remaining == size:
@@ -595,13 +589,7 @@
 self._unlink = None
 
 def accept(self):
-while True:
-try:
-s, self._last_accepted = self._socket.accept()
-except InterruptedError:
-pass
-else:
-break
+s, self._last_accepted = self._socket.accept()
 s.setblocking(True)
 return Connection(s.detach())
 
diff -r fe0fddd6fd21 Lib/multiprocessing/forkserver.py
--- a/Lib/multiprocessing/forkserver.py Sun Jan 18 11:17:39 2015 +0200
+++ b/Lib/multiprocessing/forkserver.py Thu Jan 29 22:20:01 2015 +
@@ -188,8 +188,6 @@
 finally:
 os._exit(code)
 
-except InterruptedError:
-pass
 except OSError as e:
 if e.errno != errno.ECONNABORTED:
 raise
@@ -230,13 +228,7 @@
 data = b''
 length = 

[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-01-30 Thread Stefan Krah

Stefan Krah added the comment:

PEP-3118 says:

Py_buffer.suboffsets:

If all suboffsets are negative (i.e. no de-referencing is needed, then this 
must be NULL (the default value).


I would be inclined to go with the PEP here and make a doc fix instead.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Neil Girdhar added the comment:

Is it possible to edit the PEP to reflect the current design decisions?

Specifically:

* Remove: Because of the new levity for * and ** unpackings, it may be 
advisable to lift some or all of these restrictions. (in both abstract and 
specification)
* Extend: Currently duplicate arguments raise TypeError.  This remains true 
for duplicate arguments provided through multiple keyword argument unpackings, 
e.g. f(**{'x': 2}, **{'x': 3})
* Add some examples of dictionary overriding to the list of examples:

 {'x': 1, **{'x': 2}}
{'x': 2}

 {**{'x': 2}, 'x': 1}
{'x': 1}

* Remove if the restrictions are kept (they are)
* Remove If they are removed completely...
* In disadvantages, remove if the current are kept (they are).  Don't write 
* unpackings, write iterable unpackings
* Remove if the current restrictions are lifted
* Remove Implementation section (it's done!)
* Add to specification: f(*x for x in it) and f(**x for x in it) remain 
SyntaxErrors.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-30 Thread Neil Girdhar

Neil Girdhar added the comment:

Fixed a bug and added a test.

--
Added file: http://bugs.python.org/file37921/starunpack27.diff

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