-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
bpo-1635741: Refactor _threadmodule.c #23793
Conversation
I chose to not convert static types to heap types in the same PR to keep the PR short enough for reviews. |
I was not sure if it's a good idea to convert the module to multiphase init, but I wanted to do it to pass the lock type to newlockobject(). |
* Fix ExceptHookArgsType name: "_thread.ExceptHookArgs", instead of "_thread._ExceptHookArgs". * PyInit__thread() no longer intializes interp->num_threads to 0: it is already done in PyInterpreterState_New(). * Use PyModule_AddType(), Py_NewRef() and Py_XNewRef(). * Replace str_dict variable with _Py_IDENTIFIER(__dict__). * Remove assert(Py_IS_TYPE(obj, &Locktype)) from release_sentinel() to avoid having to retrive the type from this callback.
I changed my mind. I reverted some changes to keep the legacy PyModule_Create() API. I removed the module state. It's trivial to add a module state to migrate to PyModuleDef_Init(). But we may do that while static types are converted to heap types. |
The tricky part is to get localdummytype in local_new() and get localtype in local_getattro(). _PyType_GetModuleByDef() can be used for that. |
* Rename t_bootstrap() to thread_run() * bootstate structure: rename keyw member to kwargs
* Fix ExceptHookArgsType name: "_thread.ExceptHookArgs", instead of "_thread._ExceptHookArgs". * PyInit__thread() no longer intializes interp->num_threads to 0: it is already done in PyInterpreterState_New(). * Use PyModule_AddType(), Py_NewRef() and Py_XNewRef(). * Replace str_dict variable with _Py_IDENTIFIER(__dict__). * Remove assert(Py_IS_TYPE(obj, &Locktype)) from release_sentinel() to avoid having to retrive the type from this callback. * Add thread_bootstate_free() * Rename t_bootstrap() to thread_run() * bootstate structure: rename keyw member to kwargs
"_thread._ExceptHookArgs".
it is already done in PyInterpreterState_New().
to avoid having to retrive the type from this callback.
https://bugs.python.org/issue1635741