Sorry, something went wrong.
There was a problem hiding this comment.
I'm not sure how to make this member future-proof in term of stable ABI.
We should try to put a max_align_t inside, but this type requires C11. GCC defines it with:
Maybe we can at least put long long and long double:
Sorry, something went wrong.
There was a problem hiding this comment.
This is the only issue I found here :)
The stable ABI doesn't have a good story around evolving structs, and I think we should design a general mechanism for that rather than try to future-proof individual structs.
To move this PR forward, could we exclude PyModule_AddConstants & co. from the limited API for the time being?
Sorry, something went wrong.
There was a problem hiding this comment.
Could you start by adding these two functions in a separated PR, to make this PR shorter?
Sorry, something went wrong.
There was a problem hiding this comment.
I don't really think that's necessary; the PR is not that big.
Sorry, something went wrong.
There was a problem hiding this comment.
nitpick: static PyObject * in here.
Sorry, something went wrong.
There was a problem hiding this comment.
How about using another sepeareted PR to do this converation operation?
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
| The values for *type* and the definition of the *value* union are | ||
| internal implementation details. Use any of the ``PyModuleConst_`` macros | ||
| to define entries. The array must be terminated by an entry with name | ||
| set to ``NULL``. | ||
|
|
||
| .. c:member:: const char *name | ||
|
|
||
| Attribute name. | ||
|
|
||
| .. c:member:: int type | ||
|
|
||
| Attribute type. | ||
|
|
||
| .. c:member:: void *value | ||
|
|
||
| Value of the module constant definition, whose meaning depends on | ||
| *type*. |
There was a problem hiding this comment.
| The values for *type* and the definition of the *value* union are | |
| internal implementation details. Use any of the ``PyModuleConst_`` macros | |
| to define entries. The array must be terminated by an entry with name | |
| set to ``NULL``. | |
| .. c:member:: const char *name | |
| Attribute name. | |
| .. c:member:: int type | |
| Attribute type. | |
| .. c:member:: void *value | |
| Value of the module constant definition, whose meaning depends on | |
| *type*. | |
| Definition of a module constant. | |
| The members of this struct are internal implementation details. | |
| To define entries, use only the ``PyModuleConst_`` macros below, | |
| and ``{NULL}`` to mark the end of the array. |
Sorry, something went wrong.
| } | ||
|
|
||
| PyObject * | ||
| PyModule_AddNewException(PyObject *module, const char *name, const char *doc, |
There was a problem hiding this comment.
These two functions need tests.
Sorry, something went wrong.
There was a problem hiding this comment.
Hm, I see these return borrowed references (held by the module object). That saves a DECREF if you don't need the new object, but it'll be problematic for HPy.
Sorry, something went wrong.
|
I'll close this as it's not likely to get updated any time soon. |
Sorry, something went wrong.
Signed-off-by: Christian Heimes christian@python.org
https://bugs.python.org/issue42376