Skip to content

pyport.h: use __STDC_VERSION__ >= 202311L instead of __STDC_VERSION__ > 201710L #137058

@anthony-tuininga

Description

@anthony-tuininga

Bug report

Bug description:

This code in pyport.h neds to be updated:

// Static inline functions should use _Py_NULL rather than using directly NULL
// to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
// _Py_NULL is defined as nullptr.
#if !defined(_MSC_VER) && \
    ((defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
        || (defined(__cplusplus) && __cplusplus >= 201103))
#  define _Py_NULL nullptr
#else
#  define _Py_NULL NULL
#endif

It is using the wrong definition of C23 which should be 202311L as noted in the Wiki page referenced in this commit.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions