[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Florent Xicluna

New submission from Florent Xicluna :

The -3 flag no longer works with Python 2.7.

~ $ ./python -3 -c 'print 1 <> 2, {}.has_key(3)'
True False


On python 2.6:

~ $ ./python -3 -c 'print 1 <> 2, {}.has_key(3)'
:1: DeprecationWarning: <> not supported in 3.x; use !=
-c:1: DeprecationWarning: dict.has_key() not supported in 3.x; use the in 
operator
True False

--
messages: 97754
nosy: flox
severity: normal
status: open
title: "-3" flag does not work anymore
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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Florent Xicluna

Changes by Florent Xicluna :


--
components: +Interpreter Core
type:  -> behavior

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Ezio Melotti

Ezio Melotti  added the comment:

Now that the DeprecationWarnings are silenced by default (see #7319) -3 should 
imply -Wd in order to work.

./python -3 -Wd -c 'print 1 <> 2, {}.has_key(3)'
:1: DeprecationWarning: <> not supported in 3.x; use !=
-c:1: DeprecationWarning: dict.has_key() not supported in 3.x; use the in 
operator
True False

--
nosy: +ezio.melotti
priority:  -> high
stage:  -> needs patch

___
Python tracker 

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



[issue1068268] subprocess is not EINTR-safe

2010-01-14 Thread David Oxley

David Oxley  added the comment:

Another instance of a blocking function within subprocess not being protected 
against EINTR 

Python 2.6.4, subprocess.py, Popen function, line 1115:
data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB

If a signal arrives while blocked in this read, the EINTR/OSError is passed up 
to whatever called subprocess.Popen. Retrying the Popen doesn't help because 
the child process may already have started but the caller has no way to know 
this nor does the caller have any control over the child process.

===

In the example code, the first subprocess.Popen starts without issue but while 
in the second Popen call, p1's SIGCHLD is received by the parent. 
p2 is never set, but the second copy of /bin/date starts running anyway.

The "preexec_fn = lambda : time.sleep(2)" in the second Popen is a little 
contrived but serves to guarantee that the SIGCHLD will break the Popen for the 
purposes of the demonstration. I have seen this failure mode when using vanilla 
Popen calls although you have to be lucky/unlucky to see it.



This is in python 2.6.4:
> md5sum subprocess.py
2ac8cefe8301eadce87630b230d6fff2  subprocess.py



I expect the fix is equivalent to cmiller's trunk-diff-unified.txt

--
nosy: +mathmodave
Added file: http://bugs.python.org/file15869/bugtest.py

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Ezio Melotti

Ezio Melotti  added the comment:

Here's a patch. I'm not sure the approach is correct but it seems to fix at 
least the problem with "./python -3 -c 'print 1 <> 2, {}.has_key(3)'".

--
keywords: +patch
nosy: +brett.cannon
stage: needs patch -> patch review
Added file: http://bugs.python.org/file15870/issue7700.diff

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

The undocumented "-b" flag behaves correctly.
I would suggest to implement it the same way.

~ $ ./python -b -c "bytearray('') == u''"
-c:1: BytesWarning: Comparsion between bytearray and string

(By the way, this feature is not documented in "--help", and there's a typo in 
the error message)

--

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread R. David Murray

Changes by R. David Murray :


--
priority: high -> release blocker

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread STINNER Victor

New submission from STINNER Victor :

binascii_b2a_uu() estimate the output string length using 2+bin_len*2.
It's almost correct... except for bin_len=1. The result is a memory
write into unallocated memory:

   $ ./python -c "import binascii; binascii.b2a_uu('x')"
   Debug memory block at address p=0x87da568: API 'o'
   33 bytes originally requested
   The 3 pad bytes at p-3 are FORBIDDENBYTE, as expected.
   The 4 pad bytes at tail=0x87da589 are not all FORBIDDENBYTE (0xfb):
   at tail+0: 0x0a *** OUCH
   at tail+1: 0xfb
   at tail+2: 0xfb
   at tail+3: 0xfb
   The block was made by call #25195 to debug malloc/realloc.
   Data at p: 00 00 00 00 00 00 00 00 ... 00 00 00 21 3e 20 20 20
   Fatal Python error: bad trailing pad byte
   Abandon

Current output string length estimation for input string 0..10:

>>> [len(binascii.b2a_uu("x"*bin_len)) for bin_len in xrange(10)]
[2, 6, 6, 6, 10, 10, 10, 14, 14, 14]
>>> [(2+bin_len*2) for bin_len in xrange(10)]
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]

The estimation is correct for all lengths... except for bin_len=1. And
it's oversized for bin_len >= 9. The exact length is:

2+ceil(bin_len*8/6) <=> 2+(bin_len+5)*8//6 <=> 2+(bin_len+2)*4//3

Example with length 0..10:

>>> [len(binascii.b2a_uu("x"*bin_len)) for bin_len in xrange(10)]
[2, 6, 6, 6, 10, 10, 10, 14, 14, 14]
>>> [(2+(bin_len+2)*4//3) for bin_len in xrange(10)]
[4, 6, 7, 8, 10, 11, 12, 14, 15, 16]

Attached patch uses the correct estimation.

--
components: Extension Modules
files: binascii_b2a_uu_length.patch
keywords: patch
messages: 97759
nosy: haypo
severity: normal
status: open
title: fix output string length for binascii.b2a_uu()
type: crash
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15871/binascii_b2a_uu_length.patch

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

>>> [len(binascii.b2a_uu("x"*bin_len)) for bin_len in xrange(10)]
[2, 6, 6, 6, 10, 10, 10, 14, 14, 14]
>>> [(2+(bin_len+2)*4//3) for bin_len in xrange(10)]
[4, 6, 7, 8, 10, 11, 12, 14, 15, 16]

How is this the correct estimation? The results are different.

Try the following:

>>> [(2+(bin_len+2)//3*4) for bin_len in xrange(10)]
[2, 6, 6, 6, 10, 10, 10, 14, 14, 14]

--
nosy: +pitrou

___
Python tracker 

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



[issue7702] Wrong order of parameters of _get_socket in SMTP class in smtplib.py

2010-01-14 Thread alito

New submission from alito :

Trivial change with (almost) no effect.

The method signature for _get_socket in the SMTP class in stmplib.py is 

def _get_socket(self, port, host, timeout)

It should be:

def _get_socket(self, host, port, timeout)

Evidence:
1) It calls socket.create_connection((port, host), ) but 
socket.create_connection expects (host, port).
2) The only time it is called in smtplib.py, it is called as 
self._get_socket(host, port, self.timeout)
3) In the derived class SMTP_SSL, it is defined as (self, host, port, timeout)


I wrote _almost_ no effect because the debugging output from it will now be in 
the right order (host, port).

Patch wrt python svn trunk follows:

Index: smtplib.py
===
--- smtplib.py  (revision 77465)
+++ smtplib.py  (working copy)
@@ -266,11 +266,11 @@
 """
 self.debuglevel = debuglevel
 
-def _get_socket(self, port, host, timeout):
+def _get_socket(self, host, port, timeout):
 # This makes it simpler for SMTP_SSL to use the SMTP connect code
 # and just alter the socket connection bit.
 if self.debuglevel > 0: print>>stderr, 'connect:', (host, port)
-return socket.create_connection((port, host), timeout)
+return socket.create_connection((host, port), timeout)
 
 def connect(self, host='localhost', port = 0):
 """Connect to a host on a given port.

--
components: Library (Lib)
messages: 97761
nosy: alito
severity: normal
status: open
title: Wrong order of parameters of _get_socket in SMTP class in smtplib.py
versions: Python 2.6, Python 2.7

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

A variant, which mimics BytesWarning implementation.

--
Added file: http://bugs.python.org/file15872/issue7700_variant.diff

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Bug 6 is indeed a bug: an example incorrectly-rounded string is:

'1043084852419839906667134017080721757731650342786856826461117622924093309287397517024046581978723191290365199474353194183878397589904785494758667307594584489598101202438799213561706453214148927881523984910810595161999782915363353531484674266169258928940692239684771590065027025835804863585454872499320500023126142553932654370362024104462255244034053203998964360882487378334860197725139151265590832887433736189468858614521708567646743455601905935595381852723723645799866672558576993978025033590728687206296379801363024094048327273913079612469982585674824156000783167963081616214710691759864332339239688734656548790656486646106983450809073750535624894296242072010195710276073042036425579852459556183541199012652571123898996574563824424330960027873516082763671875e-1075'

It's fixed in r77491.  I'll add tests once the remaining (known) dtoa.c bugs 
are fixed.

--

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

> How is this the correct estimation? The results are different.

The estimation have be bigger or equal, but not smaller.

> Try the following:
> >>> [(2+(bin_len+2)//3*4) for bin_len in xrange(10)]
> [2, 6, 6, 6, 10, 10, 10, 14, 14, 14]

Cool, it's not an estimation but the exact result :-) I prefer to leave the 
resize unchanged. The new patch uses your "estimation" ;-)

--
Added file: http://bugs.python.org/file15873/binascii_b2a_uu_length-2.patch

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Florent Xicluna

New submission from Florent Xicluna :

In order to upgrate the tests for ctypes, following changes are required:
 - binascii.hexlify should accept memoryview() objects
 - the ctypes character buffer should accept assignment of memoryview() objects 
using their "raw" property

Then we can backport the Py3 ctypes tests to Py2.

--
messages: 97765
nosy: flox
severity: normal
stage: needs patch
status: open
title: Replace buffer()-->memoryview() in Lib/ctypes/test/
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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Florent Xicluna

Changes by Florent Xicluna :


--
keywords: +patch
Added file: http://bugs.python.org/file15874/issue7703_binascii_memoryview.diff

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Florent Xicluna

Changes by Florent Xicluna :


Added file: http://bugs.python.org/file15875/issue7703_ctypes_memoryview.diff

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

Patches attached:
 - partial backport of Modules/binascii.c
 - partial backport of Modules/_ctypes/_ctypes.c (preserving 2.3 compat.)
 - update ctypes tests (buffer -> memoryview)

--
assignee:  -> theller
components: +ctypes
nosy: +theller
stage: needs patch -> patch review
Added file: http://bugs.python.org/file15876/issue7703_test_ctypes.diff

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Bug 4 fixed in r77492.  This just leaves bugs 5 and 7;  I have a fix for these 
in the works.

--

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Does binascii still work with array.array objects? Also, there should be 
additional tests for compatibility of binascii with memoryview objects.

--
nosy: +pitrou

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +pitrou
stage:  -> patch review
versions: +Python 3.2 -Python 3.0

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

Additional tests for binascii.

--
Added file: http://bugs.python.org/file15877/issue7703_test_binascii.diff

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Tests committed in r77493.

--

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixes and tests so far merged to py3k in r77494, release31-maint in r77496.

--

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Please be careful with the coding style. Stuff like:

+ if (_PyString_Resize(&rv, 2*out_len) < 0) \
+   { Py_DECREF(rv); PyBuffer_Release(&pin); return 
NULL; } \

should be spread out on several lines.
Otherwise, the binascii patch looks good.

--

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've now committed the binascii patch + tests to trunk, and merged the tests 
into py3k.

Note: binascii_a2b_hqx() still uses the "t#" argument specifier in py3k as well 
as in trunk, this would deserve a separate patch.

--

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: http://bugs.python.org/file15877/issue7703_test_binascii.diff

___
Python tracker 

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



[issue7703] Replace buffer()-->memoryview() in Lib/ctypes/test/

2010-01-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: 
http://bugs.python.org/file15874/issue7703_binascii_memoryview.diff

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Victor, your overflow test in the sre patch tests for TypeError, but 
OverflowError is actually raised:

==
ERROR: test_dealloc (test.test_re.ReTests)
--
Traceback (most recent call last):
  File "/home/antoine/cpython/debug/Lib/test/test_re.py", line 711, in 
test_dealloc
self.assertRaises(TypeError, _sre.compile, "abc", 0, [long_overflow])
  File "/home/antoine/cpython/debug/Lib/unittest/case.py", line 394, in 
assertRaises
callableObj(*args, **kwargs)
OverflowError: regular expression code size limit exceeded

--

--

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch doesn't apply cleanly against trunk (due to today's commits I fear, 
sorry).
Also, it would be nice to add a test.

--

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

> Victor, your overflow test in the sre patch tests for TypeError, 
> but OverflowError is actually raised: (...)

Oops, fixed.

--
Added file: http://bugs.python.org/file15878/sre_py_decref-2.patch

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file10891/_sre-2.patch

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file15862/sre_py_decref.patch

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

> The patch doesn't apply cleanly against trunk

Because of r77497 (issue #770). No problem, here is the new patch. I'm now 
using a git-svn repository to keep all my patches. It's much easier to update 
them to trunk ;-)

> Also, it would be nice to add a test.

done

--
Added file: http://bugs.python.org/file15879/binascii_b2a_uu_length-3.patch

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file15871/binascii_b2a_uu_length.patch

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file15873/binascii_b2a_uu_length-2.patch

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file15880/_curses_panel_py_decref.patch

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

Update _curses_panel patch. The crash occurs if malloc() fail in insert_lop(). 
I don't know how to write reliable test for this case. Maybe using 
http://www.nongnu.org/failmalloc/ library (a little bit overkill, isn't it?).

--

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The sre patch has been committed, thank you!

--

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: http://bugs.python.org/file15878/sre_py_decref-2.patch

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I don't know how to write reliable test for this case. Maybe using
> http://www.nongnu.org/failmalloc/ library (a little bit overkill, isn't > 
> it?).

Yes, it would IMO be overkill.

--

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file10892/_curses_panel.patch

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

Update pyexpat patch. As _curses_panel, the bug is raised on malloc() failure. 
The patch adds also a dummy test on ExternalEntityParserCreate().

--
Added file: http://bugs.python.org/file15881/pyexpat_py_decref.patch

___
Python tracker 

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



[issue2375] PYTHON3PATH environment variable to supersede PYTHONPATH for multi-Python environments

2010-01-14 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Guido pronounced on this on python-dev, so closing the request again.

--
status: open -> closed

___
Python tracker 

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-14 Thread Nir Aides

Nir Aides  added the comment:

I uploaded an update for Python 2.7.

> * you should probably write `n = sys.maxsize` instead of `n = 1 << 31 - 1`

sys.maxsize is 64 bit number on my system but the maximum value accepted by 
zlib's decompress() seems to be INT_MAX defined in pyport.h which equals the 
number I used.

> * ZipExtFile.read() should support `n=None` as a synonym to `n=-1` 
> (read everything)

Added

> * `bytes` as a variable name isn't very good since it's the built-in 
> name for bytestrings in py3k

Changed (old habits die hard).

> * in ZipExtFile.read(), it seems you have removed the adjustment for 
> encrypted files (see `adjust read size for encrypted files since the 
> first 12 bytes [etc.]`)

Yes, was moved to the constructor.

> * is there a situation where the decompressor might return less bytes 
> than expected? (after all compression doesn't /always/ compress, in 
> unfavourable chunks of data it might actually expand things a bit)

The documentation of io.BufferedIOBase.read() reads "multiple raw reads may be 
issued to satisfy the byte count". I understood this language to mean 
satisfying read size is optional. Isn't it?

--
Added file: http://bugs.python.org/file15882/zipfile_7610_py27_v4.diff

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Brett Cannon

Brett Cannon  added the comment:

Fixed in r77505. I tweaked both patches slightly to minimize the special 
casing. Thanks for the help, guys!

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



[issue7704] Math calculation problem (1.6-1.0)>0.6, python said TRUE

2010-01-14 Thread pedro flores

New submission from pedro flores :

this simple comparison (1.6-1.0)>0.6 , python answer TRUE, and that isnt true.

--
components: Windows
files: bug.py
messages: 97785
nosy: DhaReaL
severity: normal
status: open
title: Math calculation problem (1.6-1.0)>0.6, python said TRUE
type: behavior
versions: Python 3.1
Added file: http://bugs.python.org/file15883/bug.py

___
Python tracker 

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



[issue7704] Math calculation problem (1.6-1.0)>0.6, python said TRUE

2010-01-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

This is not a bug:  Python, like many other computer languages, stores floats 
in binary.  The values 1.6 and 0.6 aren't exactly representable in the internal 
format used, so the stored versions of 1.6 and 0.6 are actually just very close 
approximations to those values.  It just so happens that the approximation for 
1.6 is a tiny amount larger than 1.6 (the exact value stored is 
1.600088817841970012523233890533447265625), while the approximation 
for 0.6 is a tiny amount smaller than 0.6 (the exact value is 
0.59997779553950749686919152736663818359375).

I recommend looking at the appendix to the Python tutorial for more information 
about floating point:

http://docs.python.org/tutorial/floatingpoint.html

--
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue1947] Exception exceptions.AttributeError '_shutdown' in

2010-01-14 Thread Christopher Nelson

Christopher Nelson  added the comment:

I also experience this problem.  However, I experience it with a version of 
Python 2.4 that has had 
http://bugs.python.org/file10154/nondaemon_thread_shutdown.diff applied.  

We have a custom 2.4 build that builds using MS VS 2K5.  We support an 
application on x86, x64, and ia64, which is why we custom compile.

I get this error everytime when running regretest.py in Lib/test.

--
nosy: +nadiasvertex

___
Python tracker 

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



[issue2504] Add gettext.pgettext() and variants support

2010-01-14 Thread David D Lowe

David D Lowe  added the comment:

Same here.

--
nosy: +Flimm

___
Python tracker 

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



[issue7704] Math calculation problem (1.6-1.0)>0.6, python said TRUE

2010-01-14 Thread pedro flores

pedro flores  added the comment:

kk, then i cannot use this comparison?, and this not happen
with8.6-8>0.6 this is false, according to python.

2010/1/14 Mark Dickinson 

>
> Mark Dickinson  added the comment:
>
> This is not a bug:  Python, like many other computer languages, stores
> floats in binary.  The values 1.6 and 0.6 aren't exactly representable in
> the internal format used, so the stored versions of 1.6 and 0.6 are actually
> just very close approximations to those values.  It just so happens that the
> approximation for 1.6 is a tiny amount larger than 1.6 (the exact value
> stored is 1.600088817841970012523233890533447265625), while the
> approximation for 0.6 is a tiny amount smaller than 0.6 (the exact value is
> 0.59997779553950749686919152736663818359375).
>
> I recommend looking at the appendix to the Python tutorial for more
> information about floating point:
>
> http://docs.python.org/tutorial/floatingpoint.html
>
> --
> nosy: +mark.dickinson
> resolution:  -> invalid
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file15884/unnamed

___
Python tracker 

___kk, then i cannot use this comparison?, and this not happen 
with8.6-8>0.6 this is false, according to python.2010/1/14 Mark Dickinson rep...@bugs.python.org>

Mark Dickinson dicki...@gmail.com> added the 
comment:

This is not a bug:  Python, like many other computer languages, stores floats 
in binary.  The values 1.6 and 0.6 aren't exactly representable in the 
internal format used, so the stored versions of 1.6 and 0.6 are actually just 
very close approximations to those values.  It just so happens that the 
approximation for 1.6 is a tiny amount larger than 1.6 (the exact value stored 
is 1.600088817841970012523233890533447265625), while the 
approximation for 0.6 is a tiny amount smaller than 0.6 (the exact value is 
0.59997779553950749686919152736663818359375).


I recommend looking at the appendix to the Python tutorial for more information 
about floating point:

http://docs.python.org/tutorial/floatingpoint.html"; 
target="_blank">http://docs.python.org/tutorial/floatingpoint.html

--
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

___
Python tracker rep...@bugs.python.org>
http://bugs.python.org/issue7704>
___
-- Pedro Flores 
C.Estudiante Memorista de Informática 2009-2010Universidad de 
Concepción, ConcepciónChile
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1559298] test_popen fails on Windows if installed to "Program Files"

2010-01-14 Thread Brian Curtin

Brian Curtin  added the comment:

This has come up recently and Martin's approach seems to work. I updated his 
patch for trunk, and test_popen passes when I run it with and without a space 
in the path. 

Russ Gibson's suggestion was already applied to test_popen, so the only code 
change is to posixmodule.c.

--
components: +Library (Lib) -Tests
keywords: +needs review
nosy: +brian.curtin
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 3.0
Added file: http://bugs.python.org/file15885/issue1559298_trunk.diff

___
Python tracker 

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



[issue1559298] test_popen fails on Windows if installed to "Program Files"

2010-01-14 Thread Brian Curtin

Brian Curtin  added the comment:

Here is a py3k version of the previous patch. os.popen is implemented using 
subprocess.Popen, so the quoting change was made there.

--
Added file: http://bugs.python.org/file15886/issue1559298_py3k.diff

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

Patch for cElementTree:
 * Replace PyObject_Del() by Py_DECREF()
 * Catch element_new_extra() errors
 * parser dealloc: replace Py_DECREF() by Py_XDECREF() because the pointer may 
be NULL (error in the constructor)
 * set all parser attributes to NULL at the beginning of the constructor to be 
able to call safetly the destructor
 * element_new(): define tag, text, tail attributes before calling 
element_new_extra() to be able to call the destructor
 * raise a MemoryError on element_new_extra() failure. element_new() didn't 
raise any error on element_new_extra() failure. Other functions just forget to 
catch element_new_extra() error.

--
Added file: http://bugs.python.org/file15887/celementtree_py_decref.patch

___
Python tracker 

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



[issue7704] Math calculation problem (1.6-1.0)>0.6, python said TRUE

2010-01-14 Thread Tim Peters

Tim Peters  added the comment:

You can use the comparison, provided you understand what it does, and that it 
does NOT do what you hoped it would do.  Here:

>>> 1.6 - 1.0
0.60009

That shows quite clearly that subtracting 1 from the binary approximation to 
1.6 does not leave exactly 0.6.  If you need that to happen, use the decimal 
module (which, in return for being slower, emulates decimal floating-point 
arithmetic).

Your other case (8.6-8.0) does NOT equal (decimal) 0.6 exactly either, but 
fools you into thinking it's working the way you hope it works because the 
result is a little /less/ than 0.6:

>>> 8.6 - 8.0
0.59964

Do read the tutorial appendix Mark invited you to read.  If you don't, you're 
going to remain hopelessly confused ;-)

--
nosy: +tim_one

___
Python tracker 

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



[issue1754] WindowsError messages are not properly encoded

2010-01-14 Thread Naoki INADA

Naoki INADA  added the comment:

I think WindowsError's message should be English like other errors.
FormatMessageW() function can take dwLanguageId parameter.
So I think Python should pass `MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)` to 
the parameter.

--
nosy: +naoki

___
Python tracker 

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



[issue3299] Direct calls to PyObject_Del/PyObject_DEL are broken for --with-pydebug

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file10893/pyobject_del.patch

___
Python tracker 

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



[issue7544] Fatal error on thread creation in low memory condition

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file15888/thread_prealloc_pystate-3.patch

___
Python tracker 

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



[issue7544] Fatal error on thread creation in low memory condition

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file15805/thread_prealloc_pystate.patch

___
Python tracker 

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



[issue7544] Fatal error on thread creation in low memory condition

2010-01-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file15848/thread_prealloc_pystate-2.patch

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The committed patch has a C++-style comment. You probably want to fix that.

--
nosy: +pitrou

___
Python tracker 

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



[issue7701] fix output string length for binascii.b2a_uu()

2010-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Patch committed in r77506, r77507, r77508 and r77509. Thank you!

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

___
Python tracker 

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



[issue7301] Add environment variable $PYTHONWARNINGS

2010-01-14 Thread Brian Curtin

Changes by Brian Curtin :


Removed file: http://bugs.python.org/file15324/issue7301_v2.patch

___
Python tracker 

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



[issue7301] Add environment variable $PYTHONWARNINGS

2010-01-14 Thread Brian Curtin

Changes by Brian Curtin :


Removed file: http://bugs.python.org/file15322/issue7301.patch

___
Python tracker 

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



[issue7301] Add environment variable $PYTHONWARNINGS

2010-01-14 Thread Brian Curtin

Brian Curtin  added the comment:

fixed a tab/space issue

--
Added file: http://bugs.python.org/file15889/issue7301.diff

___
Python tracker 

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



[issue7700] "-3" flag does not work anymore

2010-01-14 Thread Brett Cannon

Brett Cannon  added the comment:

Fixed in r77510. Look forward to when we use C99 over C89.

On Thu, Jan 14, 2010 at 16:29, Antoine Pitrou  wrote:
>
> Antoine Pitrou  added the comment:
>
> The committed patch has a C++-style comment. You probably want to fix that.
>
> --
> nosy: +pitrou
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-14 Thread Brian Curtin

Brian Curtin  added the comment:

assertStr and assertUnicode don't exist in test_ntpath so the tests fail on 
Windows. I copied/pasted the functions over from test_posixpath just to see and 
test_ntpath passes. Other than that, it looks good to me.

--

___
Python tracker 

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



[issue7705] libpython2.6.so is not linked correctly on FreeBSD when threads are enabled

2010-01-14 Thread Alexis Ballier

New submission from Alexis Ballier :

As reported in https://bugs.gentoo.org/show_bug.cgi?id=300961 :

# gcc foo.c -lpython2.6
/usr/lib/gcc/i686-gentoo-freebsd7.2/4.4.2/../../../libpython2.6.so: undefined
reference to `pthread_create'
collect2: ld returned 1 exit status



libpython2.6.so doesn't get linked with -pthread; I'll attach a patch fixing 
this, the configure script does its magic but doesn't reuse that magic for 
setting LDSHARED.

--
components: Build
files: python_fbsd_pthread.patch
keywords: patch
messages: 97800
nosy: aballier
severity: normal
status: open
title: libpython2.6.so is not linked correctly on FreeBSD when threads are 
enabled
versions: Python 2.6
Added file: http://bugs.python.org/file15890/python_fbsd_pthread.patch

___
Python tracker 

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



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-14 Thread Ezio Melotti

Ezio Melotti  added the comment:

I'll fix the patch. I added Ronald and Andrew to see if they have any opinion 
about macpath and os2emxpath. The main idea is that abspath should always 
return unicode if its arg is unicode or str otherwise.

--
nosy: +aimacintyre, ronaldoussoren

___
Python tracker 

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