Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 introduces redundant decls warning #106560

Closed
t-8ch opened this issue Jul 9, 2023 · 1 comment
Closed

Python 3.12 introduces redundant decls warning #106560

t-8ch opened this issue Jul 9, 2023 · 1 comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API type-bug An unexpected behavior, bug, or error

Comments

@t-8ch
Copy link
Contributor

t-8ch commented Jul 9, 2023

Bug report

Python 3.12 introduce a -Wredundant-decls warning.

// test.c
#include <Python.h>

int main(void) {}
$ gcc test.c -o test $(pkg-config --cflags python-3.12) -Wredundant-decls
In file included from /usr/include/python3.12/Python.h:52,
                 from test.c:1:
/usr/include/python3.12/longobject.h:10:26: warning: redundant redeclaration of ‘PyLong_Type’ [-Wredundant-decls]
   10 | PyAPI_DATA(PyTypeObject) PyLong_Type;
      |                          ^~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:44:
/usr/include/python3.12/object.h:210:26: note: previous declaration of ‘PyLong_Type’ with type ‘PyTypeObject’ {aka ‘struct _typeobject’}
  210 | PyAPI_DATA(PyTypeObject) PyLong_Type;
      |                          ^~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:54:
/usr/include/python3.12/boolobject.h:10:26: warning: redundant redeclaration of ‘PyBool_Type’ [-Wredundant-decls]
   10 | PyAPI_DATA(PyTypeObject) PyBool_Type;
      |                          ^~~~~~~~~~~
/usr/include/python3.12/object.h:211:26: note: previous declaration of ‘PyBool_Type’ with type ‘PyTypeObject’ {aka ‘struct _typeobject’}
  211 | PyAPI_DATA(PyTypeObject) PyBool_Type;
      |        
  • This was introduced in 7559f5f
  • This currently breaks the build/tests of util-linux/pylibmount (with -Werror)

Your environment

  • CPython versions tested on: 3.12.0b3 (should be the same on master)
  • Operating system and architecture: ArchLinux, x86_64

Linked PRs

@t-8ch t-8ch added the type-bug An unexpected behavior, bug, or error label Jul 9, 2023
t-8ch added a commit to t-8ch/util-linux that referenced this issue Jul 9, 2023
Python 3.12 introduced a -Wredundant-decls warning.
Work around it by not breaking the build.

See python/cpython#106560

Closes: util-linux#2366
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
@sunmy2019 sunmy2019 added interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API labels Jul 9, 2023
t-8ch added a commit to t-8ch/util-linux that referenced this issue Jul 10, 2023
Python 3.12 introduced a -Wredundant-decls warning.
Work around it by not breaking the build.

See python/cpython#106560

Closes: util-linux#2366
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
t-8ch added a commit to t-8ch/util-linux that referenced this issue Jul 10, 2023
Python 3.12 introduced a -Wredundant-decls warning.
Work around it by not breaking the build.

See python/cpython#106560

Closes: util-linux#2366
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
t-8ch added a commit to t-8ch/util-linux that referenced this issue Jul 10, 2023
Python 3.12 introduced a -Wredundant-decls warning.
Work around it by not breaking the build.

See python/cpython#106560

Closes: util-linux#2366
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
karelzak pushed a commit to karelzak/util-linux-work that referenced this issue Aug 16, 2023
Python 3.12 introduced a -Wredundant-decls warning.
Work around it by not breaking the build.

See python/cpython#106560

Closes: util-linux#2366
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
intel-media-ci pushed a commit to intel-media-ci/gstreamer that referenced this issue Nov 11, 2023
When we are building againt python 3.12, ignore redundant-decls warning
that will come from the python headers.

```
/usr/include/python3.12/longobject.h:10:26: warning: redundant redeclaration of ‘PyLong_Type’ [-Wredundant-decls]
   10 | PyAPI_DATA(PyTypeObject) PyLong_Type;
      |                          ^~~~~~~~~~~
```

python/cpython#106560

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5541>
wh201906 added a commit to wh201906/proxmark3-rrg that referenced this issue Nov 24, 2023
wh201906 added a commit to wh201906/proxmark3-rrg that referenced this issue Nov 24, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Dec 2, 2023
Avoid duplicated declarations of "extern" functions in
Python/frozen.c.
vstinner added a commit to vstinner/cpython that referenced this issue Dec 2, 2023
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit to vstinner/cpython that referenced this issue Dec 2, 2023
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit to vstinner/cpython that referenced this issue Dec 2, 2023
Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit that referenced this issue Dec 3, 2023
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit that referenced this issue Dec 3, 2023
Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit to vstinner/cpython that referenced this issue Dec 3, 2023
Don't declare PyBool_Type and PyLong_Type twice, but only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit to vstinner/cpython that referenced this issue Dec 3, 2023
…n#112612)

Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.

(cherry picked from commit d9e444d)
vstinner added a commit that referenced this issue Dec 3, 2023
…112650)

gh-106560: Fix redundant declarations in Include/ (#112611)

Don't declare PyBool_Type and PyLong_Type twice, but only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
vstinner added a commit that referenced this issue Dec 3, 2023
) (#112651)

gh-106560: Fix redundant declarations in Python/frozen.c (#112612)

Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.

(cherry picked from commit d9e444d)
hubot pushed a commit to GStreamer/gstreamer that referenced this issue Feb 4, 2024
When we are building againt python 3.12, ignore redundant-decls warning
that will come from the python headers.

```
/usr/include/python3.12/longobject.h:10:26: warning: redundant redeclaration of ‘PyLong_Type’ [-Wredundant-decls]
   10 | PyAPI_DATA(PyTypeObject) PyLong_Type;
      |                          ^~~~~~~~~~~
```

python/cpython#106560

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6044>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…n#112612)

Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
@hugovk
Copy link
Member

hugovk commented Mar 15, 2024

Closing as the PRs have been merged and backported. Please let us know if there's still more to do. Thanks for the report!

@hugovk hugovk closed this as completed Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants