8000 BUG: subclasses of np.void can cause a segfault · Issue #12207 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: subclasses of np.void can cause a segfault #12207

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

Open
eric-wieser opened this issue Oct 18, 2018 · 3 comments
Open

BUG: subclasses of np.void can cause a segfault #12207

eric-wieser opened this issue Oct 18, 2018 · 3 comments

Comments

@eric-wieser
Copy link
Member
class WithType(np.void):
    _type_ = np.int32
np.dtype(WithType)
# stack overflow
class WithDtype(np.void):
    dtype = np.int32
np.dtype(WithDtype)
# stack overflow
@eric-wieser
Copy link
Member Author

Attaching gdb reveals the cause is the assumption that the dtype inferred from the attribute will also be structured:

>>> d = np.dtype(Bad)

Thread 1 "python3-dbg" received signal SIGSEGV, Segmentation fault.
PyArray_DescrFromTypeObject (type=type@entry=<type at remote 0x104a678>) at numpy/core/src/multiarray/scalarapi.c:479
479                 Py_INCREF(new->names);
(gdb) p new->names
$1 = 0x0
(gdb)

@eric-wieser eric-wieser changed the title BUG: subclasses of np.void can cause stack overflows BUG: subclasses of np.void can cause a segfault Oct 24, 2018
@seberg
Copy link
Member
seberg commented Nov 5, 2021

This gives a Deprecation warnign now (due to using the .dtype attribute). I am sure there are many others bugs around this, but this one appears not reproducible anymore.

@seberg seberg closed this as completed Nov 5, 2021
@seberg
Copy link
Member
seberg commented Nov 5, 2021

Woops, reopening, the examples seem to run into reference count errors currently

@seberg seberg reopened this Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0