A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-January/107700.html below:

[Python-Dev] r88178 - python/branches/py3k/Lib/test/crashers/underlying_dict.py

[Python-Dev] r88178 - python/branches/py3k/Lib/test/crashers/underlying_dict.py [Python-Dev] r88178 - python/branches/py3k/Lib/test/crashers/underlying_dict.pyAndreas Stührk andy-python at hammerhartes.de
Wed Jan 26 22:09:15 CET 2011
> I gets to a dict of class circumventing dictproxy. It's yet unclear
> why it segfaults.

The crash as well as the output "1" are both caused because updating
the class dictionary directly doesn't invalidate the method cache.
When the new value for "f" is assigned to the dict, the old "f" gets
garbage collected (because the method cache uses borrowed references),
but there is still an entry in the cache for the (now
garbage-collected) function. When "a.f" is executed next, the entry of
the cache is used and a new method is created. When that method gets
called, it returns "1" and when the interpreter tries to garbage
collect the new method on interpreter finalization, it segfaults
because the referenced "f" is already collected.

Regards,
Andreas
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4