Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix stack overflow when partially-__init__ Node raises exception. (ap…
…ache#7481) * Fix stack overflow when partially-__init__ Node raises exception. * If a Node subclass raises an exception and ctypes is in use before __init_handle_by_constructor__ is called (or self.handle is otherwise set), a Python stack overflow could result. This is because the unset handle slot causes self.handle accesses to fallback on the getattr(self, 'handle') method, invoking NodeGetAttr. * Then I believe this causes an infinite loop. * The fix is to make Node.__getattr__ raise AttributeError for all attributes in __slots__, then make __del__ tolerant to missing self.handle. * I don't believe cython is affected because it implements a descriptor to access its underlying chandle and that shouldn't be unset. * black format * actually use handle instead of self.handle
- Loading branch information