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

Fail to build with Python 3.13 #392

Open
boasmeier opened this issue Dec 12, 2023 · 3 comments
Open

Fail to build with Python 3.13 #392

boasmeier opened this issue Dec 12, 2023 · 3 comments

Comments

@boasmeier
Copy link

Description

The package cannot be built on Python 3.13.

Expected Behavior

The package can be built successfully when running pip install greenlet

Actual Behavior

Collecting greenlet
  Using cached greenlet-3.0.2.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: greenlet
  Building wheel for greenlet (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for greenlet (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [194 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-313
      creating build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/__init__.py -> build/lib.linux-x86_64-cpython-313/greenlet
      creating build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/__init__.py -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      creating build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_initialstub_already_started.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_stack_saved.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_cpp_exception.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_switch_two_greenlets.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/__init__.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_contextvars.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_slp_switch.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_tracing.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_greenlet.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_extension_interface.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_generator_nested.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_generator.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_greenlet_trash.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_switch_three_greenlets2.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/leakcheck.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_leaks.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_version.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_cpp.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_switch_three_greenlets.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_weakref.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_gc.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/fail_clearing_run_switches.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/test_throw.py -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      running egg_info
      writing src/greenlet.egg-info/PKG-INFO
      writing dependency_links to src/greenlet.egg-info/dependency_links.txt
      writing requirements to src/greenlet.egg-info/requires.txt
      writing top-level names to src/greenlet.egg-info/top_level.txt
      reading manifest file 'src/greenlet.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching 'benchmarks/*.json'
      no previously-included directories found matching 'docs/_build'
      warning: no files found matching '*.py' under directory 'appveyor'
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.pyd' found anywhere in distribution
      warning: no previously-included files matching '*.so' found anywhere in distribution
      warning: no previously-included files matching '.coverage' found anywhere in distribution
      adding license file 'LICENSE'
      adding license file 'LICENSE.PSF'
      adding license file 'AUTHORS'
      writing manifest file 'src/greenlet.egg-info/SOURCES.txt'
      copying src/greenlet/TBrokenGreenlet.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TExceptionState.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TGreenlet.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TGreenletGlobals.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TMainGreenlet.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TPythonState.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TStackState.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TThreadStateDestroy.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/TUserGreenlet.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet.cpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet.h -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_allocator.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_compiler_compat.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_cpython_add_pending.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_cpython_compat.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_exceptions.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_greenlet.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_internal.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_refs.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_slp_switch.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_thread_state.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_thread_state_dict_cleanup.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/greenlet_thread_support.hpp -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/slp_platformselect.h -> build/lib.linux-x86_64-cpython-313/greenlet
      copying src/greenlet/platform/setup_switch_x64_masm.cmd -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_aarch64_gcc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_alpha_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_amd64_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_arm32_gcc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_arm32_ios.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_arm64_masm.asm -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_arm64_masm.obj -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_arm64_msvc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_csky_gcc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_loongarch64_linux.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_m68k_gcc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_mips_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_ppc64_aix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_ppc64_linux.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_ppc_aix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_ppc_linux.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_ppc_macosx.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_ppc_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_riscv_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_s390_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_sparc_sun_gcc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_x32_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_x64_masm.asm -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_x64_masm.obj -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_x64_msvc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_x86_msvc.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/platform/switch_x86_unix.h -> build/lib.linux-x86_64-cpython-313/greenlet/platform
      copying src/greenlet/tests/_test_extension.c -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      copying src/greenlet/tests/_test_extension_cpp.cpp -> build/lib.linux-x86_64-cpython-313/greenlet/tests
      running build_ext
      building 'greenlet._greenlet' extension
      creating build/temp.linux-x86_64-cpython-313
      creating build/temp.linux-x86_64-cpython-313/src
      creating build/temp.linux-x86_64-cpython-313/src/greenlet
      x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/boas/git/ng-ansible/.venv/include -I/usr/include/python3.13 -c src/greenlet/greenlet.cpp -o build/temp.linux-x86_64-cpython-313/src/greenlet/greenlet.o
      In file included from src/greenlet/greenlet_greenlet.hpp:26,
                       from src/greenlet/greenlet_internal.hpp:20,
                       from src/greenlet/greenlet.cpp:19:
      /usr/include/python3.13/internal/pycore_frame.h:8:4: error: #error "this header requires Py_BUILD_CORE define"
          8 | #  error "this header requires Py_BUILD_CORE define"
            |    ^~~~~
      In file included from /usr/include/python3.13/internal/pycore_frame.h:13,
                       from src/greenlet/greenlet_greenlet.hpp:26,
                       from src/greenlet/greenlet_internal.hpp:20,
                       from src/greenlet/greenlet.cpp:19:
      /usr/include/python3.13/internal/pycore_code.h:8:4: error: #error "this header requires Py_BUILD_CORE define"
          8 | #  error "this header requires Py_BUILD_CORE define"
            |    ^~~~~
      In file included from src/greenlet/greenlet_internal.hpp:20,
                       from src/greenlet/greenlet.cpp:19:
      src/greenlet/greenlet_greenlet.hpp:104:9: error: ‘_PyCFrame’ does not name a type; did you mean ‘_frame’?
        104 |         _PyCFrame* cframe;
            |         ^~~~~~~~~
            |         _frame
      src/greenlet/greenlet_greenlet.hpp:138:29: error: ‘_PyCFrame’ has not been declared
        138 |         void set_new_cframe(_PyCFrame& frame) noexcept;
            |                             ^~~~~~~~~
      In file included from src/greenlet/greenlet.cpp:33:
      src/greenlet/TUserGreenlet.cpp: In member function ‘virtual greenlet::Greenlet::switchstack_result_t greenlet::UserGreenlet::g_initialstub(void*)’:
      src/greenlet/TUserGreenlet.cpp:280:5: error: ‘_PyCFrame’ was not declared in this scope; did you mean ‘_frame’?
        280 |     _PyCFrame trace_info;
            |     ^~~~~~~~~
            |     _frame
      src/greenlet/TUserGreenlet.cpp:282:39: error: ‘trace_info’ was not declared in this scope
        282 |     this->python_state.set_new_cframe(trace_info);
            |                                       ^~~~~~~~~~
      In file included from src/greenlet/greenlet.cpp:36:
      src/greenlet/TPythonState.cpp: In constructor ‘greenlet::PythonState::PythonState()’:
      src/greenlet/TPythonState.cpp:12:6: error: class ‘greenlet::PythonState’ does not have any field named ‘cframe’
         12 |     ,cframe(nullptr)
            |      ^~~~~~
      src/greenlet/TPythonState.cpp:82:11: error: ‘class greenlet::PythonState’ has no member named ‘cframe’
         82 |     this->cframe = &PyThreadState_GET()->root_cframe;
            |           ^~~~~~
      src/greenlet/TPythonState.cpp:82:42: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘root_cframe’
         82 |     this->cframe = &PyThreadState_GET()->root_cframe;
            |                                          ^~~~~~~~~~~
      src/greenlet/TPythonState.cpp: In member function ‘void greenlet::PythonState::operator<<(const PyThreadState*)’:
      src/greenlet/TPythonState.cpp:128:11: error: ‘class greenlet::PythonState’ has no member named ‘cframe’
        128 |     this->cframe = tstate->cframe;
            |           ^~~~~~
      src/greenlet/TPythonState.cpp:128:28: error: ‘const PyThreadState’ {aka ‘const struct _ts’} has no member named ‘cframe’
        128 |     this->cframe = tstate->cframe;
            |                            ^~~~~~
      src/greenlet/TPythonState.cpp:136:31: error: ‘C_RECURSION_LIMIT’ was not declared in this scope; did you mean ‘Py_C_RECURSION_LIMIT’?
        136 |     this->c_recursion_depth = C_RECURSION_LIMIT - tstate->c_recursion_remaining;
            |                               ^~~~~~~~~~~~~~~~~
            |                               Py_C_RECURSION_LIMIT
      src/greenlet/TPythonState.cpp:140:35: error: ‘const PyThreadState’ {aka ‘const struct _ts’} has no member named ‘cframe’
        140 |     this->current_frame = tstate->cframe->current_frame;
            |                                   ^~~~~~
      src/greenlet/TPythonState.cpp: In member function ‘void greenlet::PythonState::operator>>(PyThreadState*)’:
      src/greenlet/TPythonState.cpp:175:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘cframe’
        175 |     tstate->cframe = this->cframe;
            |             ^~~~~~
      src/greenlet/TPythonState.cpp:175:28: error: ‘class greenlet::PythonState’ has no member named ‘cframe’
        175 |     tstate->cframe = this->cframe;
            |                            ^~~~~~
      src/greenlet/TPythonState.cpp:189:37: error: ‘C_RECURSION_LIMIT’ was not declared in this scope; did you mean ‘Py_C_RECURSION_LIMIT’?
        189 |     tstate->c_recursion_remaining = C_RECURSION_LIMIT - this->c_recursion_depth;
            |                                     ^~~~~~~~~~~~~~~~~
            |                                     Py_C_RECURSION_LIMIT
      src/greenlet/TPythonState.cpp:200:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘cframe’
        200 |     tstate->cframe->current_frame = this->current_frame;
            |             ^~~~~~
      src/greenlet/TPythonState.cpp: At global scope:
      src/greenlet/TPythonState.cpp:266:6: error: variable or field ‘set_new_cframe’ declared void
        266 | void PythonState::set_new_cframe(_PyCFrame& frame) noexcept
            |      ^~~~~~~~~~~
      src/greenlet/TPythonState.cpp:266:34: error: ‘_PyCFrame’ was not declared in this scope; did you mean ‘_frame’?
        266 | void PythonState::set_new_cframe(_PyCFrame& frame) noexcept
            |                                  ^~~~~~~~~
            |                                  _frame
      src/greenlet/TPythonState.cpp:266:45: error: ‘frame’ was not declared in this scope; did you mean ‘_frame’?
        266 | void PythonState::set_new_cframe(_PyCFrame& frame) noexcept
            |                                             ^~~~~
            |                                             _frame
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for greenlet
Failed to build greenlet
ERROR: Could not build wheels for greenlet, which is required to install pyproject.toml-based projects

Stepts to reproduce

pip install greenlet

Environment

  • Ubuntu 22.04
  • Python 3.13
  • pip 23.3.1
@jamadden
Copy link
Contributor

Python 3.13 is in early phases of development and obviously internal details have changed. It will take porting work to make that happen. I don't usually track pre-release versions until the beta phase --- I just don't have the time anymore --- but if you want to submit a PR that makes the alpha versions work, and if you'll commit to keeping the alpha versions working on every new release, I'd be happy to take a look.

I don't want to add a pre-release interpreter to our CI if there's a decent chance that the next pre-release will break it again, as that makes releases unnecessarily complicated. Hence the need for a commitment to keep all the alphas working once added.

@boasmeier
Copy link
Author

boasmeier commented Dec 16, 2023

Thanks for the quick reply. I see, it is totally reasonable to me to not support pre-release versions. Probably I won't find the time to prepare a PR with the commitment to keep all the alphas working. However, should I nevertheless start such an endeavor I would mention it here so others know that someone is working on it.

vstinner added a commit to vstinner/greenlet that referenced this issue Feb 14, 2024
* Replace C_RECURSION_LIMIT with Py_C_RECURSION_LIMIT.
* Add Py_C_RECURSION_LIMIT for Python 3.12 and older.
* Disable GREENLET_USE_CFRAME on Python 3.13.
* Define Py_BUILD_CORE to include pycore_frame.h.
vstinner added a commit to vstinner/greenlet that referenced this issue Feb 14, 2024
* Replace C_RECURSION_LIMIT with Py_C_RECURSION_LIMIT.
* Add Py_C_RECURSION_LIMIT for Python 3.12 and older.
* Disable GREENLET_USE_CFRAME on Python 3.13.
* Define Py_BUILD_CORE to include pycore_frame.h.
@vstinner
Copy link
Contributor

@boasmeier:

I see, it is totally reasonable to me to not support pre-release versions. Probably I won't find the time to prepare a PR with the commitment to keep all the alphas working. However, should I nevertheless start such an endeavor I would mention it here so others know that someone is working on it.

Hi, I wrote #396 which ports greenlet to Python 3.13.

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

No branches or pull requests

3 participants