[pypy-commit] pypy py3.5: officialize a CPython difference
arigo
pypy.commits at gmail.com
Sun Jan 15 05:28:41 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89577:b7305d7e2e07
Date: 2017-01-15 11:26 +0100
http://bitbucket.org/pypy/pypy/changeset/b7305d7e2e07/
Log: officialize a CPython difference
diff --git a/lib-python/3/test/test_finalization.py b/lib-python/3/test/test_finalization.py
--- a/lib-python/3/test/test_finalization.py
+++ b/lib-python/3/test/test_finalization.py
@@ -171,7 +171,12 @@
gc.collect()
self.assert_del_calls(ids)
self.assert_survivors(ids)
- self.assertIsNot(wr(), None)
+ if support.check_impl_detail():
+ # CPython >= 3.4 changed this, but not in all cases
+ # (see the similar test in SelfCycleFinalizationTest).
+ # PyPy cannot tell apart the two cases, so we picked the
+ # cycle behavior, as it is the historical one.
+ self.assertIsNot(wr(), None)
self.clear_survivors()
gc.collect()
self.assert_del_calls(ids)
diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst
--- a/pypy/doc/cpython_differences.rst
+++ b/pypy/doc/cpython_differences.rst
@@ -166,6 +166,13 @@
.. __: https://docs.python.org/2/library/weakref.html
.. __: https://bitbucket.org/pypy/pypy/issue/2030/
+A new difference: before CPython 3.4, a weakref to ``x`` was always
+cleared before the ``x.__del__()`` method was called. Since CPython 3.4
+the picture is more muddy. Often, the weakref is still alive while
+``x.__del__()`` runs, but not always (e.g. not in case of reference
+cycles). In PyPy3 we have kept the more consistent pre-3.4 behavior; we
+can't do something really different if there are cycles or not.
+
---------------------------------
There are a few extra implications from the difference in the GC. Most
More information about the pypy-commit
mailing list