Repository navigation
trying mypyc on Cython-3.1.0a1 with Python-3.13.0b1 I get a "this header requires Py_BUILD_CORE define" #119203
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on May 20, 2024 the problem doesn't occure with Python-3.12, so the 'unexpected' bad result of this wild experiment.
python-3.13.0b1 was downloaded from python.org, and installed with this checkmarks (ep free-threading)

then I copied python3.13t.exe in python.exe
package list
Package Version Summary ____________________ ____________ ______________________________________________________________________ appdirs 1.4.4 A small Python module for determining appropriate platform-specific di asttokens 2.4.1 Annotate AST trees with source code positions build 1.2.1 A simple, correct Python build frontend colorama 0.4.6 Cross-platform colored terminal text. cython 3.1.0a0 The Cython compiler for writing C extensions in the Python language. decorator 5.1.1 Decorators for Humans executing 2.0.1 Get the currently executing AST node of a frame, and other information interpreters-pep-734 0.1.0 Use this module to try out multiple interpreters and a per-interpreter ipython 8.24.0 IPython: Productive Interactive Computing jedi 0.19.1 An autocompletion tool for Python that can be used for text editors. matplotlib-inline 0.1.6 Inline Matplotlib backend for Jupyter msvc-runtime 14.38.33135 Install the Microsoft™ Visual C++™ runtime DLLs to the sys.prefix and mypy 1.8.0 Optional static typing for Python mypy-extensions 1.0.0 Type system extensions for programs checked with the mypy type checker packaging 24.0 Core utilities for Python packages parso 0.8.4 A Python Parser pip 24.1b1 The PyPA recommended tool for installing Python packages. prompt-toolkit 3.0.43 Library for building powerful interactive command lines in Python psutil 5.9.5 Cross-platform lib for process and system monitoring in Python. ptpython 3.0.26 Python REPL build on top of prompt_toolkit pure-eval 0.2.2 Safely evaluate AST nodes without side effects pygments 2.17.2 Pygments is a syntax highlighting package written in Python. pyperf 2.7.0 Python module to run and analyze benchmarks pyproject-hooks 1.0.0 Wrappers to call pyproject.toml-based build backend hooks. setuptools 69.5.1 Easily download, build, install, upgrade, and uninstall Python package six 1.16.0 Python 2 and 3 compatibility utilities sqlite-bro 0.13.1 a graphic SQLite Client in 1 Python file stack-data 0.6.3 Extract data from python stack frames and tracebacks for informative d traitlets 5.14.1 Traitlets Python configuration system typing-extensions 4.9.0 Backported and Experimental Type Hints for Python 3.8+ wcwidth 0.2.13 Measures the displayed width of unicode strings in a terminal wheel 0.43.0 A built-package format for Python winpython 8.0.20240514 WinPython distribution tools, including WPPMhere it was written zephyrproject-rtos/windows-curses#26 (comment)
"You can't use Py_BUILD_CORE as it's ONLY usable when building the CPython itself "
so maybe the current way I got free-threading is the problem ?
coming from this ? gh-85283: If Py_LIMITED_API is defined, undefine Py_BUILD_CORE
Apparently same error message with python-3.13.0b1 "standard"
trying the fibonacci cython tutorial https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html#fibonacci-fun
- everything ok on python-3.13.0b1 "standard"
- on python-3.13.0b1 "free_threading":
python setup.py build_ext --inplacedoes no error- but
import fibcause python to exit with no error message
well it seems cython is far from ready at this point, so maybe it's too early to complain ?
cython/cython#6162 (comment)In 3.13 many functions and some internal headers were moved to be private.
3.12 version without requiring
PY_BUILD_CORE:
https://github.com/python/cpython/blob/3.12/Include/internal/pycore_frame.h3.13 version requiring
PY_BUILD_CORE:
https://github.com/python/cpython/blob/3.13/Include/internal/pycore_frame.h#L7Mypyc and I believe Cython need to be updated before they will work with Python 3.13, so this error is a bug in mypyc/Cython
Mypyc and I believe Cython need to be updated before they will work with Python 3.13, so this error is a bug in mypyc/Cython
Please report this issue to mypyc and/or Cython.
I agree with Victor that this is better reported to mypyc and/or Cython.
I'm a bit puzzled by the issue though: Cython and mypyc are both Python->C transpilers; it'd be very odd to try to build Cython with MyPyC as the title suggests (it expects to either be built with itself, or just run as Python code).
The current master branch of Cython does work with Python 3.13b1 (both regular build and the free-threading build). It isn't necessarily thread-safe so you can get into trouble if you try to use multiple threads. But for a simple, single-threaded program like the Fibonacci example it runs fine (and I've tested that and confirmed it).
When I import the compiled Fibonacci example of cython pages, my python REPL just quit.. are you sure free-threading works on windows with cython-3.1.0a0 ? (Stolen from CI)
Applying an end-user procedure ? Devil can be in the detail of a end-user procedure done wrong
If it was possible, may you publish a pure-wheel of the working cython ? An a1 ? did try with a0 pure-wheel of May 9th and may 16th... maybe it's too much manual procedure, but failed at both
Bug report
Bug description:
on python-3.13.0b1 on Windows 11 non-english
generates
CPython versions tested on:
3.13
Operating systems tested on:
Windows