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_FOR_REGEN only works with Python 3.10 or newer #104487

Closed
erlend-aasland opened this issue May 14, 2023 · 9 comments · Fixed by #104488
Closed

PYTHON_FOR_REGEN only works with Python 3.10 or newer #104487

erlend-aasland opened this issue May 14, 2023 · 9 comments · Fixed by #104488
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented May 14, 2023

On current main, PYTHON_FOR_REGEN only works with Python 3.10 or newer.

Previously, we've tried to maintain backwards compatibility with older Python versions in our build system. Last time we adjusted PYTHON_FOR_REGEN (gh-98988), we deliberately did not bump the minimal version requirements; our configure checks for Python 3.11 through Python 3.6.

While working on gh-104050, a discussion about version requirements came up, and we found out that on main, make clinic only works when PYTHON_FOR_REGEN is Python 3.10 or newer. Also, the newly introduced "generate cases script" uses pattern matching and uses newly introduced typing features. Per now, PYTHON_FOR_REGEN must be 3.10 or newer.

There are two solution to this:

  1. bump the PYTHON_FOR_REGEN version requirements to 3.10 in configure
  2. amend the problematic build scripts, so older Python versions are still supported

Personally, I think I'm leaning towards the former. Apparently no core dev, triager or other contributor has noticed this issue until now. No buildbot has failed (we don't test the minimum required version; perhaps we should). OTOH, I understand that it makes stuff like bootstrapping slightly more cumbersome.

Anyway, we should probably at least bump the version requirement from Python 3.6 to 3.8.

Linked PRs

@erlend-aasland erlend-aasland added type-bug An unexpected behavior, bug, or error build The build process and cross-build labels May 14, 2023
@erlend-aasland
Copy link
Contributor Author

cc. @AlexWaygood, @JelleZijlstra, @hugovk

@AlexWaygood
Copy link
Member

(FWIW, this issue was originally highlighted by running mypy on Tools/clinic with --python-version=3.8, which pointed out that clinic.py currently makes regular use of types.NoneType, a symbol that's new in Python 3.10.)

@erlend-aasland
Copy link
Contributor Author

cc. @gvanrossum and @iritkatriel for Tools/cases_generator/

@gvanrossum
Copy link
Member

I’m reluctant to have to dumb down the cases generator to 3.8. Can we please just bump the required version to 3.10? As you say there isn’t much need for earlier versions, apparently.

@erlend-aasland
Copy link
Contributor Author

I've updated my PR with Python 3.10 as the minimum version, and I also included Python 3.12 in the list.

@sobolevn
Copy link
Member

I also agree with bumping minimal version to 3.10 (as I said in the original issue).
I cannot imagine real-life use-cases when you need to compile the most recent Python version from source, but at the same time you don't have an access to at least 3.10

Plus, this makes writting code much more pleasant due to new typing + syntax features.

@erlend-aasland thanks for raising this! 👍

@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented May 15, 2023

I cannot imagine real-life use-cases when you need to compile the most recent Python version from source, but at the same time you don't have an access to at least 3.10

Bootstrapping Python on a new platform.

Come to think of it, you probably won't use PYTHON_FOR_REGEN when building from a clean check-out anyways. You'd only need it for regenerating stuff you touched, and in that case, you can point PYTHON_FOR_REGEN to for example ./python.exe in the build dir.

erlend-aasland added a commit that referenced this issue May 15, 2023
Also include Python 3.12 in the list of accepted versions.
@erlend-aasland
Copy link
Contributor Author

carljm added a commit to carljm/cpython that referenced this issue May 15, 2023
* main: (29 commits)
  pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418)
  pythongh-101819: Isolate `_io` (python#101948)
  Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501)
  pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495)
  pythongh-104050: Run mypy on `clinic.py` in CI (python#104421)
  pythongh-104490: Consistently define phony make targets (python#104491)
  pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473)
  pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488)
  pythongh-101282: move BOLT config after PGO (pythongh-104493)
  pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470)
  pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457)
  pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474)
  pythongh-104337: Clarify random.gammavariate doc entry  (python#104410)
  Minor improvements to typing docs (python#104465)
  pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460)
  pythonGH-71383: IDLE - Document testing subsets of modules (python#104463)
  pythongh-104454: Fix refleak in AttributeError_reduce (python#104455)
  pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446)
  pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424)
  Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430)
  ...
carljm added a commit to carljm/cpython that referenced this issue May 15, 2023
* main: (204 commits)
  pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418)
  pythongh-101819: Isolate `_io` (python#101948)
  Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501)
  pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495)
  pythongh-104050: Run mypy on `clinic.py` in CI (python#104421)
  pythongh-104490: Consistently define phony make targets (python#104491)
  pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473)
  pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488)
  pythongh-101282: move BOLT config after PGO (pythongh-104493)
  pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470)
  pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457)
  pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474)
  pythongh-104337: Clarify random.gammavariate doc entry  (python#104410)
  Minor improvements to typing docs (python#104465)
  pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460)
  pythonGH-71383: IDLE - Document testing subsets of modules (python#104463)
  pythongh-104454: Fix refleak in AttributeError_reduce (python#104455)
  pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446)
  pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424)
  Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants