New issue 3055: Segfault when defining a C extension type with empty docstring 
on PyPy3
https://bitbucket.org/pypy/pypy/issues/3055/segfault-when-defining-a-c-extension-type

timfel:

Given this type definition, we get a segfault when calling `PyType_Ready` on it:

```c
static PyTypeObject NativeType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "NativeType.NativeType",
    sizeof(NativeTypeObject),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT,
    "",
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    PyType_GenericAlloc,
    PyType_GenericNew,
    PyObject_Del,
};
```

We can avoid the segfault if we give `0` or `NULL` instead of the empty 
docstring in line 22. Or just adding any character to make the docstring longer 
than 0-length also makes it work.


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to