-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize ob_type for class type objects early
When creating classes, the `ob_type` field of the class's `PyTypeObject` is statically initialized to `NULL`, and then becomes dynamically initialized to `&PyType_Type` when `PyType_Ready()` is called. This is too late. If GC occurs during the initialization of the class before `PyType_Ready()` is called, then the garbage collector will encounter the `NULL` `ob_type` and segfault. The Python docs say this field should be dynamically initialized to `&PyType_Type` before doing any more class initialization.
- Loading branch information
Showing
3 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters