Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r88025:f8b3c91eca76
Date: 2016-11-01 12:33 +0100
http://bitbucket.org/pypy/pypy/changeset/f8b3c91eca76/

Log:    Modules are weakrefable now

diff --git a/pypy/interpreter/test/test_module.py 
b/pypy/interpreter/test/test_module.py
--- a/pypy/interpreter/test/test_module.py
+++ b/pypy/interpreter/test/test_module.py
@@ -188,3 +188,7 @@
         excinfo = raises(AttributeError, 'nameless.does_not_exist')
         assert (excinfo.value.args[0] ==
             "module has no attribute 'does_not_exist'")
+
+    def test_weakrefable(self):
+        import weakref
+        weakref.ref(weakref)
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -632,7 +632,8 @@
     __dir__ = interp2app(Module.descr_module__dir__),
     __reduce__ = interp2app(Module.descr__reduce__),
     __dict__ = GetSetProperty(descr_get_dict, cls=Module), # module 
dictionaries are readonly attributes
-    __doc__ = 'module(name[, doc])\n\nCreate a module object.\nThe name must 
be a string; the optional doc argument can have any type.'
+    __doc__ = 'module(name[, doc])\n\nCreate a module object.\nThe name must 
be a string; the optional doc argument can have any type.',
+    __weakref__ = make_weakref_descr(Module),
     )
 
 getset_func_doc = GetSetProperty(Function.fget_func_doc,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to