Commits

Armin Rigo committed 3cf9d41

Document the limitations of __del__ methods.

Comments (0)

Files changed (2)

pypy/doc/coding-guide.rst

 **objects**
 
   Normal rules apply. Special methods are not honoured, except ``__init__``,
-  ``__del__`` and ``__iter__``.
+  ``__del__`` and ``__iter__``.  The destructor ``__del__`` must only contain
+  `simple operations`__; for any kind of more complex destructor, see
+  ``rpython.rlib.rgc.register_finalizer()``.
+
+.. __: garbage_collection.html
 
 This layout makes the number of types to take care about quite limited.
 
 to mix types in arbitrary ways. RPython does not allow the binding of two
 different types in the same variable. In this respect (and in some others) it
 feels a bit like Java. Other features not allowed in RPython are the use of
-special methods (``__xxx__``) except ``__init__`` and ``__del__``, and the
+special methods (``__xxx__``) except ``__init__`` and ``__del__``
+(see `garbage collection`__), and the
 use of reflection capabilities (e.g. ``__dict__``).
 
+.. __: garbage_collection.html
+
 You cannot use most existing standard library modules from RPython.  The
 exceptions are
 some functions in ``os``, ``math`` and ``time`` that have native support.