Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Apr 6, 2022

Remove the Include/code.h header file. C extensions should only
include the main <Python.h> header file.

Python.h includes directly Include/cpython/code.h instead.

https://bugs.python.org/issue35134

@vstinner
Copy link
Member Author

vstinner commented Apr 6, 2022

None of the top 5000 PyPI projects include directly code.h:

$ ./search_pypi_top.py PYPI-2022-01-26-TOP-5000/ '# *include [<"]code.h[">]' -q
PYPI-2022-01-26-TOP-5000/Pygments-2.11.2.tar.gz: Pygments-2.11.2/tests/examplefiles/c/ceval.c: #include "code.h"
PYPI-2022-01-26-TOP-5000/typed_ast-1.5.2.tar.gz: typed_ast-1.5.2/ast27/Include/compile.h: #include "code.h"

Found 2 matching lines in 2 projects
  • Pygments only uses ceval.c has an example: this C file is not built
  • typed_ast ast27/Include/compile.h is only used on Python 2.7

vstinner added 2 commits April 7, 2022 01:27
Remove the Include/code.h header file. C extensions should only
include the main <Python.h> header file.

Python.h includes directly Include/cpython/code.h instead.
@vstinner vstinner merged commit 85addfb into python:main Apr 7, 2022
@vstinner vstinner deleted the remove_code_h branch April 7, 2022 00:29
tacaswell added a commit to tacaswell/typed_ast that referenced this pull request May 10, 2022
As of python/cpython#32385 the header
code.h is private but directly included into Python.h
hauntsaninja pushed a commit to python/typed_ast that referenced this pull request May 10, 2022
As of python/cpython#32385 the header
code.h is private but directly included into Python.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants