summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-03-18 03:09:06 (GMT)
committerGuido van Rossum <guido@python.org>2002-03-18 03:09:06 (GMT)
commit7e30548285226802702dcdf81c267ebeb00ce2a5 (patch)
treeefe43f4314a726aed18b0a4d979bdd1a2842e370 /Lib/test
parentc99475e7a0b97ae736ed9ecf213727c952666ef0 (diff)
downloadcpython-7e30548285226802702dcdf81c267ebeb00ce2a5.zip
cpython-7e30548285226802702dcdf81c267ebeb00ce2a5.tar.gz
cpython-7e30548285226802702dcdf81c267ebeb00ce2a5.tar.bz2
Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfault
The proper fix is not quite what was submitted; it's really better to take the class of the object passed rather than calling PyMethod_New with NULL pointer args, because that can then cause other core dumps later. I also added a testcase for the fix to classmethods() in test_descr.py. I've already applied this to the 2.2 branch.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_descr.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 1188e1d..ce28cce 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1208,6 +1208,11 @@ def classmethods():
vereq(d.goo(1), (D, 1))
vereq(d.foo(1), (d, 1))
vereq(D.foo(d, 1), (d, 1))
+ # Test for a specific crash (SF bug 528132)
+ def f(cls, arg): return (cls, arg)
+ ff = classmethod(f)
+ vereq(ff.__get__(0, int)(42), (int, 42))
+ vereq(ff.__get__(0)(42), (int, 42))
def staticmethods():
if verbose: print "Testing static methods..."