Skip to content

Commit

Permalink
Fix initialization order of objc._objc
Browse files Browse the repository at this point in the history
The previous order initialized exception classes after their
first use. This happens to work on older python versions, but
crashes 3.12 by way of a NULL pointer dereference.

Fixes #551
  • Loading branch information
ronaldoussoren committed Apr 28, 2023
1 parent 4719e95 commit 3fa0fbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Version 9.2
backend by default. Add a minimal ``pyproject.toml`` to get a consistent
build regardless of the version of pip

* :issue:`551`: Fix crash in pyobjc-core when using Python 3.12a7.

Version 9.1.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion pyobjc-core/Modules/objc/module.m
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,7 @@ + (void)targetForBecomingMultiThreaded:(id)sender
static setup_function _Nullable setup_functions[] = {
PyObjC_InitProxyRegistry, /* Must be first */

PyObjCUtil_Init,
PyObjCPointerWrapper_Init,
PyObjC_SetupOptions,
PyObjC_setup_nsdecimal,
Expand All @@ -2220,7 +2221,6 @@ + (void)targetForBecomingMultiThreaded:(id)sender
PyObjCMemView_Setup,
PyObjCWeakRef_Setup,
PyObjCMethodAccessor_Setup,
PyObjCUtil_Init,
PyObjCIMP_SetUp,
PyObjC_init_ctests,
PyObjCSelector_Setup,
Expand Down

0 comments on commit 3fa0fbc

Please sign in to comment.