[issue7242] Forking in a thread raises RuntimeError
Greg Jednaszewski added the comment: I spent some time working on and testing a unit test as well. It's the same basic idea as Zsolt Cserna's, but with a slightly different approach. See 7242_unittest.diff. My unittest fails pre-patch and succeeds post-patch. However, I still have reservations about the patch. The existing test test_threading.ThreadJoinOnShutdown.test_3_join_in_forked_from_thread hangs with the patch in place. Vanilla 2.6.2 - test passes Vanilla 2.6.4 - test fails Patched 2.6.4 - test hangs Note: the code of the test_threading test is identical in all 3 cases. I'd feel more confident about the patch if this test didn't hang with the patch in place. -- Added file: http://bugs.python.org/file16381/7242_unittest.diff ___ Python tracker <http://bugs.python.org/issue7242> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7242] Forking in a thread raises RuntimeError
Greg Jednaszewski added the comment: The problem only seems to appear on Solaris 9 and earlier. I'll try to test the updated patch tonight or tomorrow and let you know what I find. -- ___ Python tracker <http://bugs.python.org/issue7242> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7242] Forking in a thread raises RuntimeError
Greg Jednaszewski added the comment: I tested the updated patch, and the new unit test passes on my Sol 8 sparc, but the test_threading test still hangs on my system. However, given that the test is skipped on several platforms and it does work on more relevant versions of Solaris, it's probably OK. It's possible that an OS bug is causing that particular hang. Plus, the original patch fixed the 'real world' scenario I was running into, so I'd like to see it get into the release candidate if you're OK with it. -- ___ Python tracker <http://bugs.python.org/issue7242> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8134] collections.defaultdict gives KeyError with format()
New submission from Greg Jednaszewski : Found on 2.6.2 and 2.6.4: I expect that printing an uninitialized variable from a defaultdict should work. In fact it does with old-style string formatting. However, when you try to do it with new-style string formatting, it raises a KeyError. >>> import collections >>> d = collections.defaultdict(int) >>> "{foo}".format(d) Traceback (most recent call last): File "", line 1, in KeyError: 'foo' >>> "%(foo)d" % d '0' -- components: Library (Lib) messages: 101025 nosy: jednaszewski severity: normal status: open title: collections.defaultdict gives KeyError with format() type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue8134> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8134] collections.defaultdict gives KeyError with format()
Greg Jednaszewski added the comment: Oops, thanks. I should have known that. However, should this work? This is what initially led me to file this ticket. My initial example was a bad one. >>> from collections import defaultdict >>> d = defaultdict(int) >>> d['bar'] += 1 >>> "{bar}".format(**d) '1' >>> "{foo}".format(**d) Traceback (most recent call last): File "", line 1, in KeyError: 'foo' -- ___ Python tracker <http://bugs.python.org/issue8134> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com