[pypy-commit] pypy default: Document that old-style classes can have a __del__ on

Armin Rigo noreply at buildbot.pypy.org
Sun Jun 5 11:14:32 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r44706:f7d6c1b93269
Date: 2011-06-05 10:51 +0200
http://bitbucket.org/pypy/pypy/changeset/f7d6c1b93269/

Log:	Document that old-style classes can have a __del__ on the instance,
	but it may not be called on pypy.

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
@@ -173,6 +173,11 @@
     >>>> A.__del__ = lambda self: None
     __main__:1: RuntimeWarning: a __del__ method added to an existing type will not be called
 
+Even more obscure: the same is true, for old-style classes, if you attach
+the ``__del__`` to an instance (even in CPython this does not work with
+new-style classes).  You get a RuntimeWarning in PyPy.  To fix these cases
+just make sure there is a ``__del__`` method in the class to start with.
+
 
 Subclasses of built-in types
 ----------------------------


More information about the pypy-commit mailing list