Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork10.9k
GH-29021: Convert multiarray to multi-phase init (PEP 489)#29022
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
1c01323
to4e8bb3c
CompareThe failures here are (will be) as the relevant parts of The other option is to keep treating those variables as global and instead re-add the same object to the new module. This may cause other problems though, as I don't believe it's the intended execution model. There also appears to be a SIGSEV around the call to cc@ngoldbaum if you'd be able to suggest anything? A |
4e8bb3c
to760440b
Compare760440b
tof5eed00
CompareNice, will be great to make progress here! We have a lot of global state, but much of it can probably just stay intact within the same interpreter (some cannot, e.g. because new singletons are created but this was always incorrect, so for a first start...). So without multi-stage init, CPython would not run the module initially again if the so was already loaded (so deleting it from One problem with There is a check to catch types that are set to bad values, I honestly don't remember why it is there, and the loop definitely looks bad (it should just look up the type number of them So long we don't actually support subinterpreters, the old type object should actually be good to use.@AA-Turner maybe you can try applying something like this: diff --git a/numpy/_core/src/multiarray/dtypemeta.c b/numpy/_core/src/multiarray/dtypemeta.cindex 0b1b0fb391..adb268097c 100644--- a/numpy/_core/src/multiarray/dtypemeta.c+++ b/numpy/_core/src/multiarray/dtypemeta.c@@ -1075,6 +1075,11 @@ dtypemeta_wrap_legacy_descriptor( _PyArray_LegacyDescr *descr, PyArray_ArrFuncs *arr_funcs, PyTypeObject *dtype_super_class, const char *name, const char *alias) {+ if (Py_TYPE(descr) != NULL && NPY_DTYPE(descr)->singleton == (PyArray_Descr *)descr) {+ /* We seem to already have created a type, multiple inits? */+ return 0;+ }+ int has_type_set = Py_TYPE(descr) == &PyArrayDescr_Type; if (!has_type_set) { (but there will likely be a long tail of these type of things, and of course the real fix will be to move the singletons into proper module state!) |
Uh oh!
There was an error while loading.Please reload this page.