[issue10133] multiprocessing: conn_recv_string() broken error handling

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: Thanks for the patch, I have applied it. (I don't think there was a problem with the promotion rules because res was a never converted to UINT32.) -- resolution: -> fixed stage: -> committed/rejected status: ope

[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: The docs were patched in changeset 9fa52478b32b, so I will close. -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.o

[issue10037] multiprocessing.pool processes started by worker handler stops working

2012-06-11 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- resolution: -> later stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue8289] multiprocessing.Process.__init__ pickles all arguments

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: I don't think there is any problem here since you have control over which arguments you pass to __init__. Without a reason why that is not a solution I will eventually close the issue as rejected. -- resolution: -> rejected stage: ->

[issue12897] Support for iterators in multiprocessing map

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: Unless you have a reason why imap() does not solve the problem I will eventually close the issue as rejected. -- resolution: -> rejected stage: -> committed/rejected status: open -> pending ___ Pytho

[issue8289] multiprocessing.Process.__init__ pickles all arguments

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: OK, I'll close. -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue8289> ___ ___ Python-bugs-lis

[issue12897] Support for iterators in multiprocessing map

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: I'll close then. -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue12897> ___ ___ Python-bug

[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist

2012-06-11 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- stage: -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.org/issue3518> ___ ___ Pyth

[issue13841] multiprocessing should use sys.exit() where possible

2012-06-13 Thread Richard Oudkerk
Richard Oudkerk added the comment: The trivial patch of replacing exit() by sys.exit() caused manager processes to be terminated after a short timeout. (It is inconvenient that in Python there is no way for a non-main thread to request immediate shutdown of the process.) This new patch

[issue15064] multiprocessing should use more context manager

2012-06-14 Thread Richard Oudkerk
New submission from Richard Oudkerk : There are some types which should support the context manager protocol: - connection objects - listener objects - pool objects -- messages: 162776 nosy: sbt priority: normal severity: normal stage: needs patch status: open title: multiprocessing

[issue13841] multiprocessing should use sys.exit() where possible

2012-06-14 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue14059] Implement multiprocessing.Barrier

2012-06-15 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue15101] multiprocessing pool finalizer can fail if triggered in background pool thread

2012-06-18 Thread Richard Oudkerk
New submission from Richard Oudkerk : Multiprocessing's process pool originally used a finalizer to shutdown the pool when the pool object is garbage collected. Since the maxtasksperchild feature was added, the worker_handler thread holds a reference to the pool, preventing garbage colle

[issue15038] Optimize python Locks on Windows

2012-06-18 Thread Richard Oudkerk
Richard Oudkerk added the comment: Py_LOCAL_INLINE(int) _PyCOND_WAIT_MS(PyCOND_T *cv, PyMUTEX_T *cs, DWORD ms) { DWORD wait; cv->waiting++; PyMUTEX_UNLOCK(cs); /* "lost wakeup bug" would occur if the caller were interrupted here, * but we are safe because w

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: The old version was 243 __inline static void _cond_signal(COND_T *cond) { 244 /* NOTE: This must be called with the mutex held */ 245 if (cond->n_waiting > 0) { 246 if (!ReleaseSemaphore(cond->sem, 1, NUL

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: Standard condition variables have the following guarantees: * if there are any waiters then signal()/notify() will awaken at least one of them; * if there are any waiters then broadcast()/notify_all() will awaken all of them. The implementation in

[issue15064] Use context manager protocol for more multiprocessing types

2012-06-19 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed title: multiprocessing should use more context manager -> Use context manager protocol for more multiprocessing types __

[issue12774] Warning -- multiprocessing.process._dangling was modified by test_multiprocessing

2012-06-19 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- status: pending -> closed ___ Python tracker <http://bugs.python.org/issue12774> ___ ___ Python-bugs-list mailing list Unsubscri

[issue12882] mmap crash on Windows

2012-06-19 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- status: pending -> closed ___ Python tracker <http://bugs.python.org/issue12882> ___ ___ Python-bugs-list mailing list Unsubscri

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Let me elaborate: the GIL can perhaps suffer lost wakeups from time to > time. The Lock API certainly shouldn't. I think with FORCE_SWITCHING defined (the default?) it is not possible for the thread releasing the GIL to immediately reacquire

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: The implementation in condvar.h is basically the same as one of the attempts mentioned in http://birrell.org/andrew/papers/ImplementingCVs.pdf (Listing 2 fixed to use non-binary semaphores.) The implementation for multiprocessing.Condition is virtually

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: The notes should also mention that PyCOND_SIGNAL() and PyCOND_BROADCAST() must be called while holding the mutex. (pthreads does not have that restriction.) -- ___ Python tracker <http://bugs.python.

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: > It's an interesting article Richard, but I don't see how their 2nd attempt > solves the problem. All it does is block the thread doing the Signal(), > not other threads, from stealing the wakeup. Do you mean the listing on page 5? (T

[issue15038] Optimize python Locks on Windows

2012-06-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: 1.41 Generic emulations of the pthread_cond_* API using 1.42 earlier Win32 functions can be found on the Web. 1.43 The following read can be edificating (or not): 1.44 http://www.cse.wustl.edu/~schmidt/win32-cv-1.html 1.45

[issue15124] _thread.LockType: Optimize lock deletion, acquisition of uncontested lock and release of lock.

2012-06-21 Thread Richard Oudkerk
Richard Oudkerk added the comment: On 32 bit linux in a VM I get BEFORE allocation 0.125 acquire/release 0.434 AFTER allocation 0.109 (-13%) acquire/release 0.346 (-20%) -- nosy: +sbt ___ Python tracker <h

[issue15139] Speed up threading.Condition wakeup

2012-06-29 Thread Richard Oudkerk
Richard Oudkerk added the comment: Currently negative timeouts are treated as zero timeouts by Condition.wait(). The patches turns them into errors. -- ___ Python tracker <http://bugs.python.org/issue15

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-06-30 Thread Richard Oudkerk
Richard Oudkerk added the comment: Rather than add a NamedTemporaryFile.delete_after() classmethod, would it not be simpler to just add a close_without_unlink() method to NamedTemporaryFile? with NamedTemporaryFile() as f: f.close_without_unlink() with open(f.name

[issue15198] multiprocessing Pipe send of non-picklable objects doesn't raise error

2012-06-30 Thread Richard Oudkerk
Richard Oudkerk added the comment: What type of object did you try to send, and how can the problem be reproduced? There are plenty of types which don't support pickling, and where pickling only succeeds in producing invalid data which cannot be successfully unpickled. The exception r

[issue15229] stringification of subclasses of OSError can cause crash

2012-06-30 Thread Richard Oudkerk
New submission from Richard Oudkerk : If you subclass OSError without calling OSError.__init__() then you can get a crash. For example Python 3.3.0b1 (default:cfbe51e66749, Jun 30 2012, 20:50:54) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "

[issue15198] multiprocessing Pipe send of non-picklable objects doesn't raise error

2012-07-01 Thread Richard Oudkerk
Richard Oudkerk added the comment: Then I doubt this is a bug in Python. If your class does not override __reduce__, __reduce_ex__ or __getstate__/__setstate__, then it is probably one of the attributes of your instance which is causing the problem. You could try to find out which one by

[issue15198] multiprocessing Pipe send of non-picklable objects doesn't raise error

2012-07-01 Thread Richard Oudkerk
Richard Oudkerk added the comment: > I have repaired my class so that it pickles properly, but that does not > resolve the issue that if you send a non-picklable object through a pipe, > it should raise an error, rather than hang. What do you mean by hang? Do you mean that send()

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-01 Thread Richard Oudkerk
Richard Oudkerk added the comment: The webpage http://msdn.microsoft.com/en-us/library/aa273350(v=vs.60).aspx describes the sopen() function which is like open() but has an extra shflag parameter for specifying the sharing allowed. If sopen() and the associated constants SH_DENYRD

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-01 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Agreed. Richard: do you have time to put something together? > I'm happy to try if you don't. I'm looking into it. Unfortunately, it seems that you need to use non-default flags when reopening a shared file. Eg, if the file is

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-01 Thread Richard Oudkerk
Richard Oudkerk added the comment: I checked the source in c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/crt/src/open.c and it seems that on Windows open() is more or less implemented as a wrapper of sopen(..., ..., SH_DENYNO, ...). So the only reason that trying to reopen a

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-02 Thread Richard Oudkerk
Richard Oudkerk added the comment: I wrote in an earlier message that a file opened with O_TEMPORARY must be reopened with O_TEMPORARY. This is not quite accurate. Using O_TEMPORARY causes the FILE_SHARE_DELETE sharing mode to be used, and a file currently opened with FILE_SHARE_DELETE can

[issue15244] Support for opening files with FILE_SHARE_DELETE on Windows

2012-07-03 Thread Richard Oudkerk
New submission from Richard Oudkerk : On Unix, files (unless specifically locked) can be renamed and deleted while file descriptors for the file remain open. The file descriptors remain valid even after deletion of the file. On Windows this is not possible for files opened using io.open() or

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-03 Thread Richard Oudkerk
Richard Oudkerk added the comment: I have opened Issue #15244 with a patch to add a share module to the stdlib. After monkey patching builtins.open(), io.open() and os.open() to be equivalents using FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, the regression test suite still runs

[issue15261] os.stat(fd) crashes on Windows if fd does not exist

2012-07-05 Thread Richard Oudkerk
New submission from Richard Oudkerk : In Python 3.3 (but not earlier) os.stat() is documented to work with file descriptors. (os.path.exists() also works with fds since it is implemented in terms of os.stat(), although that is *not* documented.) However, on Windows if fd is not open then

[issue15261] os.stat(fd) crashes on Windows if fd does not exist

2012-07-05 Thread Richard Oudkerk
Richard Oudkerk added the comment: This can probably be fixed by using _PyVerify_fd(). -- ___ Python tracker <http://bugs.python.org/issue15261> ___ ___ Pytho

[issue15261] os.stat(fd) crashes on Windows if fd does not exist

2012-07-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Many os functions started to accept file descriptors. > I don't know how many are available on Windows... On Windows os.stat() seems to be the only one: >>> os.supports_fd {} -- ___ P

[issue15261] os.stat(fd) crashes on Windows if fd does not exist

2012-07-06 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: Every use of _get_osfhandle() should be guarded by _Py_VerifyFd(). Grepping through the source it seems that that is now true, but we could instead use #define _PY_GET_OSFHANDLE(fd) _Py_VerifyFd(fd) ? _get_osfhandle(fd) : INVALID_HANDLE_VALUE

[issue15261] os.stat(fd) crashes on Windows if fd does not exist

2012-07-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: Sorry about that... -- ___ Python tracker <http://bugs.python.org/issue15261> ___ ___ Python-bugs-list mailing list Unsub

[issue15361] venv's Activate.ps1 causes broken prompt with powershell

2012-07-15 Thread Richard Oudkerk
New submission from Richard Oudkerk : If I create a venv on Windows called "py3" then py3/Scripts/Activate.ps1 defines the prompt to be function prompt { Write-Host -NoNewline -ForegroundColor Green [(py3) ] _OLD_VIRTUAL_PROMPT } However this prompt functio

[issue15364] sysconfig confused by relative paths

2012-07-16 Thread Richard Oudkerk
New submission from Richard Oudkerk : With unix, and a source build, sysconfig.get_config_var('srcdir') and sysconfig.get_path('include') misbehave: user@mint-vm ~/Repos/cpython $ cd / user@mint-vm / $ ~/Repos/cpython/python Python 3.3.0b1 (default:671894ae19a2, J

[issue15366] venv assumes header files in sys._home + '/Include'

2012-07-16 Thread Richard Oudkerk
New submission from Richard Oudkerk : For Unix I follow the practice suggested in README of running configure from a subdir of the main python directory, eg mkdir release cd release ../configure make But if I create a venv then I cannot use it to compile C extensions because

[issue15367] build_ext in a venv on Windows assumes pyconfig.h in sys.exec_prefix + '\PC'

2012-07-16 Thread Richard Oudkerk
New submission from Richard Oudkerk : On Windows I can't use a source build of Python to create a venv which will compile C extensions because pyconfig.h cannot be found. For example running build running build_ext building 'demo' extension creating build

[issue15367] build_ext in a venv on Windows assumes pyconfig.h in sys.exec_prefix + '\PC'

2012-07-16 Thread Richard Oudkerk
Richard Oudkerk added the comment: The attached patch works for me. -- keywords: +patch Added file: http://bugs.python.org/file26395/build_ext.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15366] venv assumes header files in sys._home + '/Include'

2012-07-16 Thread Richard Oudkerk
Richard Oudkerk added the comment: The attached patch seems to fix the problem. -- keywords: +patch Added file: http://bugs.python.org/file26397/distutils-sysconfig.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15366] venv assumes header files in sys._home + '/Include'

2012-07-16 Thread Richard Oudkerk
Richard Oudkerk added the comment: Updated patch. Old one broke test_distutils... -- Added file: http://bugs.python.org/file26399/distutils-sysconfig.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15367] build_ext in a venv on Windows assumes pyconfig.h in sys.exec_prefix + '\PC'

2012-07-16 Thread Richard Oudkerk
Richard Oudkerk added the comment: Updated patch which does not fail test_distutils. -- Added file: http://bugs.python.org/file26400/build_ext.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15364] sysconfig confused by relative paths

2012-07-16 Thread Richard Oudkerk
Richard Oudkerk added the comment: > I don't recall what the issue was the resulted in the check-in that you > mention. I think it was http://bugs.python.org/issue8577. The issue was about having srcdir != builddir. The initial patch caused a test failure, and 356d0ea8ea34 f

[issue15364] sysconfig confused by relative paths

2012-07-16 Thread Richard Oudkerk
Richard Oudkerk added the comment: In the attached patch _safe_realpath() is only called after calculating the absolute path for srcdir. -- keywords: +patch Added file: http://bugs.python.org/file26407/sysconf.patch ___ Python tracker <h

[issue15364] sysconfig confused by relative paths

2012-07-17 Thread Richard Oudkerk
Richard Oudkerk added the comment: Updated patch which clarifies that for an installed python on a posix system, get_config_var('srcdir') == get_path('stdlib'). Eg, if sys.executable == '/usr/local/bin/python3.3' then get_config_var('srcdir') == '

[issue15364] sysconfig confused by relative paths

2012-07-17 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Beyond that, I don't understand why the patch behavior depends on > whether the srcdir is an absolute path or not. The os.path.isabs() test is actually redundant since os.path.join(base, srcdir) == srcdir if srcdir is an absolute path. I only

[issue15364] sysconfig confused by relative paths

2012-07-18 Thread Richard Oudkerk
Richard Oudkerk added the comment: Here is an updated patch which also modifies distutils.sysconfig. For "installed" pythons on posix systems it makes get_config_var('srcdir') == os.path.dirname(get_makefile_filename()) (The older patches would give the same result

[issue15364] sysconfig confused by relative paths

2012-07-18 Thread Richard Oudkerk
Richard Oudkerk added the comment: Forgot to remove some unnecessary code in patch. -- Added file: http://bugs.python.org/file26427/sysconf.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15184] Test failure in test_sysconfig_module

2012-07-18 Thread Richard Oudkerk
Richard Oudkerk added the comment: I suspect the problem is related to http://bugs.python.org/issue15298. Basically the global sysconfig module caches the results of parsing Makefile in Lib/_sysconfigdata.py. This can cause you to get the config vars from an old configure and build

[issue15364] sysconfig confused by relative paths

2012-07-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: > I'd make get_config_var('srcdir') to be None for installed systems, > because the source tree is not available there. While playing with a version of the patch which returns None for non-source builds, I found that distutils.suppo

[issue15397] Unbinding of methods

2012-07-20 Thread Richard Oudkerk
Richard Oudkerk added the comment: Can't you unbind without any changes to the C code by doing def unbind(f): if hasattr(f, '__func__'): return f.__func__ self = getattr(f, '__self__', None) if self is not None and not isinstan

[issue15408] os.fork/os.popen behaviour change between 2.7 and 3.2

2012-07-20 Thread Richard Oudkerk
Richard Oudkerk added the comment: The problem is that os.wait() is returning when the wrong process exits. You can fix this by specifying the pid you are waiting for by doing "os.waitpid(pid, 0)" instead of "os.wait()". Arguably os.popen() and subprocess.communicate() et

[issue15408] os.fork/os.popen behaviour change between 2.7 and 3.2

2012-07-20 Thread Richard Oudkerk
Richard Oudkerk added the comment: Actually, if you replace print(os.popen("uname").read()) with f = os.popen("uname") print(f.read()) f.close() or with os.popen("uname") as f: print(f.read()) then things

[issue15412] Note in documentation for weakrefs

2012-07-21 Thread Richard Oudkerk
New submission from Richard Oudkerk : In the documentation on weakrefs there is the following quote Note: Weak references to an object are cleared before the object’s __del__() is called, to ensure that the weak reference callback (if any) finds the object still alive. But I think

[issue15412] Note in documentation for weakrefs

2012-07-21 Thread Richard Oudkerk
Richard Oudkerk added the comment: > The weakref is "dead" but it's still a weakref, and it can be used to > e.g. index a container of existing weakrefs (cf. WeakSet, > WeakKeyDictionary, WeakValueDictionary). Ah. I had assumed that since dead weakrefs were unhashable

[issue15408] os.fork/os.popen behaviour change between 2.7 and 3.2

2012-07-23 Thread Richard Oudkerk
Richard Oudkerk added the comment: In Python 2.x, when the file object returned by popen() is garbage collected the process is automatically waited on, collecting the pid of the process. In Python 3.x a wrapper object is used whose close method wait on the pid. This close method is *not

[issue15408] os.fork/os.popen behaviour change between 2.7 and 3.2

2012-07-23 Thread Richard Oudkerk
Richard Oudkerk added the comment: A program which depends on the old behaviour would be broken on a non-refcounted implementation of Python, so I would be inclined to say "won't fix". However, I think the following patch would restore the old behaviour diff -r a970054a93fb

[issue6056] socket.setdefaulttimeout affecting multiprocessing Manager

2012-07-24 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- nosy: +sbt ___ Python tracker <http://bugs.python.org/issue6056> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-24 Thread Richard Oudkerk
Richard Oudkerk added the comment: ISTM the simplest approach would be to just set self->args in BaseException.__new__() (like in Georg's patch) but to ignore the possibility that the user might later set self.args to something stupid "wrong": diff -r 51ac5f06dd04 Objects/

[issue14930] Make memoryview weakrefable

2012-07-25 Thread Richard Oudkerk
Richard Oudkerk added the comment: Is it possible that the use of test.support.gc_collect() in test_memoryview made the difference? -- ___ Python tracker <http://bugs.python.org/issue14

[issue14501] Error initialising BaseManager class with 'authkey' argument of string type.

2012-07-25 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- nosy: +sbt ___ Python tracker <http://bugs.python.org/issue14501> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15451] PATH is not honored in subprocess.Popen in win32

2012-07-26 Thread Richard Oudkerk
Richard Oudkerk added the comment: I think env is used for specifying the environment used by the child process once it has started. env['PATH'] is not used by the parent process to find program to run. Having said that, maybe if you used "shell=True" as well then the s

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-26 Thread Richard Oudkerk
Richard Oudkerk added the comment: I see that the originally proposed patch is more or less what I suggested above. Since this has been a critical issue for 5 years, I think such a minimal patch should be committed even though it is not a complete solution. It seems to me that the more

[issue14501] Error initialising BaseManager class with 'authkey' argument of string type.

2012-07-26 Thread Richard Oudkerk
Richard Oudkerk added the comment: You could just do Server_1=TestServer(address=("127.0.0.1",5),authkey=b"passkey") so this is probably a documentation issue. The examples in the documentation should at least be updated. -- __

[issue15364] sysconfig confused by relative paths

2012-07-26 Thread Richard Oudkerk
Richard Oudkerk added the comment: Any objection if I commit the last patch before the next beta? This is the one which on installed Pythons have get_config_var('srcdir') == os.path.dirname(get_makefile_filename()) on pos

[issue15364] sysconfig confused by relative paths

2012-07-26 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Does get_config_var('srcdir') always return a string or sometimes None? Always a string. distutils.support._get_xxmodule_path() is one place which (currently) would throw an exception if it

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-26 Thread Richard Oudkerk
Richard Oudkerk added the comment: I realize now that the idea of using object.__reduce__(..., 2) would not really work since many exception classes use non-slot descriptors (unless '__slots__' attributes were also added as hints of what to serialize). I think there are two opti

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-27 Thread Richard Oudkerk
Richard Oudkerk added the comment: Here is a minimal patch against default. It is a clear improvement on the current situation, even though it still cannot handle the case class Error(Exception): def __init__(self, x): Exception.__init__(self) self.x = x

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-27 Thread Richard Oudkerk
Changes by Richard Oudkerk : Added file: http://bugs.python.org/file26537/init_args.patch ___ Python tracker <http://bugs.python.org/issue1692335> ___ ___ Python-bug

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-27 Thread Richard Oudkerk
Richard Oudkerk added the comment: ExceptionTests.testAttributes already checks the attributes of unpickled copies (using all protocols). -- ___ Python tracker <http://bugs.python.org/issue1692

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-27 Thread Richard Oudkerk
Richard Oudkerk added the comment: BTW, BaseException_init() has the code Py_XDECREF(self->args); self->args = args; Py_INCREF(self->args); Presumably the Py_XDECREF(self->args) would be better replaced by Py_CLEA

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-27 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Or you could simply Py_INCREF(args) before the Py_XDECREF... But won't self->args point to a broken object while any callbacks triggered by Py_XDECREF() are run? An alternative would be tmp = self->args; self->args = args;

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-27 Thread Richard Oudkerk
Richard Oudkerk added the comment: Patch which adds fix for BaseException_init(). Actually this class of problem seem to be quite common. BaseException_set_tb() appears to be affected too, as is the code in the tutorial which introduces setters. -- Added file: http

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-29 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Richard, can the issue be closed? I guess so (although the change could arguably be back ported). Pickling of Exception classes is still somewhat dodgy because an example like class Error(Exception): def __init__(self, x): Except

[issue6056] socket.setdefaulttimeout affecting multiprocessing Manager

2012-07-29 Thread Richard Oudkerk
Changes by Richard Oudkerk : -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed type: crash -> behavior ___ Python tracker <http://bugs.pytho

[issue15364] sysconfig confused by relative paths

2012-07-29 Thread Richard Oudkerk
Richard Oudkerk added the comment: > One example is 'srcdir': this value is only useful in the build tree and > there currently is no clean way to signal that you are retrieving a > value that is not useful. In the particular case of 'srcdir', sysconfig.is_pyth

[issue15451] PATH is not honored in subprocess.Popen in win32

2012-07-29 Thread Richard Oudkerk
Richard Oudkerk added the comment: > But I observe that the same script(with proper modification of file names) > works very well under Linux. After I dive into the source code, I found > Python use execvpe to invoke the child process which _will_ use the PATH > variable t

[issue15451] PATH is not honored in subprocess.Popen in win32

2012-07-29 Thread Richard Oudkerk
Richard Oudkerk added the comment: > What I understand you two as saying is that there seems to be an > undocumented difference in execxxe between unix and windows which has been > carried over to subprocess. No. There is no difference between the platforms in the behaviour of o

[issue15507] test_subprocess assumes SIGINT is not being ignored.

2012-07-31 Thread Richard Oudkerk
Richard Oudkerk added the comment: Couldn't the preexec_fn argument of Popen be used instead? -- nosy: +sbt ___ Python tracker <http://bugs.python.org/is

[issue15507] test_subprocess assumes SIGINT is not being ignored.

2012-07-31 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Couldn't the preexec_fn argument of Popen be used instead? Actually, since Python 3.2 you can just use "restore_signals=True". -- ___ Python tracker <http://bugs.

[issue15528] Better support for finalization with weakrefs

2012-08-01 Thread Richard Oudkerk
New submission from Richard Oudkerk: A patch with docs and tests for the idea I suggested on python-ideas: http://comments.gmane.org/gmane.comp.python.ideas/15863 To repeat what I wrote there, the current issues with weakref callbacks include: 1. They are rather low level, and working out

[issue15525] test_multiprocessing failure on Windows XP

2012-08-01 Thread Richard Oudkerk
Richard Oudkerk added the comment: I would guess that the process has already terminated (or is being torn down) but the timeout is not long enough to let the parent join child. Let's see if increasing the timeout fixes the failures. -- ___ P

[issue15525] test_multiprocessing failure on Windows XP

2012-08-03 Thread Richard Oudkerk
Richard Oudkerk added the comment: Looks like it is fixed. -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue15528] Better support for finalization with weakrefs

2012-08-04 Thread Richard Oudkerk
Richard Oudkerk added the comment: > I don't quite understand the purpose of your suggestions. What can you do > with it help, what you can not do with contextlib.ExitStack, atexit, > __del__ method, weakref.WeakKeyDictionary or weakref.ref? I read the > documentation, but t

[issue15528] Better support for finalization with weakrefs

2012-08-04 Thread Richard Oudkerk
Richard Oudkerk added the comment: > For point 1: global weakref.WeakKeyDictionary is good store for weak refs > with > callbacks. > > global weakdict > weakdict[kenny] = weakref.ref(kenny, lambda _: print("you killed kenny!")) That depends on kenny being hasha

[issue15528] Better support for finalization with weakrefs

2012-08-05 Thread Richard Oudkerk
Richard Oudkerk added the comment: Updated patch. get() and put() replaced by peek() and detach(). Added isalive(). Now finalizer class has no state, i.e. __slots__ == (). -- Added file: http://bugs.python.org/file26701/finalize.patch ___ Python

[issue15528] Better support for finalization with weakrefs

2012-08-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: > In _make_callback, I still think the default error reporting mechanism > should be kept. It can be improved separately. New patch. This time I have got rid of _make_callback, and just given __call__ an ignored optional argument. -- Adde

[issue15528] Better support for finalization with weakrefs

2012-08-11 Thread Richard Oudkerk
Richard Oudkerk added the comment: > In the latest patch, what are "broken" and "priority" for? They are for a subclass used by multiprocessing. But it is premature to worry about subclassing, so I will take them out. > Also, I would question why atexit is false b

[issue15629] Run doctests in Doc/*.rst as part of regrtest

2012-08-12 Thread Richard Oudkerk
Richard Oudkerk added the comment: Might it be simpler to run doctest over the rst file from the relevant unittest? (Perhaps with help from test.support.) -- nosy: +sbt ___ Python tracker <http://bugs.python.org/issue15

[issue15629] Run doctests in Doc/*.rst as part of regrtest

2012-08-12 Thread Richard Oudkerk
Richard Oudkerk added the comment: > the occasional typos can be found by simply run `make doctest` every once > in a while). But doesn't "make doctest" attempt to run the doctests using Python 2.x (because Sphinx does n

[issue15629] Run doctests in Doc/*.rst as part of regrtest

2012-08-12 Thread Richard Oudkerk
Richard Oudkerk added the comment: An example from the output of "make doctest" which fails because Python 2.x is being used: ** File "library/multiprocessing.rst", line 453, in default Failed example:

<    1   2   3   4   5   6   7   8   >