[issue40857] tempfile.TemporaryDirectory() context manager can fail to propagate exceptions generated within its context

2020-06-03 Thread Tim Reid
New submission from Tim Reid : When an exception occurs within a tempfile.TemporaryDirectory() context and the directory cleanup fails, the _cleanup exception_ is propagated, not the original one. This effectively 'masks' the original exception, and makes it impossible to catch usin

[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2018-07-04 Thread Reid
Reid added the comment: I concur with rutsky. Complex numbers are essential in the physical sciences, and the complex type is part of the c99 standard. Trying to shoehorn complex support by a user-defined type makes use of the builtin methods for the standard complex type clunky

[issue21726] Unnecessary line in documentation

2014-06-11 Thread Reid Price
New submission from Reid Price: https://docs.python.org/2/distutils/examples.html#pure-python-distribution-by-package Chrome on Linux The last (parenthetical) sentence is not needed. "(Again, the empty string in package_dir stands for the current directory.)" because t

[issue14591] Value returned by random.random() out of valid range

2012-04-16 Thread Dave Reid
New submission from Dave Reid : A particular combination of seed and jumpahead calls seems to force the MT generator into a state where it produces a random variate that is outside the range 0-1. Problem looks like it might be in _randommodule.c:genrand_int32, which produces a value

[issue11757] test_subprocess.test_communicate_timeout_large_ouput failure on select(): negative timeout?

2011-04-10 Thread Reid Kleckner
Reid Kleckner added the comment: I think the best behavior would be to go ahead and check one last time before raising the exception, so _remaining_time should turn a negative value into 0 (assuming that a timeout value of zero does the right thing for our use case). If people don't

[issue5673] Add timeout option to subprocess.Popen

2011-04-10 Thread Reid Kleckner
Reid Kleckner added the comment: Thanks for fixing the negative timeout issue. I assumed incorrectly that a negative timeout would cause it to check and return immediately if it would otherwise block. As for the docs, the 3.2/3.3 issue was fixed in [[72e49cb7fcf5]]. I just added a Misc

[issue11613] test_subprocess fails under Windows

2011-03-21 Thread Reid Kleckner
Reid Kleckner added the comment: The bot is green again as of ab2363f89058. Thanks for the heads up. -- status: open -> closed ___ Python tracker <http://bugs.python.org/issu

[issue11613] test_subprocess fails under Windows

2011-03-20 Thread Reid Kleckner
Reid Kleckner added the comment: It is necessary, WaitForSingleObject takes its argument in milliseconds. It will make the exception message wrong, though, which I can fix. Reid On Sun, Mar 20, 2011 at 1:46 PM, Santoso Wijaya wrote: > > Santoso Wijaya added the comment: > >

[issue11504] test_subprocess failure

2011-03-16 Thread Reid Kleckner
Reid Kleckner added the comment: :( Thanks for spotting these. Is there an easier way for me to be notified if these particular tests fail? Some of these are not in the "stable" builder set. Sorry to leave the builders broken for so long. I just upped the timeouts to 3 seconds

[issue11504] test_subprocess failure

2011-03-14 Thread Reid Kleckner
Reid Kleckner added the comment: I increased the timeout in [fd2b3eac6756] and the buildbot is passing now: http://python.org/dev/buildbot/all/builders/x86%20debian%20parallel%203.x -- status: open -> closed ___ Python tracker &l

[issue11504] test_subprocess failure

2011-03-14 Thread Reid Kleckner
Reid Kleckner added the comment: I can't reproduce this. I've tested on: 64-bit Linux (Debian lenny) OS X 10.6 Windows Vista 32-bit It seems reasonable to me that the interpreter should be able to initialize and write to stdout in less than half a second, but it seems to

[issue5673] Add timeout option to subprocess.Popen

2011-03-14 Thread Reid Kleckner
Changes by Reid Kleckner : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue5673> ___ ___ Python-bugs-list mailing list Unsubscri

[issue5673] Add timeout option to subprocess.Popen

2011-03-14 Thread Reid Kleckner
Reid Kleckner added the comment: On Mon, Mar 14, 2011 at 12:31 PM, Sridhar Ratnakumar wrote: > > Sridhar Ratnakumar added the comment: > > On 2011-03-14, at 9:18 AM, Reid Kleckner wrote: > >> I updated and committed the patch to the cpython hg repo in revision >&g

[issue5673] Add timeout option to subprocess.Popen

2011-03-14 Thread Reid Kleckner
Reid Kleckner added the comment: I updated and committed the patch to the cpython hg repo in revision [c4a0fa6e687c]. -- ___ Python tracker <http://bugs.python.org/issue5

[issue9742] Python 2.7: math module fails to build on Solaris 9

2011-01-10 Thread Reid Madsen
Reid Madsen added the comment: Python support, This issue with not being able to build on Solaris 9 is easily fixed. I have attached a patch with the fix for Python 2.7. When linking with libpython-2.7.a, the linker will only extract modules that satisfy dependencies emanating from

[issue5673] Add timeout option to subprocess.Popen

2011-01-06 Thread Reid Kleckner
Reid Kleckner added the comment: Pablo, so if I understand the issue you've run into correctly, you are using shell redirection to redirect stdout to a file, and then attempting to read from it using stdout=subprocess.PIPE. It seems to me like this behavior is expected, because the

[issue1054041] Python doesn't exit with proper resultcode on SIGINT

2011-01-06 Thread Reid Kleckner
Reid Kleckner added the comment: Looks good to me. Do you need the TODO(gps)'s in there after implementing the behavior described? -- ___ Python tracker <http://bugs.python.org/issu

[issue5673] Add timeout option to subprocess.Popen

2010-09-20 Thread Reid Kleckner
Reid Kleckner added the comment: No, sorry, I just haven't gotten around to reproducing it on Linux. And I've even needed this functionality in the mean time, and we worked around it with the standard alarm trick! =/ -- ___ Python trac

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-08-14 Thread Reid Kleckner
Reid Kleckner added the comment: Added a patch that adds support for recomputing the timeout, plus a test for it. Can this still make it into 3.2, or is it too disruptive at this point in the release process? -- Added file: http://bugs.python.org/file18536/lock-interrupt-v4.diff

[issue5673] Add timeout option to subprocess.Popen

2010-07-23 Thread Reid Kleckner
Reid Kleckner added the comment: On Thu, Jul 22, 2010 at 9:05 AM, Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > The documentation should mention somewhere that timeout can be a float.  For > example, as in time.sleep docstring: > > &

[issue9079] Make gettimeofday available in time module

2010-07-21 Thread Reid Kleckner
Reid Kleckner added the comment: I think you used 'struct timeval *' in the function definition instead of '_PyTimeVal *'. -- ___ Python tracker <http://bu

[issue9079] Make gettimeofday available in time module

2010-07-21 Thread Reid Kleckner
Reid Kleckner added the comment: pytime.h looks like it got pasted into the file twice. Other than that, it looks good to me and the tests pass on OS X here. -- ___ Python tracker <http://bugs.python.org/issue9

[issue5673] Add timeout option to subprocess.Popen

2010-07-21 Thread Reid Kleckner
Reid Kleckner added the comment: When I ported the patch I tested on trunk + Windows to py3k, I messed that stuff up. I also had to fix a bunch of str vs. bytes issues this time around. On Windows, it uses TextIOWrapper to do the encoding, and on POSIX it uses os.write, so I have to do the

[issue5673] Add timeout option to subprocess.Popen

2010-07-20 Thread Reid Kleckner
Reid Kleckner added the comment: Uh oh, that was one of the fixes I made when I tested it on Windows. I may have failed to pick up those changes when I ported to py3k. I'll check it out tonight. -- ___ Python tracker <http://bugs.py

[issue5872] New C API for declaring Python types

2010-07-18 Thread Reid Kleckner
Changes by Reid Kleckner : -- nosy: +rnk versions: +Python 3.2 -Python 3.1 ___ Python tracker <http://bugs.python.org/issue5872> ___ ___ Python-bugs-list mailin

[issue2927] expose html.parser.unescape

2010-07-18 Thread Reid Kleckner
Reid Kleckner added the comment: It's using the old Python 2 unicode string literal syntax. It also doesn't keep to 80 cols. I'd also rather continue using a lazily initialized dict instead of catching a KeyError for '. I also feel that with the changes to Unicode in py

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-07-18 Thread Reid Kleckner
Reid Kleckner added the comment: Waiting until the portability hacks for gettimeofday make it into core Python. -- dependencies: +Make gettimeofday available in time module ___ Python tracker <http://bugs.python.org/issue8

[issue6642] returning after forking a child thread doesn't call Py_Finalize

2010-07-18 Thread Reid Kleckner
Changes by Reid Kleckner : -- assignee: -> rnk dependencies: +Throw away more radioactive locks that could be held across a fork in threading.py ___ Python tracker <http://bugs.python.org/iss

[issue6643] Throw away more radioactive locks that could be held across a fork in threading.py

2010-07-18 Thread Reid Kleckner
Changes by Reid Kleckner : -- assignee: -> rnk keywords: +needs review -patch ___ Python tracker <http://bugs.python.org/issue6643> ___ ___ Python-bugs-lis

[issue9079] Make gettimeofday available in time module

2010-07-17 Thread Reid Kleckner
Reid Kleckner added the comment: I think you forgot to svn add pytime.c before making the diff. -- ___ Python tracker <http://bugs.python.org/issue9079> ___ ___

[issue5673] Add timeout option to subprocess.Popen

2010-07-17 Thread Reid Kleckner
Reid Kleckner added the comment: I don't imagine this is going into 2.7.>0 at this point, so I ported the patch to py3k. I also added support to check_output for the timeout parameter and added docs for all of the methods/functions that now take a timeout in the module. The com

[issue9079] Make gettimeofday available in time module

2010-07-16 Thread Reid Kleckner
Reid Kleckner added the comment: I'd really rather not try to rely module loading from a threading primitive. :) I think if you follow Antoine's suggestion of adding _PyTime_Init (which does nothing in the body other than a comment) it should

[issue9079] Make gettimeofday available in time module

2010-07-16 Thread Reid Kleckner
Reid Kleckner added the comment: Right, it's one of the peculiarities of archive files (I think). When none of an object file's symbols are used from the main program, the object file is dropped on the floor, ie not included. This has bizarre consequences in C++ with static in

[issue5673] Add timeout option to subprocess.Popen

2010-07-16 Thread Reid Kleckner
Reid Kleckner added the comment: I forgot that I had to tweak the test as well as subprocess.py. I did a .replace('\r', ''), but universal newlines is better. Looking at the open questions I had about the Windows threads, I think it'll be OK if the user fol

[issue6033] LOOKUP_METHOD and CALL_METHOD optimization

2010-07-14 Thread Reid Kleckner
Reid Kleckner added the comment: Sorry, I was just posting it so Benjamin could see what this bought us. I'm not pushing to get this in CPython. The results are for JITed code. I forget what the interpreted results are. I think they are good for the microbenchmarks, but not as goo

[issue5673] Add timeout option to subprocess.Popen

2010-07-13 Thread Reid Kleckner
Reid Kleckner added the comment: I went through the trouble of building and testing Python on Windows Vista, and with some small modifications I got the tests I added to pass. Here's an updated patch. I'm still not really sure how those threads work on Windows, so I'd rather

[issue6033] LOOKUP_METHOD and CALL_METHOD optimization

2010-07-13 Thread Reid Kleckner
Reid Kleckner added the comment: I have an patch for unladen-swallow out for review here: http://codereview.appspot.com/160063/show It resolves the correctness issues I mentioned previously by emitting guards if necessary. If the type is predictable and uses slots, then we don't ne

[issue9079] Make gettimeofday available in time module

2010-07-12 Thread Reid Kleckner
Reid Kleckner added the comment: The patch looks good to me FWIW. I would be interested in using this perhaps in issue8844, which involves lock timeouts. It may be true that the POSIX API uses nanoseconds, but pythreads only exposes microsecond precision. In order to use it from the thread

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-07-12 Thread Reid Kleckner
Reid Kleckner added the comment: Alternatively, do you think it would be better to ignore interrupts when a timeout is passed? If a timeout is passed, the lock acquire will eventually fail in a deadlock situation, and the signal will be handled in the eval loop. However, if the timeout is

[issue6643] Throw away more radioactive locks that could be held across a fork in threading.py

2010-07-12 Thread Reid Kleckner
Reid Kleckner added the comment: I completely agree, but the cat is out of the bag on this one. I don't see how we could get rid of fork until Py4K, and even then I'm sure there will be people who don't want to see it go, and I'd rather not spend my time arguing t

[issue6643] Throw away more radioactive locks that could be held across a fork in threading.py

2010-07-11 Thread Reid Kleckner
Changes by Reid Kleckner : -- title: joining a child that forks can deadlock in the forked child process -> Throw away more radioactive locks that could be held across a fork in threading.py ___ Python tracker <http://bugs.python.org/iss

[issue7576] Avoid warnings in PyModuleDef_HEAD_INIT

2010-07-11 Thread Reid Kleckner
Reid Kleckner added the comment: This patch looks good to me, after digging through the relevant module code. I was confused though for a bit as to why PyModuleDef is a PyObject with a NULL type. It turns out that import.c wants to keep them in a dictionary, so it needs to be able to cast

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-07-10 Thread Reid Kleckner
Reid Kleckner added the comment: Also, thanks for the quick reviews! -- ___ Python tracker <http://bugs.python.org/issue8844> ___ ___ Python-bugs-list mailin

[issue6643] joining a child that forks can deadlock in the forked child process

2010-07-10 Thread Reid Kleckner
Reid Kleckner added the comment: I realized that in a later fix for unladen-swallow, we also cleared the condition variable waiters list, since it has radioactive synchronization primitives in it as well. Here's an updated patch that simplifies the fix by just using __init__() to compl

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-07-10 Thread Reid Kleckner
Reid Kleckner added the comment: Oops, copy/paste oversight. =/ I wrote a test to verify that it handles signals, and then retries the lock acquire. -- Added file: http://bugs.python.org/file17935/lock-interrupt.diff ___ Python tracker <h

[issue6643] joining a child that forks can deadlock in the forked child process

2010-07-10 Thread Reid Kleckner
Reid Kleckner added the comment: Here's an updated patch for py3k (3.2). The test still fails without the fix, and passes with the fix. Thinking more about this, I'll try summarizing the bug more coherently: When the main thread joins the child threads, it acquires some locks.

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-07-10 Thread Reid Kleckner
Reid Kleckner added the comment: Here is a new version of a patch that updates recursive locks to have the same behavior. The pure Python RLock implementaiton should be interruptible by virtue of the base lock acquire primitive being interruptible. I've also updated the rel

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-07-10 Thread Reid Kleckner
Reid Kleckner added the comment: Here's a patch that makes Python-level lock acquisitions interruptible for py3k. There are many users of the C-level lock API, most of whom are not set up to deal with lock acquisition failure. I decided to make a new API function and leave the others

[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-05-28 Thread Reid Kleckner
Reid Kleckner added the comment: I'd like to fix it, but I don't know if I'll be able to in time. It was something that bugged me while running the threading tests while working on Unladen. I'm imagining (for POSIX platforms) adding some kind of check for signals w

[issue5673] Add timeout option to subprocess.Popen

2010-02-01 Thread Reid Kleckner
Reid Kleckner added the comment: > - why do you say Thread.join() uses a busy loop? is it because it uses > Condition.wait()? If so, this will be solved in py3k by issue7316 (which you > are welcome to review). Otherwise, I think there should be an upper bound on >

[issue6033] LOOKUP_METHOD and CALL_METHOD optimization

2009-11-24 Thread Reid Kleckner
Reid Kleckner added the comment: One thing I was wondering about the current patch is what about objects that have attributes that shadow methods? For example: class C(object): def foo(self): return 1 c = c() print c.foo() c.foo = lambda: 2 print c.foo() Shouldn't the above

[issue6033] LOOKUP_METHOD and CALL_METHOD optimization

2009-11-24 Thread Reid Kleckner
Changes by Reid Kleckner : -- nosy: +rnk ___ Python tracker <http://bugs.python.org/issue6033> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue1068268] subprocess is not EINTR-safe

2009-10-12 Thread Reid Kleckner
Changes by Reid Kleckner : -- nosy: +rnk ___ Python tracker <http://bugs.python.org/issue1068268> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue6800] os.exec* raises "OSError: [Errno 45] Operation not supported" in a multithreaded application

2009-08-28 Thread Reid Kleckner
Reid Kleckner added the comment: Supposedly this bug also affects FreeBSD, but I can't verify it. I'd say the problem isn't going away, at least not for that platform, but I don't feel like it's worth bending over backwards to deal with it either. As far as it concer

[issue6800] os.exec* raises "OSError: [Errno 45] Operation not supported" in a multithreaded application

2009-08-28 Thread Reid Kleckner
New submission from Reid Kleckner : The test case is attached. On Mac OS X (and presumably FreeBSD, which has the same behavior) when you try to exec from a process that has any other threads in it, you get an OSError, "Operation not supported". Here's the output on my MacB

[issue6642] returning after forking a child thread doesn't call Py_Finalize

2009-08-04 Thread Reid Kleckner
Reid Kleckner added the comment: Here's a patch against 2.6 for one way to fix it. I imagine it has problems, but I wanted to throw it out there as a straw man. This patch builds on the patch for http://bugs.python.org/issue6643 since some of the test cases will occasionally deadlock wi

[issue6643] joining a child that forks can deadlock in the forked child process

2009-08-04 Thread Reid Kleckner
Reid Kleckner added the comment: Here's a patch for 3.2 which adds the fix and a test case. I also verified that the problem exists in 3.1, 2.7, and 2.6 and backported the patch to those versions, but someone should review this one before I upload those. -- keywords: +patch ver

[issue6642] returning after forking a child thread doesn't call Py_Finalize

2009-08-04 Thread Reid Kleckner
Changes by Reid Kleckner : -- versions: +Python 2.6 -Python 3.2 ___ Python tracker <http://bugs.python.org/issue6642> ___ ___ Python-bugs-list mailing list Unsub

[issue6643] joining a child that forks can deadlock in the forked child process

2009-08-04 Thread Reid Kleckner
New submission from Reid Kleckner : This bug is similar to the importlock deadlock, and it's really part of a larger problem that you should release all locks before you fork. However, we can fix this in the threading module directly by freeing and resetting the locks on the main thread af

[issue6642] returning after forking a child thread doesn't call Py_Finalize

2009-08-04 Thread Reid Kleckner
New submission from Reid Kleckner : I attached a test case to reproduce. Here is what it does: - The main thread in the parent process starts a new thread and waits for it. - The child thread forks. - The child process creates a daemon thread, and returns. - The parent process (in the thread

[issue5673] Add timeout option to subprocess.Popen

2009-04-02 Thread Reid Kleckner
Reid Kleckner added the comment: I'd like some feedback on this patch. Is the API acceptable? Would it be better to throw an exception in wait() instead of returning None? What should communicate() return if it times out? I can't decide if it should try to return partial outp

[issue5673] Add timeout option to subprocess.Popen

2009-04-02 Thread Reid Kleckner
Reid Kleckner added the comment: Ugh. I made the assumption that there must be some natural and easy way to wait for a child process with a timeout in C, and it turns out it's actually a hard problem, which is why this isn't already implemented. So my initial hack for solving this

[issue5673] Add timeout option to subprocess.Popen

2009-04-02 Thread Reid Kleckner
New submission from Reid Kleckner : I was looking for a way to run a subprocess with a timeout. While there are a variety of solutions on Google, I feel like this functionality should live in the standard library module. Apparently Guido thought this would be good in 2005 but no one did it

[issue1368312] fix for scheme identification in urllib2?

2008-05-04 Thread david reid
david reid <[EMAIL PROTECTED]> added the comment: I've run into this as an issue with a server that replies with both digest and basic auth. When parsing the keys in the header it's possible to detect the start of a different auth method, so I'd suggest parsing the www-

[issue2756] urllib2 add_header fails with existing unredirected_header

2008-05-04 Thread david reid
New submission from david reid <[EMAIL PROTECTED]>: In urllib2 when using reusing a Request calling add_header doesn't work when an unredirected_header has been added. A good example (and the one that caught me out) is content-type. When making a POST request with no content-t

[issue2695] Ignore case when checking algorithm in urllib2

2008-05-04 Thread david reid
david reid <[EMAIL PROTECTED]> added the comment: Looks like a sensible, simple fix to me :-) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2695> __ __

[issue2695] Ignore case when checking algorithm in urllib2

2008-05-02 Thread david reid
david reid <[EMAIL PROTECTED]> added the comment: The patch is inline. There's not much to it :-) Agree with your suggestion to avoid calling lower() twice. __ Tracker <[EMAIL PROTECTED]> <http://bugs.

[issue2695] Ignore case when checking algorithm in urllib2

2008-04-26 Thread david reid
New submission from david reid <[EMAIL PROTECTED]>: Small change to allow get_algorithm_impls to correctly detect when lower case algorithm strings are passed. I recently ran into a server that sent 'md5' and so this function failed without this small change. def get_algo