STINNER Victor <vstin...@python.org> added the comment:

PyType_FromSpec() and PyType_Spec API are not currently compatible with opaque 
PyObject.

Example:
---
#define PyObject_HEAD    PyObject ob_base;

typedef struct {
    PyObject_HEAD
    ...
} MyObject;

static PyType_Spec type_spec = {
    .name = "MyObject",
    .basicsize = sizeof(MyObject),
    ...
};

... = PyType_FromSpec(&type_spec);
---

sizeof(MyObject) requires to compute sizeof(PyObject).

Issue reported by Ronald Oussoren on python-dev:
https://mail.python.org/archives/list/python-...@python.org/message/PGKRW7S2IUOWVRX6F7RT6VAWD3ZPUDYS/

----------
title: Make PyObject an opaque structure in the limited C API -> [C API] Make 
PyObject an opaque structure in the limited C API

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39573>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to