RFC: Proposal: Deterministic Object Destruction

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Mar 4 08:58:46 EST 2018


On 2018年3月04日 04:37:46 -0800, Ooomzay wrote:
> On Sunday, 4 March 2018 04:23:07 UTC, Steven D'Aprano wrote:
>> [...]
>> [This PEP] imposes enormous burdens on the maintainers of at least five
>> interpreters (CPython, Stackless, Jython, IronPython, PyPy) all of
>> which will need to be re-written to have RAII semantics guaranteed;
>> Not so:- CPython, the reference interpreter, already implements the
> required behaviour, as mentioned in the PEP.

Except that it doesn't. From the docs:
"It is not guaranteed that __del__() methods are called for objects that 
still exist when the interpreter exits."
https://docs.python.org/3/reference/datamodel.html#object.__del__
That limitation of CPython is much reduced now compared to older 
versions, but there are still circumstances where the __del__ method 
cannot be called.
-- 
Steve


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /