New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setting __class__ in __del__ is bad. mmkay. negative ref count! kaboom! #49533
Comments
I found this bug by misplacing a line of a code. Yes, I was doing class something_else(object):
pass
class foo(object):
def __del__(self):
self.__class__ = something_else
for _ in range(1000):
foo() That results in a fatal python error due to a negative reference 3.0.1 (release30-maint:69593M, Feb 13 2009, 14:48:10) -> kaboom 2.6 (r26:66714, Dec 21 2008, 21:17:32) -> kaboom Fatal Python error: GC object already tracked 2.5.2 (r252:60911, Jun 15 2008, 18:55:39) -> no kaboom (no asserts? eh..) 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) -> kaboom (/usr/bin/python2.5) |
Yes, the wrong type is DECREF'd when the object is deallocated. |
The patch looks correct, but are there more places where the type is |
I carefully looked at all places that store ->ob_type or Py_TYPE() in a Two places were harder to analyze: subtype_clear (but an attack would |
On Wed, Feb 18, 2009 at 4:51 PM, Amaury Forgeot d'Arc
Thanks for looking!
Well, I think we can deal with those if they are reported. Go ahead |
Could the PyObject_ClearWeakRefs(self); call in the middle of the lines (I'm trying to wrap my head around the possibilities here and come up |
Fixed in r71860. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: