Skip to content

3.12.0b1: static declaration follows non-static when importing internal/pycore_dict.h #105268

Description

@P403n1x87

Bug report

I have a change within a project that includes a native extension which fails to compile with 3.12.0b1:

      In file included from echion/coremodule.cc:22:
      In file included from ./echion/dict.h:7:
      In file included from /Users/gabriele/.pyenv/versions/3.12.0b1/include/python3.12/internal/pycore_dict.h:13:
      In file included from /Users/gabriele/.pyenv/versions/3.12.0b1/include/python3.12/internal/pycore_runtime.h:16:
      In file included from /Users/gabriele/.pyenv/versions/3.12.0b1/include/python3.12/internal/pycore_global_objects.h:11:
      /Users/gabriele/.pyenv/versions/3.12.0b1/include/python3.12/internal/pycore_gc.h:84:19: error: static declaration of 'PyObject_GC_IsFinalized' follows non-static declaration
      static inline int _PyGC_FINALIZED(PyObject *op) {
                        ^
      /Users/gabriele/.pyenv/versions/3.12.0b1/include/python3.12/cpython/objimpl.h:85:30: note: expanded from macro '_PyGC_FINALIZED'
      #  define _PyGC_FINALIZED(o) PyObject_GC_IsFinalized(o)
                                   ^
      /Users/gabriele/.pyenv/versions/3.12.0b1/include/python3.12/objimpl.h:209:17: note: previous declaration is here
      PyAPI_FUNC(int) PyObject_GC_IsFinalized(PyObject *);

I didn't look too deep into what changed here, but my guess would be that the macro should drop the _ prefix, i.e.

#  define PyGC_FINALIZED(o) PyObject_GC_IsFinalized(o)

since it seems that PyObject_GC_IsFinalized is part of the API. The same code compiles fine with older versions of Python.

Your environment

MacOS Ventura 13.3.1
Python 3.12.0b1

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions