]> granicus.if.org Git - python/commitdiff
Make sure we do not core dump when using proxies with the binary slot
authorFred Drake <fdrake@acm.org>
Thu, 18 Oct 2001 18:06:05 +0000 (18:06 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 18 Oct 2001 18:06:05 +0000 (18:06 +0000)
handlers.  This was fixed in Objects/weakrefobject.c 1.2.

Lib/test/test_weakref.py

index 5dfa6ce6573a5020e6adda6b651b86d498484563..5e56717823880597a22f55a408d6218ede180db7 100644 (file)
@@ -216,6 +216,14 @@ class ReferencesTestCase(TestBase):
         self.assert_(weakref.getweakrefs(o) == [ref1],
                      "list of refs does not match")
 
+    def test_newstyle_number_ops(self):
+        class F(float):
+            pass
+        f = F(2.0)
+        p = weakref.proxy(f)
+        self.assert_(p + 1.0 == 3.0)
+        self.assert_(1.0 + p == 3.0)  # this used to SEGV
+
 
 class Object:
     def __init__(self, arg):