[issue11984] Wrong See also in symbol and token module docs

2011-05-03 Thread Davi Post

New submission from Davi Post p...@pobox.com:

The See also reference in the documentation for the token and symbol modules 
is no longer accurate. The second example mentioned was apparently removed in 
Python 2.7.

This leaves no explanation for how to use the symbol module.

I don't think this See also belongs in the token module at all. (It's in 
Python 2.5 and 2.6 as well.)

http://docs.python.org/release/2.7.1/library/symbol.html

See also:
Module parser
The second example for the parser module shows how to use the symbol module.

--
assignee: docs@python
components: Documentation
messages: 135017
nosy: davipo, docs@python
priority: normal
severity: normal
status: open
title: Wrong See also in symbol and token module docs
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue9516] sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now 10.3 but 10.5 during configure

2011-05-03 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

This issue is very annoying when you use python's with different deployment 
targets and should IMHO be fixed in the next release.

--
nosy: +benjamin.peterson, georg.brandl
priority: normal - release blocker

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



[issue11866] race condition in threading._newname()

2011-05-03 Thread Peter Saveliev

Peter Saveliev svinota.savel...@gmail.com added the comment:

Ok, patch attached.

Patch made for Python: 2.6
Tested Python versions: 2.6, 2.7

--
keywords: +patch
versions: +Python 2.6
Added file: http://bugs.python.org/file21866/newname_race_fix.patch

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



[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2011-05-03 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

The original code was trying to call PyArg_ParseTuple assuming 2 args and in 
case of failure (*any* failure) was starting over assuming 3 args.
The attached patch makes PyArg_ParseTuple accept 2 or 3 args and re-arranges 
the last two if 'flags' is passed.
The tests pass, but a few more tests should be added.

--
assignee:  - ezio.melotti
keywords: +patch
nosy: +ezio.melotti
stage:  - patch review
Added file: http://bugs.python.org/file21867/issue10169.diff

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Actually, it came to me that if a child process exists, the queues are not 
guaranteed to be a consistent state anymore (the child could have terminated in 
the middle of a partial read or write). So it may be better to simply declare 
the ProcessPoolExecutor terminally broken when one of its children have exited.

--

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



[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2011-05-03 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Added tests and fixed all the problems they found.

--
keywords: +needs review
stage: patch review - commit review
Added file: http://bugs.python.org/file21868/issue10169-2.diff

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



[issue11849] glibc allocator doesn't release all free()ed memory

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Patch looks fine to me, thank you.

--
stage:  - patch review
versions:  -Python 2.7, Python 3.1, Python 3.2

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



[issue10044] small int optimization

2011-05-03 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

Now me.

(http://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation)
 When casting from pointer to integer and back again, the resulting
 pointer must reference the same object as the original pointer,
 otherwise the behavior is undefined. That is, one may not use
 integer arithmetic to avoid the undefined behavior of pointer
 arithmetic as proscribed in C99 6.5.6/8.

Say - isn't that a joke about farts of armchair crouchers.
All it says is that if you dereference garbage you get a crash.
If you're concerned, use volatile, and go shoot the compiler
programmer if she dares to optimize just anything.
And on ARM, isn't the interrupt table at ((void*)(char[])0x0)??
La vie est une rose beside that.
And all i need is atomic_compare_and_swap().

--
nosy: +sdaoden

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Brian Quinlan

Brian Quinlan br...@sweetapp.com added the comment:

Under what circumstances do we expect a ProcessPoolExecutor child process to be 
killed outside of the control of the ProcessPoolExecutor?

If the user kills a child then maybe all we want to do is raise an exception 
rather than deadlock as a convenience.

--

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Under what circumstances do we expect a ProcessPoolExecutor child
 process to be killed outside of the control of the
 ProcessPoolExecutor?

Killed by the user, or by an automatic device (such as the Linux OOM
killer), or crashed.

 If the user kills a child then maybe all we want to do is raise an
 exception rather than deadlock as a convenience.

That's what the patch does, roughly.

--

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Brian Quinlan

Brian Quinlan br...@sweetapp.com added the comment:

 Killed by the user, or by an automatic device (such as the Linux OOM
 killer), or crashed.

Crashed would be bad - it would indicate a bug in the  
ProcessPoolExecutor code.


 If the user kills a child then maybe all we want to do is raise an
 exception rather than deadlock as a convenience.

 That's what the patch does, roughly.

Right. But instead of trying to recover, it might be better to fail  
very loudly i.e.
- fail every non-finished future
- kill every child process in the ProcessPoolExecutor
- set the ProcessPoolExecutor as shutdown so no new work can be  
scheduled
- raise in wait(), as_completed(), etc.

It really dependents on whether we view the situation as expected (and  
try our best to let the user recover) or as an aberrant situation that  
the user can't reasonably recover from.

Cheers,
Brian

--

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

  Killed by the user, or by an automatic device (such as the Linux OOM
  killer), or crashed.
 
 Crashed would be bad - it would indicate a bug in the  
 ProcessPoolExecutor code.

I meant a crash in Python itself, or any third-party extension module.

  If the user kills a child then maybe all we want to do is raise an
  exception rather than deadlock as a convenience.
 
  That's what the patch does, roughly.
 
 Right. But instead of trying to recover, it might be better to fail  
 very loudly i.e.
 - fail every non-finished future
 - kill every child process in the ProcessPoolExecutor
 - set the ProcessPoolExecutor as shutdown so no new work can be  
 scheduled

Yes, I think that's better (see my message about the internal state of
queues).

--

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset d003ce770ba1 by Victor Stinner in branch 'default':
Issue #8407: Fix pthread_sigmask() tests on Mac OS X
http://hg.python.org/cpython/rev/d003ce770ba1

--

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

 Should we fix Python 2.7?
  - backport issue #8651
  - use PY_SSIZE_T_CLEAN in zlibmodule.c

I really thought about this over night.
I'm a C programmer and thus:
- Produce no bugs
- If you've produced a bug, fix it at once
- If you've fixed a bug, scream out loud BUGFIX! -
  or at least incorporate the patch in the very next patch release

But i have no experience with maintaining a scripting language.
My survey of something like this spans about three months now.
And if even such a heavy known bug as #1202 survives at least two
minor releases (2.6 and 2.7) without being fixed, then maybe no
more effort should be put into 2.7 at all.

 11277-27.1.diff contains # Issue #10276 - check that inputs
 =4GB are handled correctly.. I don't understand this comment
 because the test uses a buffer of 2 GB + 2 bytes.
 How is it possible to pass a buffer of 2 GB+2 bytes to crc32(),
 whereas it stores the size into an int. The maximum size is
 INT_MAX which is 2 GB-1 byte. It looks like the i format of
 PyArg_ParseTuple() doesn't check for integer overflow = issue
 #8651. This issue was fixed in 3.1, 3.2 and 3.3, but not in
 Python 2

11277-27.2.diff uses INT_MAX and thus avoids any such pitfall.
Maybe it brings up memory mapping errors somewhere which i surely
would try fix everywhere i can.

--
Added file: http://bugs.python.org/file21869/11277-27.2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11277
___diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -1,10 +1,16 @@
 import unittest
-from test import test_support
+from test.test_support import TESTFN, run_unittest, import_module, unlink, 
requires
 import binascii
 import random
 from test.test_support import precisionbigmemtest, _1G
+import sys
 
-zlib = test_support.import_module('zlib')
+try:
+import mmap
+except ImportError:
+mmap = None
+
+zlib = import_module('zlib')
 
 
 class ChecksumTestCase(unittest.TestCase):
@@ -66,6 +72,34 @@
  zlib.crc32('spam',  (2**31)))
 
 
+# Backport to 2.7 due to Issue #11277: why not also verify INT32_MAX on 2.7?
+# Be aware of issues #1202, #8650, #8651 and #10276
+class ChecksumBigBufferTestCase(unittest.TestCase):
+int_max = 0x7FFF
+
+@unittest.skipUnless(mmap, mmap() is not available.)
+def test_big_buffer(self):
+if sys.platform[:3] == 'win' or sys.platform == 'darwin':
+requires('largefile',
+ 'test requires %s bytes and a long time to run' %
+ str(self.int_max))
+try:
+with open(TESTFN, wb+) as f:
+f.seek(self.int_max-4)
+f.write(asdf)
+f.flush()
+try:
+m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
+self.assertEqual(zlib.crc32(m), 0x709418e7)
+self.assertEqual(zlib.adler32(m), -2072837729)
+finally:
+m.close()
+except (IOError, OverflowError):
+raise unittest.SkipTest(filesystem doesn't have largefile 
support)
+finally:
+unlink(TESTFN)
+
+
 class ExceptionTestCase(unittest.TestCase):
 # make sure we generate some expected errors
 def test_badlevel(self):
@@ -546,8 +580,9 @@
 
 
 def test_main():
-test_support.run_unittest(
+run_unittest(
 ChecksumTestCase,
+ChecksumBigBufferTestCase,
 ExceptionTestCase,
 CompressTestCase,
 CompressObjectTestCase
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso sdao...@googlemail.com:


Removed file: http://bugs.python.org/file21855/11277-27.1.diff

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 618c3e971e80 by Victor Stinner in branch '2.7':
(Merge 3.1) Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X
http://hg.python.org/cpython/rev/618c3e971e80

--

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset c9207c6ce24a by Victor Stinner in branch 'default':
Issue #8407: pthread_sigmask() checks immediatly if signal handlers have been
http://hg.python.org/cpython/rev/c9207c6ce24a

--

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



[issue8651] s# and friends can silently truncate buffer length

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 509f1c15a1e1 by Victor Stinner in branch '2.7':
Issue #8651: Fix z# format of PyArg_Parse*() function: the size was not
http://hg.python.org/cpython/rev/509f1c15a1e1

--

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



[issue8651] s# and friends can silently truncate buffer length

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset a0681e7a6ded by Victor Stinner in branch '2.7':
Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
http://hg.python.org/cpython/rev/a0681e7a6ded

--

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



[issue8651] s# and friends can silently truncate buffer length

2011-05-03 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 Reopen the issue if you would like a port to 2.7
 (I am too lazy to do it)

I backported the fix to help issue #11277. While backporting the fix, I found 
another bug fixed by 509f1c15a1e1.

--

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



[issue10276] zlib crc32/adler32 buffer length truncation (64-bit)

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset f43213129ba8 by Victor Stinner in branch '2.7':
Issue #10276: test_zlib checks that inputs of 2 GB are handled correctly by
http://hg.python.org/cpython/rev/f43213129ba8

--
nosy: +python-dev
status: pending - open

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I commited mmap fix for Mac OS X, crc test on 2 GB file, and issue #8651 fix 
into Python 2.7.

Use PY_SSIZE_T_CLEAN in zlibmodule.c is a new feature. I don't want to 
implement it, I don't need it, and I don't feel confortable in zlibmodule.c. 
Open a new issue if you want it.

I think that we are done with issue. If you see buildbots failures, reopen it.

Thanks again Steffen for your diagnosis and fixes.

--
resolution:  - fixed
status: open - closed

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-03 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Since the commit c9207c6ce24a, test_signal fails on OpenIndiana:

http://www.python.org/dev/buildbot/all/builders/x86%20OpenIndiana%203.x/builds/1179
==
ERROR: test_block_unlock (test.test_signal.PthreadSigmaskTests)
--
Traceback (most recent call last):
  File 
/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_signal.py,
 line 539, in test_block_unlock
self.assertEqual(set(old_mask) ^ set(blocked), {signum})
  File 
/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_signal.py,
 line 501, in handler
1/0
ZeroDivisionError: division by zero

--

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



[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2011-05-03 Thread Johan Euphrosine

Changes by Johan Euphrosine pro...@google.com:


--
keywords: +patch
title: duplicated self.fp.tell() in zipfile.ZipFile.writestr - dupe 
self.fp.tell() in zipfile.ZipFile.writestr
Added file: http://bugs.python.org/file21870/zipfile-fix-dupe-fp-tell.patch

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



[issue11980] zipfile.ZipFile.write should accept fp as argument

2011-05-03 Thread Johan Euphrosine

Johan Euphrosine pro...@google.com added the comment:

Here is a tentative implementation.

Feel free to review it.

--
keywords: +patch
Added file: http://bugs.python.org/file21871/zipfile-add-writefp.patch

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



[issue11949] Make float('nan') unorderable

2011-05-03 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

 There are lots of almost-equality tests in the test-suite already,
 between test_math, test_float, test_cmath and test_complex.
  Do you need to implement another one here, or can you reuse one
 of the existing ones?

I can probably use acc_check() instead of abs(value-expected) = eps, but I am 
not sure that will be an improvement.  Most of the new logic deals with NaNs 
and negative zero and the almost-equality tests that I've seen don't implement 
these cases correctly for my use.

--

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 96a532eaa2d1 by Victor Stinner in branch 'default':
Issue #8407: disable faulthandler timeout thread on all platforms
http://hg.python.org/cpython/rev/96a532eaa2d1

--

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



[issue10276] zlib crc32/adler32 buffer length truncation (64-bit)

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset dd58f8072216 by Victor Stinner in branch '2.7':
Issue #10276: Fix test_zlib, m may be undefined in the finally block
http://hg.python.org/cpython/rev/dd58f8072216

--

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



[issue7546] msvc9compiler.py: add .asm extension

2011-05-03 Thread Zooko O'Whielacronx

Zooko O'Whielacronx zo...@zooko.com added the comment:

I got a bug report from a user that they encountered this error:

http://tahoe-lafs.org/pipermail/tahoe-dev/2011-April/006312.html

Then a follow-up in which they say they applied the patch from 
http://bugs.python.org/issue8597 (this ticket is the superceder of that one) 
and got a different error:

http://tahoe-lafs.org/pipermail/tahoe-dev/2011-April/006316.html

--

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



[issue10496] import site failed when Python can't find home directory (sysconfig._getuserbase)

2011-05-03 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

This is the one thing about which I wanted a call: “after the patch, paths 
returned by sysconfig may not be fully expanded paths” (i.e. they may start 
with '~').

--

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



[issue11949] Make float('nan') unorderable

2011-05-03 Thread Mark Dickinson

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

I was thinking of something like the rAssertAlmostEqual method in test_cmath.

--

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



[issue9516] sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now 10.3 but 10.5 during configure

2011-05-03 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Looks acceptable to me.  A few details in the code could be improved:

+@unittest.skipUnless(sys.platform == 'darwin', 'MacOSX test')
Skip messages generally use another form, like “test relevant only on Mac OS X”.

+finally:
+os.environ = orig_environ
I’ve grown fond of using self.addCleanup(setattr, os, 'environ', 
os.environ.copy()) instead of try/finally.  The cleanup action can be written 
right before the monkey-patching line, there’s no need to indent (especially 
nice when you patch many things, like later in the patch with sys.stdout), and 
it’s less lines.

+def _try_compile_deployment_target(self):
+import textwrap
I’d prefer avoiding function-level imports.

+fp.close()
I suggest a with statement.

+tgt = '%02d%01d0'%(tgt)
I think that using real words (“target”) and following PEP 8 (“ % target”) 
would make this slightly more readable.

+except CompileError:
+self.fail(Wrong deployment target during compilation)
Why not just let the CompileError propagate and cause a unittest failure?

+self.assertEquals(get_platform(), 'macosx-10.4-fat')
assertEquals raises a DeprecationWarning; assertEqual should be used. 
 
+
+
+
+# Test without MACOSX_DEPLOYMENT_TARGET in the environment
+
Three blank lines, a comment line and another blank line is a lot of whitespace.

+stderr=open('/dev/null'),
Won’t this cause a ResourceWarning?

--
versions: +Python 3.1

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



[issue10496] import site failed when Python can't find home directory (sysconfig._getuserbase)

2011-05-03 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

Paths that are starting with ~ should be extended with the right value with the 
user base. If the user base cannot be calculated, paths starting with ~ should 
not exist or be used at all in this context.

Maybe we need to completely reset them to None like userbase. We need to list 
all use cases within the stdlib and come up with a general rule.

--

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-03 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Running test_compileall with -F it failed on iteration 588 on my linux box.  So 
this isn't platform specific.  No idea why that particular test should be 
fragile, but I'll look in to it when I get some time if nobody beats me to it.

--
stage:  - needs patch
title: test_regexp() of test_compileall failure on x86 OpenIndiana 3.x - 
test_regexp() of test_compileall fails occassionally
versions: +Python 3.2

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



[issue11849] glibc allocator doesn't release all free()ed memory

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset f8a697bc3ca8 by Antoine Pitrou in branch 'default':
Issue #11849: Make it more likely for the system allocator to release
http://hg.python.org/cpython/rev/f8a697bc3ca8

--
nosy: +python-dev

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



[issue11849] glibc allocator doesn't release all free()ed memory

2011-05-03 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


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

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



[issue4851] xml.dom.minidom.Element.cloneNode fails with AttributeError

2011-05-03 Thread Alexandre Zani

Changes by Alexandre Zani alexandre.z...@gmail.com:


--
nosy: +Alexandre.Zani

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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-03 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

The docstring and reST doc of platform.python_implementation mention possible 
return values of CPython, IronPython and Jython, but if I understand the code 
correctly, PyPy is supported too.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 135050
nosy: docs@python, eric.araujo, lemburg
priority: normal
severity: normal
status: open
title: Document that platform.python_implementation supports PyPy
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-03 Thread Alex Gaynor

Alex Gaynor alex.gay...@gmail.com added the comment:

It returns PyPy on pypy.

--
nosy: +alex

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



[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Victor pointed out that Py_Finalize() is not necessarily called in the main 
Python thread. This new patch records the thread state of the finalizing 
thread, and also includes a test case.

--
Added file: http://bugs.python.org/file21872/finalizing2.patch

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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset f6c85df15874 by Ezio Melotti in branch '2.7':
#11985: document the return value of platform.python_implementation for PyPy.
http://hg.python.org/cpython/rev/f6c85df15874

New changeset 4d946d4166fc by Ezio Melotti in branch '3.1':
#11985: document the return value of platform.python_implementation for PyPy.
http://hg.python.org/cpython/rev/4d946d4166fc

New changeset 5e661f5c301a by Ezio Melotti in branch '3.2':
#11985: merge with 3.1.
http://hg.python.org/cpython/rev/5e661f5c301a

New changeset 847a38d787be by Ezio Melotti in branch 'default':
#11985: merge with 3.2.
http://hg.python.org/cpython/rev/847a38d787be

--
nosy: +python-dev

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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-03 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Fixed, thanks for the info!

--
assignee: docs@python - ezio.melotti
nosy: +ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-03 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
assignee:  - ezio.melotti
nosy: +ezio.melotti

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-03 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
priority: normal - high

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



[issue11986] Min/max not symmetric in presence of NaN

2011-05-03 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

 nan = float('nan')
 min(nan, 5)
nan
 min(5, nan)
5

Good arguments can be made in favor of either result, but different value for 
min(x, y) depending on the order of arguments can hardly be justified.

In the face of ambiguity, refuse the temptation to guess suggests that 
min/max with NaN should be an error.  See also issue 11949.

--
messages: 135055
nosy: alex, belopolsky, durban, mark.dickinson
priority: normal
severity: normal
status: open
title: Min/max not symmetric in presence of NaN
type: behavior
versions: Python 3.3

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



[issue11986] Min/max not symmetric in presence of NaN

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Not specific to NaNs:

 min({1}, {2})
{1}
 min({2}, {1})
{2}

--
nosy: +pitrou

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



[issue11986] Min/max not symmetric in presence of NaN

2011-05-03 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

Undefined ordering means just that.

--
nosy: +rhettinger
resolution:  - invalid
status: open - closed

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



[issue11986] Min/max not symmetric in presence of NaN

2011-05-03 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

On Tue, May 3, 2011 at 2:41 PM, Raymond Hettinger
rep...@bugs.python.org wrote:
..
 Undefined ordering means just that.

Means what?  Compare float behavior to

Decimal('1')
 Decimal(1).max(Decimal('nan'))
Decimal('1')
 max(Decimal('1'), Decimal('nan'))
Traceback (most recent call last):
 ..
decimal.InvalidOperation: comparison involving NaN

Raymond, you don't really need to stop the debate 4 minutes after the
bug has been reported.

--

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



[issue11949] Make float('nan') unorderable

2011-05-03 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

Alexander, I urge you to take a good deal of care with this tracker item and 
not make any changes lightly.  Take a look at how other languages have dealt 
with the issue.

Also, consider that unorderable may not be the right answer at all.  The most 
common use of NaNs is as a placeholder for missing data.  Perhaps putting them 
at the end of a sort is the right thing to do (c.f. was databases do with NULL 
values).

The other major use for NaNs is a way to let an invalid intermediate result 
flow through the remainder of a calculation (much as @NA does in MS Excel).  
The spirit of that use case would suggest that raising an exception during a 
sort is the wrong thing to do.

Another consideration is that it would be unusual (and likely unexpected) to 
have a type be orderable or not depending on a particular value.  Users ask 
themselves whether floats are orderable, not whether some values of floats are 
orderable.

I strongly oppose this patch in its current form and think it is likely to 
break existing code that expects NaNs to be quiet.

--
nosy: +rhettinger

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



[issue11949] Make float('nan') unorderable

2011-05-03 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

Also, if you're going to make a change, please consult the scipy/numpy 
community.  They are the most knowledgeable on the subject and the most 
affected by any change.

Given that they have not made any feature requests or bug reports about the 
current behavior, there is an indication that change isn't necessary or 
desirable.

--

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-03 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Attached patch should fix the problem.

--
keywords: +patch
Added file: http://bugs.python.org/file21873/issue11982.diff

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



[issue11986] Min/max not symmetric in presence of NaN

2011-05-03 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

The report is invalid because min/max make no guarantees about values without a 
total ordering.

Your other tracker item correctly focused on the behavior of float('NaN') 
itself, rather than on the behavior of everything else in the Python world that 
compares two values.

--

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



[issue11987] queue.Queue.put should acquire mutex for unfinished_tasks

2011-05-03 Thread patrick vrijlandt

New submission from patrick vrijlandt patrick.vrijla...@gmail.com:

Line 154 in standard library's queue.py, in the definition of Queue.put() is: 
self.unfinished_tasks += 1

This line should be protected by acquiring the all_tasks_done lock.
Theoretically, the increment could occur somewhere during task_done()!

Additional note:
Personally, I would like the increment to occur *before* instead of *after* 
_put(). This is because I would like to be able to implement a _put() that does 
not put everything. This put should be able to undo the increment. As it is, 
calling task_done() from put might decrease the counter to zero inadvertently.

--
components: Library (Lib)
messages: 135063
nosy: patrick.vrijlandt
priority: normal
severity: normal
status: open
title: queue.Queue.put should acquire mutex for unfinished_tasks
type: behavior
versions: Python 3.2

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



[issue11987] queue.Queue.put should acquire mutex for unfinished_tasks

2011-05-03 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue11987] queue.Queue.put should acquire mutex for unfinished_tasks

2011-05-03 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

 This line should be protected by acquiring the all_tasks_done lock.

All of three of the condition variables share the same underlying lock.  The 
increment occurs only with the lock has been acquired. 

 Theoretically, the increment could occur somewhere during task_done()!

I don't understand what you mean.  The semantics of task_done() method implies 
that the count gets decremented.

 Personally, I would like the increment to occur *before* 
 instead of *after* _put().

There may be some merit to this but I don't see how it matters much since both 
occur within the context of the same lock being held.  A user defined method 
can still add or subtract any number it wants from the unfinished task count.  
The result of +1 -5 is the same as -5 +1.

I'm reluctant to change the order though because the code is already published 
and some user's _put code may be inspecting the unfinished tasks count.  I 
wouldn't want to break that code without good reason.

--

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-03 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - accepted

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



[issue10276] zlib crc32/adler32 buffer length truncation (64-bit)

2011-05-03 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

Ha!  I always knew it!  wink

--

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Here is a patch with tests for the issue (some of which fail of course).
Do we agree that these tests are right?

--
keywords: +patch
Added file: http://bugs.python.org/file21874/forklocktests.patch

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



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

The following code:


class X(list):

def __contains__(self, key):
print('X contains:', key)


class Y():

def __init__(self, x):
self.x = x

def __getattr__(self, key):
return getattr(self.x, key)

def __iter__(self):
print('Y iter')
return iter([1,2])

x = X()
y = Y(x)

print('res:', 1 in y)
-

prints True.  It has been explained to me that this is because of:

http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-classes

However, there is no way in the world that I would guess the behavior above 
from the documentation provided (and I find it surprising...I expected x's 
__contains__ to get called because Y (a class, not an instance) doesn't have a 
__contains__ method).

Can anyone explain it more clearly and update the documentation?

--
assignee: docs@python
components: Documentation
messages: 135068
nosy: docs@python, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: special method lookup docs don't address some important details
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-03 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

Those tests make sense to me.

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6721
___pThose tests make sense to me./p
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

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



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue8498] Cannot use backlog = 0 for sockets

2011-05-03 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 To revive this issue, I tried to write a unit test to verify the behaviour.
 Onfurtunately, the test doesn't work and I don't understand why. I hope,
 someone here is more enlightend than me...

The semantic of listen's backlog argument has always been unclear, so
different implementations apply some fudge factor to the value
passed, see for example
http://books.google.com/books?id=ptSC4LpwGA0Clpg=PA108ots=Kq9FQogkTrdq=berkeley%20listen%20backlog%20ackpg=PA108#v=onepageq=berkeley
listen backlog ackf=false

Most of the time, passing backlog means that the kernel will queue
at least backlog requests.
Under the kernel I'm using (2.6.32), the maximum number of queued
requests is actually backlog + 1, and it seems to be the same on
FreeBSD (I guess one of the reason is to cope with backlog == 0).
Note that under Linux, there's another setting coming into play,
net.ipv4.tcp_abort_on_overflow:

If listening service is too slow to accept new connections, reset
them. Not enabled by default. It means that if overflow occurred due
to a burst, connection will recover.
Enable this option only if you are really sure that listening daemon
cannot be tuned to accept connections faster. Enabling this option can
harm clients of your server.


The goal is to avoid dropping connection requests because of a temporary burst.
So if you change your script to make as many connections as possible
with the default value, you'll probably be able to go well above
listen's backlog.
To deactivate it, you can use:
# sysctl  net.ipv4.tcp_abort_on_overflow=1

(But it's not a good idea in a production setting).

As for the test, you should add it to Lib/test/test_socket.py (just
creating a socket, binding it and passing a backlog of 0 should be
more than enough).

--

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



[issue11970] distutils command 'upload' crashes when --show-response is selected

2011-05-03 Thread Chris Rose

Chris Rose off...@offby1.net added the comment:

I can see that this is only an error in the 2.7.1 release, and is fixed in 
distutils on the 2.7 branch (along with other bugs, too, from what I can see.)

I'm closing it as invalid, given that.

--
resolution:  - invalid
status: open - closed

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



[issue10276] zlib crc32/adler32 buffer length truncation (64-bit)

2011-05-03 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

Changeset a0681e7a6ded fixes this bug for 2.7 - too-large buffers cause
an OverflowError during argument parsing, so there is no possibility of
truncation happening.

--
status: open - closed

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



[issue11989] deprecate shutil.copy2

2011-05-03 Thread Danijel

New submission from Danijel d...@korn.shell.la:

The function name is really ugly. The attached patch introduces an optional 
parameter to shutil.copy.

--
components: Library (Lib)
files: shutil.py.diff
keywords: patch
messages: 135073
nosy: datamuc
priority: normal
severity: normal
status: open
title: deprecate shutil.copy2
type: feature request
versions: Python 3.4
Added file: http://bugs.python.org/file21876/shutil.py.diff

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



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

In 2.7 I get the following (if Y does not inherit from object):

 print('res:', 1 in y)
('X contains:', 1)
('res:', False)

This makes sense with old style classes.  With Y(object):

 print('res:', 1 in y)
Y iter
('res:', True)

--
nosy: +ericsnow

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



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Not sure I understand your issue here.  How should 1 in y get at 
X.__contains__ given the special method lookup rules?  The __getattr__ is not 
called since y.__contains__ isn't looked up.

--
nosy: +georg.brandl

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



[issue11990] redirected output - stdout writes newline as \n in windows

2011-05-03 Thread James Hutchison

New submission from James Hutchison jamesghutchi...@gmail.com:

In windows, 64-bit, python *mostly* writes only a \n to stdout even though it's 
mode is 'w'. However it sometimes writes a \r\n on certain print statements and 
erratically when I have multiple processes writing to stdout.

Output looks fine in console, in IDLE, and using v.3.1

Example with multiple processes writing to stdout out using the same code: 
print(TESTCODE); (note that in windows, the naked \n is ignored):

TESTCODETESTCODE
TESTCODE
TESTCODE
TESTCODETESTCODETESTCODE
TESTCODE

Windows program that calls python and receives its piped output is a C# .NET 
program.

--
components: IO, Windows
messages: 135076
nosy: Jimbofbx
priority: normal
severity: normal
status: open
title: redirected output - stdout writes newline as \n in windows
type: behavior
versions: Python 3.2

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



[issue11990] redirected output - stdout writes newline as \n in windows

2011-05-03 Thread James Hutchison

James Hutchison jamesghutchi...@gmail.com added the comment:

Sorry there isn't more info but I'm really busy right now

In fact a workaround would be appreciated if known.

--

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



[issue11991] test_distutils fails because of bad filename match

2011-05-03 Thread Piotr Husiatyński

New submission from Piotr Husiatyński phusiatyn...@gmail.com:

I'm using Arch Linux, which instead of compress, provides symlink to gzip 
(AFAIK this will be replaced with xz). Because of that, instead of .Z 
extension, .gz is being used to create compressed file name.

$ ./python -m test test_distutils
[1/1] test_distutils
test test_distutils failed -- Traceback (most recent call last):
  File /mnt/sda5/Projekty/cpython/Lib/distutils/tests/test_archive_util.py, 
line 165, in test_compress_deprecated
self.assertTrue(os.path.exists(tarball))
AssertionError: False is not true

1 test failed:
test_distutils
[1]4874 exit 1 ./python -m test test_distutils
$ whereis compress
compress: /bin/compress /usr/share/man/man1/compress.1p.gz
$ file /bin/compress
/bin/compress: symbolic link to `gzip'

--
assignee: tarek
components: Distutils, Tests
messages: 135077
nosy: Husio, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: test_distutils fails because of bad filename match
versions: Python 3.3

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-03 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

# A lock taken from the current thread should stay taken in the
# child process.

Note that I'm not sure of how to implement this.
After a fork, even releasing the lock can be unsafe, it must be re-initialized, 
see following comment in glibc's malloc implementation:
/* In NPTL, unlocking a mutex in the child process after a
   fork() is currently unsafe, whereas re-initializing it is safe and
   does not leak resources.  Therefore, a special atfork handler is
   installed for the child. */

Note that this means that even the current code allocating new locks after fork 
(in Lib/threading.py, _after_fork and _reset_internal_locks) is unsafe, because 
the old locks will be deallocated, and the lock deallocation tries to acquire 
and release the lock before destroying it (in issue #11148 the OP experienced a 
segfault on OS-X when locking a mutex, but I'm not sure of the exact context).

Also, this would imply keeping track of the thread currently owning the lock, 
and doesn't match the typical pthread_atfork idiom (acquire locks just before 
fork, release just after in parent and child, or just reinit them in the child 
process)

Finally, IMHO, forking while holding a lock and expecting it to be usable after 
fork doesn't make much sense, since a lock is acquired by a thread, and this 
threads doesn't exist in the child process. It's explicitely described as 
undefined by POSIX, see 
http://pubs.opengroup.org/onlinepubs/007908799/xsh/sem_init.html :

The use of the semaphore by threads other than those created in the same 
process is undefined.


So I'm not sure whether it's feasable/wise to provide such a guarantee.

--

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



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Well, then I suppose my question is why isn't __contains__ looked up?  Other 
special methods that don't exist on Y do cause __getattr__ to be called.  Why 
is __contains__ special?  The docs for __getattr__ don't hint at this 
possibility either.

I think the people that understand this must have a mental model of how the 
interpreter looks up methods that has some pieces that are missing from mine.  
I guess I'd like those bits to be made explicit in the special method lookup 
docs, or if they are already documented somewhere, for there to be a pointer to 
them in the special method lookup docs.

--

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



[issue11990] redirected output - stdout writes newline as \n in windows

2011-05-03 Thread James Hutchison

James Hutchison jamesghutchi...@gmail.com added the comment:

Nevermind, I have a workaround that didn't require rewriting all the print 
statements but its in the C# code not the python code

--

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



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Ah, that's what my problem is.  My test example was poorly conceived (I used 
__del__!) so I *thought* the other special methods were triggering getattr.

I'd have figured it out if I hadn't screwed up my test :(

--
resolution:  - invalid
stage: needs patch - committed/rejected
status: open - closed

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-03 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Also, this would imply keeping track of the thread currently owning
 the lock,

Yes, we would need to keep track of the thread id and process id inside
the lock. We also need a global variable of the main thread id after
fork, and a per-lock taken flag.

Synopsis:

def _reinit_if_needed(self):
# Call this before each acquire() or release()
if self.pid != getpid():
sem_init(self.sem, 0, 1)
if self.taken:
if self.tid == main_thread_id_after_fork:
# Lock was taken in forked thread, re-take it
sem_wait(self.sem)
else:
# It's now released
self.taken = False
self.pid = getpid()
self.tid = current_thread_id()

 and doesn't match the typical pthread_atfork idiom (acquire locks just
 before fork, release just after in parent and child, or just reinit
 them in the child process)

Well, I fail to understand how that idiom can help us. We're not a
self-contained application, we're a whole programming language.
Calling fork() only when no lock is held is unworkable (for example, we
use locks around buffered I/O objects).

--

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



[issue11962] Buildbot reliability

2011-05-03 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Another instance:

2011-05-03 20:18:08+0200 [Broker,client]   closing stdin
2011-05-03 20:18:08+0200 [Broker,client]   using PTY: False
2011-05-03 20:20:38+0200 [-] sending app-level keepalive


Again this is missing:

... [-] command finished with signal None, exit code 0, elapsedTime:


Also, as we speak the Ubuntu PPC bot is hanging as well:


http://www.python.org/dev/buildbot/all/builders/PPC%20Ubuntu%202.7/builds/386/steps/test/logs/stdio



Antoine, do you have access to the server logs for the relevant
times? My bot is on CEST.

--
title: FreeBSD-AMD64 bot sporadic hanging - Buildbot reliability

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



[issue11962] Buildbot reliability

2011-05-03 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy: +barry

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



[issue11962] Buildbot reliability

2011-05-03 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

My Ubuntu PPC server is having hardware problems.  It will just intermittently 
shut off.  I've reset the SMU and the PRAM, vacuumed out the guts, reseated the 
RAM, pulled any possibly problematic 3rd party boards, and it still crashes.  I 
was watching the syslog and it didn't look like a thermal shutdown, though it 
acted like that.  The only thing I can think of is a power supply problem, so 
I'm going to see if I can find an inexpensive replacement.  In the meantime, 
this machine will be offline for a couple of weeks at least.

--

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



[issue7546] msvc9compiler.py: add .asm extension

2011-05-03 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

The poster should get the same error messages from:

ml64 /c /Cx x64dll.asm


Perhaps the assembly isn't MASM?

--

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-03 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 Since the commit c9207c6ce24a, test_signal fails on OpenIndiana:
 
 http://www.python.org/dev/buildbot/all/builders/x86%20OpenIndiana%203.x/builds/1179
 ==
 ERROR: test_block_unlock (test.test_signal.PthreadSigmaskTests)
 --
 Traceback (most recent call last):
   File 
 /export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_signal.py,
  line 539, in test_block_unlock
 self.assertEqual(set(old_mask) ^ set(blocked), {signum})
   File 
 /export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_signal.py,
  line 501, in handler
 1/0
 ZeroDivisionError: division by zero

This is because a thread different than the main thread receives the
signal and calls the signal handler. Antoine found that python -m
test_pydoc test_signal is enough to reproduce the problem (on any OS,
or at least on Linux). test_pydoc loads a lot (all?) of Python modules
including _tkinter, and _tkinter (libtcl) creates a C thread which waits
events using select().

I see 3 solutions:

a) Use pthread_kill() to send the signal directly to the right thread
(the main thread)

b) Destroy _tkinter: Tcl_Finalize() exits the thread, but this function
is never called. _tkinter.c contains the following code:
#if 0
/* This was not a good idea; through Destroy bindings,
   Tcl_Finalize() may invoke Python code but at that point the
   interpreter and thread state have already been destroyed! */
Py_AtExit(Tcl_Finalize);
#endif

c) Skip the test if the _tkinter thread is present. Check if the
_tkinter module is loaded *should* be enough to check if the Tcl thread
is running. Unload the _tkinter module is not possible: modules written
in C cannot be unloaded. But it is possible to remove all references
from the Python object space, so check '_tkinter' in sys.modules is
maybe not reliable.

I don't know if some platforms have pthread_sigmask() but not
pthread_kill().

I have a patch to expose pthread_kill(), sigpending() and sigwait(). I
will publish it tomorrow for a review.

--

test_signal doesn't fail on all platforms. Possible reasons:

 - the platform doesn't have pthread_sigmask(), and so the test is
skipped
 - the libtcl version is different, a newer version masks maybe signals?
 - (unlikely!) os.kill() always sends the signal to the main thread

--

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



[issue7546] msvc9compiler.py: add .asm extension

2011-05-03 Thread Zooko O'Whielacronx

Zooko O'Whielacronx zo...@zooko.com added the comment:

Thanks, Stefan Krah. I posted your comment to the tahoe-dev mailing list:

http://tahoe-lafs.org/pipermail/tahoe-dev/2011-May/006336.html

Also Samuel Neves has posted on that thread.

--

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



[issue11992] sys.settrace doesn't disable tracing if a local trace function returns None

2011-05-03 Thread Ned Batchelder

New submission from Ned Batchelder ned...@users.sourceforge.net:

The docs say:

The trace function is invoked (with event set to 'call') whenever a new 
local scope is entered; it should return a reference to a local trace function 
to be used that scope, or None if the scope shouldn’t be traced.

The local trace function should return a reference to itself (or to another 
function for further tracing in that scope), or None to turn off tracing in 
that scope.

It's that last part that's wrong: returning None from the trace function only 
has an effect on the first call in a new frame.  Once the trace function 
returns a function for a frame, returning None from subsequent calls is 
ignored.  A local trace function can't turn off tracing in its scope.

To demonstrate:

import sys

UPTO_LINE = 1

def t(frame, event, arg):
num = frame.f_lineno
print(line %d % num)
if num  UPTO_LINE:
return t

def try_it():
print(twelve)
print(thirteen)
print(fourteen)
print(fifteen)

UPTO_LINE = 1
sys.settrace(t)
try_it()

UPTO_LINE = 13
sys.settrace(t)
try_it()

Produces:

line 11
twelve
thirteen
fourteen
fifteen
line 11
line 12
twelve
line 13
thirteen
line 14
fourteen
line 15
fifteen
line 15

The first call to try_it() returns None immediately, preventing tracing for the 
rest of the function.  The second call returns None at line 13, but the rest of 
the function is traced anyway.  This behavior is the same in all versions from 
2.3 to 3.2, in fact, the 100 lines of code in sysmodule.c responsible for 
Python tracing functions are completely unchanged through those versions.

--
components: Library (Lib)
messages: 135089
nosy: nedbat
priority: normal
severity: normal
status: open
title: sys.settrace doesn't disable tracing if a local trace function returns 
None
type: behavior
versions: Python 2.7, Python 3.2

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



[issue11992] sys.settrace doesn't disable tracing if a local trace function returns None

2011-05-03 Thread Ned Batchelder

Changes by Ned Batchelder ned...@users.sourceforge.net:


--
assignee:  - nedbat

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



[issue11993] Is it desired to distinguish new files from old with sub-second resolution?

2011-05-03 Thread John S. Gruber

New submission from John S. Gruber johnsgru...@gmail.com:

This report is meant to prompt discussion, if desired, on the advisability of 
distinguishing new files from old using subsecond data. (It isn't clear to me 
that it is important to do this.)

Some file systems keep sub-second modification times, but the number of seconds 
since the epoch grows to a very large number, and given the limited number of 
significant bits in floating point numbers, it's important to carry out this 
comparison carefully (or use some new integer data) so newly created files 
don't appear to be older than their source files due to rounding and other 
conversion anomalies. Current floats don't have the precision to hold both the 
number of seconds since the epoch and a nanosecond precision fractional second.

--
assignee: tarek
components: Distutils2
messages: 135090
nosy: alexis, eric.araujo, jsjgruber, tarek
priority: normal
severity: normal
status: open
title: Is it desired to distinguish new files from old with sub-second 
resolution?
type: feature request
versions: Python 2.7

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



[issue11993] Is it desired to distinguish new files from old with sub-second resolution?

2011-05-03 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Is this proposing some sort of change or problem?

--
nosy: +benjamin.peterson

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



[issue11993] Is it desired to distinguish new files from old with sub-second resolution?

2011-05-03 Thread John S. Gruber

John S. Gruber johnsgru...@gmail.com added the comment:

Thanks for writing so quickly.

This topic arose as part of issue 11933 (similar number).  Éric Araujo asked 
that I bring this up in either mail to the fellowship of the packaging or as a 
separate bug report, so I chose to file this. Please see msg 134634 from that 
issue. I suppose Éric may believe sub-second time comparison is a possibility 
for distutils2. I think *if* it is done the integer/float conversion 
implication should be considered, given my limited experience with the topic in 
distutils.i

Thanks again.

--

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



[issue11834] wrong module installation dir on Windows

2011-05-03 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 175dcc8c4b23 by Brian Curtin in branch '3.1':
Fix #11834. Correct site-packages paths.
http://hg.python.org/cpython/rev/175dcc8c4b23

New changeset 03d511dec224 by Brian Curtin in branch '3.2':
Fix #11834. Correct site-packages paths.
http://hg.python.org/cpython/rev/03d511dec224

New changeset 066e63425228 by Brian Curtin in branch 'default':
Fix #11834. Correct site-packages paths.
http://hg.python.org/cpython/rev/066e63425228

New changeset 1a2f0f545f55 by Brian Curtin in branch '2.7':
Fix #11834. Correct site-packages paths.
http://hg.python.org/cpython/rev/1a2f0f545f55

--
nosy: +python-dev

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



[issue11834] wrong module installation dir on Windows

2011-05-03 Thread Brian Curtin

Brian Curtin br...@python.org added the comment:

Thanks for the patches and reviews!

--
assignee:  - brian.curtin
resolution:  - fixed
stage: needs patch - committed/rejected
type:  - behavior

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-03 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 Yes, we would need to keep track of the thread id and process id inside
 the lock. We also need a global variable of the main thread id after
 fork, and a per-lock taken flag.

 Synopsis:

    def _reinit_if_needed(self):
        # Call this before each acquire() or release()
        if self.pid != getpid():
            sem_init(self.sem, 0, 1)
            if self.taken:
                if self.tid == main_thread_id_after_fork:
                    # Lock was taken in forked thread, re-take it
                    sem_wait(self.sem)
                else:
                    # It's now released
                    self.taken = False
            self.pid = getpid()
            self.tid = current_thread_id()


A couple remarks:
- with linuxthreads, different threads within the same process have
the same PID - it may be true for other implementations - so this
would lead to spurious reinitializations
- what's current_thread_id ? If it's thread_get_ident (pthread_self),
since TID is not guaranteed to be inherited across fork, this won't
work
- calling getpid at every acquire/release is expensive, even though
it's a trivial syscall (it'll have to measured though)
- imagine the following happens:

P1

lock.acquire()
fork()-   P2
   start_new_thread T2
   T1   T2
lock.acquire()

The acquisition of lock by T2 will cause lock's reinitialization: what
happens to the lock wait queue ? who owns the lock ?
That why I don't think we can delay the reinitialization of locks, but
I could be wrong.

 Well, I fail to understand how that idiom can help us. We're not a
 self-contained application, we're a whole programming language.
 Calling fork() only when no lock is held is unworkable (for example, we
 use locks around buffered I/O objects).

Yes, but in that case, you don't have to reacquire the locks after fork.
In the deadlock you experienced above, the thread that forked wasn't
the one in the I/O code, so the corresponding lock can be
re-initialized anyway, since the thread in the I/O code at that time
won't exist after fork.
And it's true with every lock in the library code: they're only held
in short critical sections (typically acquired when entering a
function and released when leaving), and since it's not the threads
inside those libraries that fork, all those locks can simply be
reinitialized on fork, without having the reacquire them.

--

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