[issue16997] subtests

2013-02-11 Thread Andrew Bennetts
Andrew Bennetts added the comment: googletest (an xUnit style C++ test framework) has an interesting feature: in addition to assertions like ASSERT_EQ(x, y) that stop the test, it has EXPECT_EQ(x, y) etc that will cause the test to fail without causing it to stop. I think this decoupling

[issue7897] Support parametrized tests in unittest

2011-07-21 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: You may be interested an existing, unittest-compatible library that provides this: http://pypi.python.org/pypi/testscenarios -- nosy: +spiv ___ Python tracker rep...@bugs.python.org http

[issue9729] Unconnected SSLSocket.{send, recv} raises TypeError: 'member_descriptor' object is not callable

2010-09-14 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Here's a conservative fix for Python 2.7. It replaces the attempts to call baseclass.method with direct calls to the decorated object (i.e. replace socket.meth(self, ...) with self._sock.meth(...)). It also corrects a bunch

[issue9729] Unconnected SSLSocket.{send, recv} raises TypeError: 'member_descriptor' object is not callable

2010-08-31 Thread Andrew Bennetts
New submission from Andrew Bennetts s...@users.sourceforge.net: ython 2.6.6 (r266:84292, Aug 24 2010, 21:47:18) [GCC 4.4.5 20100816 (prerelease)] on linux2 Type help, copyright, credits or license for more information. import socket, ssl s = socket.socket() wrapped = ssl.wrap_socket(s

[issue9729] Unconnected SSLSocket.{send, recv} raises TypeError: 'member_descriptor' object is not callable

2010-08-31 Thread Andrew Bennetts
Changes by Andrew Bennetts s...@users.sourceforge.net: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9729 ___ ___ Python-bugs

[issue9543] 2.6.6 rc1 socket.py flush() calls del on unbound 'view' variable

2010-08-09 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: I have a reproduction script on the Ubuntu bug report I just filed for this issue: https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/615240 Pasting here for convenience: import socket import threading sock_a, sock_b

[issue8685] set(range(100000)).difference(set()) is slow

2010-08-09 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: On 2010-05-17 rhettinger wrote: Will look at this when I get back to the U.S. Ping! This patch (set-difference-speedup-2.diff) has been sitting around for a fair few weeks now. It's a small patch, so it should be relatively easy

[issue9543] 2.6.6 rc1 socket.py flush() calls del on unbound 'view' variable

2010-08-09 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Chatting with Taggnostr on IRC I've trimmed that reproduction down to something much cleaner (no magic numbers or threads involved): import socket sock_a, sock_b = socket.socketpair() sock_a = socket.socket(_sock=sock_a

[issue8685] set(range(100000)).difference(set()) is slow

2010-08-09 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Alexander: yes, they are complementary. My patch improves set.difference, which always creates a new set. issue8425 on the other hand improves in-place difference (via the -= operator or set.difference_update). Looking at the two

[issue8685] set(range(100000)).difference(set()) is slow

2010-05-16 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Antoine: Thanks for the updated benchmark results! I should have done that myself earlier. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8685

[issue8685] set(range(100000)).difference(set()) is slow

2010-05-12 Thread Andrew Bennetts
Changes by Andrew Bennetts s...@users.sourceforge.net: Added file: http://bugs.python.org/file17306/set-mem.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8685

[issue8685] set(range(100000)).difference(set()) is slow

2010-05-12 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Regarding memory, good question... but this patch turns out to be an improvement there too. This optimisation only applies when len(x) len(y) * 4. So the minimum size of the result is a set with 3/4 of the elems of x

[issue8685] set(range(100000)).difference(set()) is slow

2010-05-11 Thread Andrew Bennetts
New submission from Andrew Bennetts s...@users.sourceforge.net: set.difference(s), when s is also a set, basically does:: res = set() for elem in self: if elem not in other: res.add(elem) This is wasteful when len(self) is much greater than len(other): $ python -m

[issue8685] set(range(100000)).difference(set()) is slow

2010-05-11 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Oops, obvious bug in this patch. set('abc') - set('bcd') != set('bcd') - set('abc'). I'll see if I can make a more sensible improvement. See also http://bugs.python.org/issue8425. Thanks dickinsm on #python-dev

[issue8685] set(range(100000)).difference(set()) is slow

2010-05-11 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Ok, this time test_set* passes :) Currently if you have large set and small set the code will do len(large) lookups in the small set. When large is than small, it is cheaper to copy large and do len(small) lookups in large

[issue8354] siginterrupt with flag=False is reset when signal received

2010-04-15 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Your patches look good to me. (They don't fix platforms without sigaction, but as you say they probably don't have siginterrupt, and even if they do they will still have an unfixable race.) What's the next step? I can't see

[issue8354] siginterrupt with flag=False is reset when signal received

2010-04-15 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Are there any platforms that define HAVE_SIGINTERRUPT but that do not define HAVE_SIGACTION? If there are, then yes I expect they would fail that test. It would be a shame to delay this fix just because it doesn't fix all

[issue8354] siginterrupt with flag=False is reset when signal received

2010-04-15 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: FWIW, comparing the change history sections of http://www.opengroup.org/onlinepubs/95399/functions/siginterrupt.html and http://www.opengroup.org/onlinepubs/95399/functions/sigaction.html suggests that sigaction predates

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

2010-04-15 Thread Andrew Bennetts
Changes by Andrew Bennetts s...@users.sourceforge.net: -- nosy: +spiv ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8407 ___ ___ Python-bugs-list

[issue8354] siginterrupt with flag=False is reset when signal received

2010-04-15 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: I'm not exactly sure how we will know if it is expected to fail, though. I don't think `HAVE_SIGACTION` is exposed nicely to Python right now. It might be useful to have the contents of pyconfig.h exposed as a dict somehow

[issue8354] siginterrupt with flag=False is reset when signal received

2010-04-09 Thread Andrew Bennetts
New submission from Andrew Bennetts s...@users.sourceforge.net: The effect of signal.siginterrupt(somesig, False) is reset the first time a that signal is received. This is not the documented behaviour, and I do not think this is a desireable behaviour. It renders siginterrupt effectively

[issue7978] SocketServer doesn't handle syscall interruption

2010-04-09 Thread Andrew Bennetts
Andrew Bennetts s...@users.sourceforge.net added the comment: Note that a trivial untilConcludes isn't correct for select if a timeout was passed. If a select(..., 60) was interrupted after 59 seconds, you probably want to restart it with a timeout of 1 second, not 60

[issue5660] Cannot deepcopy unittest.TestCase instances

2009-04-01 Thread Andrew Bennetts
New submission from Andrew Bennetts s...@users.sourceforge.net: Here's a demonstration of the bug: from unittest import TestCase class MyTest(TestCase): ... def test_foo(self): pass ... tc = MyTest('test_foo') import copy copy.deepcopy(tc) Traceback (most recent call last): File

[issue4753] Faster opcode dispatch on gcc

2009-01-11 Thread Andrew Bennetts
Changes by Andrew Bennetts s...@users.sourceforge.net: -- nosy: +spiv ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4753 ___ ___ Python-bugs-list

[issue3867] What's New in 2.6 doesn't mention stricter object.__init__

2008-09-14 Thread Andrew Bennetts
New submission from Andrew Bennetts [EMAIL PROTECTED]: http://bugs.python.org/issue1683368 changed object.__init__ so that rejects args/kwargs. This change should be mentioned in the What's New in Python 2.6 document, probably under the Porting to Python 2.6 heading. (I noticed this because