+++ /dev/null
-"""\r
-The gc module can still invoke arbitrary Python code and crash.\r
-This is an attack against _PyInstance_Lookup(), which is documented\r
-as follows:\r
-\r
- The point of this routine is that it never calls arbitrary Python\r
- code, so is always "safe": all it does is dict lookups.\r
-\r
-But of course dict lookups can call arbitrary Python code.\r
-The following code causes mutation of the object graph during\r
-the call to has_finalizer() in gcmodule.c, and that might\r
-segfault.\r
-"""\r
-\r
-import gc\r
-\r
-\r
-class A:\r
- def __hash__(self):\r
- return hash("__del__")\r
- def __eq__(self, other):\r
- del self.other\r
- return False\r
-\r
-a = A()\r
-b = A()\r
-\r
-a.__dict__[b] = 'A'\r
-\r
-a.other = b\r
-b.other = a\r
-\r
-gc.collect()\r
-del a, b\r
-\r
-gc.collect()\r