Le 13/09/2021 à 17:39, Victor Stinner a écrit :
Deprecating Py_TYPE/Py_SIZE would affect way more C extensions, no?
What do you mean "affect"? A deprecation warning does not break anything, but it signals the developer that something should perhaps be done.
Requiring C extensions to replace Py_TYPE() with Py_GetTypeInline() and replacing Py_SIZE() with Py_GetSizeInline() would require more work and has no benefit, no?
Please read what I proposed. There is no *requirement* to replace them explicitly, as the replacement will be done implicitly in a few Python releases. There is an explicit *warning* telling users that their current usage may be wrong if they use Py_TYPE or Py_SIZE with assignment.
Regards
Antoine.
I'm not sure that I get your point. Is it
about keeping Py_TYPE/Py_SIZE for a few more Python releases?
Victor
On Mon, Sep 13, 2021 at 5:23 PM Antoine Pitrou <antoine@python.org> wrote:
One solution would be to:
introduce Py_GetSizeInline(), Py_GetTypeInline() static inline functions (of course, feel free to prefer other names :-))
deprecate Py_SIZE() and Py_TYPE() with a message guiding towards Py_GetSizeInline() and Py_GetTypeInline() respectively. To be clear, this is a compile-time deprecation message using pragmas or other compiler-specific means (see e.g. https://stackoverflow.com/questions/2681259/how-to-deprecate-a-c-pre-process...).
in a couple versions, retire the current definitions of Py_SIZE and Py_TYPE and replace them with:
#define Py_SIZE Py_GetSizeInline #define Py_TYPE Py_GetTypeInline
Regards
Antoine.
Le 13/09/2021 à 16:52, Antonio Cuni a écrit :
On Mon, Sep 13, 2021 at 11:37 AM Petr Viktorin <encukou@gmail.com> wrote:
Sure, let's evolve and improve CPython. But can we make it in steps that are individually helpful?
I think that's the core of the divergences of opinions. I think we have reached a point where the amount of improvements which can be done by "small steps which are individually useful" is little. I might be wrong of course.
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org https://mail.python.org/mailman3/lists/capi-sig.python.org/ Member address: antoine@python.org
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org https://mail.python.org/mailman3/lists/capi-sig.python.org/ Member address: vstinner@python.org