- Notifications
You must be signed in to change notification settings - Fork0
WIP: Python 3.13 support#6
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
b33ec8d toa02d8fbComparezanieb commentedSep 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Okay(aarch64-apple-darwin, macos-14, cpython-3.13, pgo) is failing on Unfortunately the only output is We'll need to get more output from the test script. (aarch64-apple-darwin, macos-14, cpython-3.13, pgo+lto) is the same. A local attempt to reproduce this succeeded. I tried setting
Finally stumbled my way to a verbose failure with diff --git a/pythonbuild/utils.py b/pythonbuild/utils.pyindex bf05d0d..83227f5 100644--- a/pythonbuild/utils.py+++ b/pythonbuild/utils.py@@ -495,6 +495,7 @@ def add_env_common(env): """Adds extra keys to environment variables.""" cpu_count = multiprocessing.cpu_count()+ env["PROFILE_TASK"] = "-m test --pgo -W" env["NUM_CPUS"] = "%d" % cpu_count env["NUM_JOBS_AGGRESSIVE"] = "%d" % max(cpu_count + 2, cpu_count * 2) and diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.pyindex 8bef04cba81..0bff5eaff5b 100644--- a/Lib/test/libregrtest/cmdline.py+++ b/Lib/test/libregrtest/cmdline.py@@ -480,8 +480,6 @@ def _parse_args(args, **kwargs): ns.python = shlex.split(ns.python) if ns.failfast and not (ns.verbose or ns.verbose3): parser.error("-G/--failfast needs either -v or -W")- if ns.pgo and (ns.verbose or ns.rerun or ns.verbose3):- parser.error("--pgo/-v don't go together!") if ns.pgo_extended: ns.pgo = True # pgo_extended implies pgo I was also able to get past the test failure during PGO with this patch diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.pyindex 5148d307051..85b9e46f946 100644--- a/Lib/test/libregrtest/main.py+++ b/Lib/test/libregrtest/main.py@@ -555,6 +555,9 @@ def _run_tests(self, selected: TestTuple, tests: TestList | None) -> int: self.display_summary() self.finalize_tests(coverage)+ if self.pgo:+ return 0+ return self.results.get_exitcode(self.fail_env_changed, self.fail_rerun) but that doesn't seem ideal. See#6 (comment) for a resolution. |
zanieb commentedSep 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
(x86_64-apple-darwin, macos-13, cpython-3.13, debug) is failing with which seems relatively straight-forward in that we set a target min deployment of macOS 10.9.0 but they're using an item that's declared in macOS 10.13.4. I'm not yet sure what the pattern is to resolve this. We define the min version at
10ee020 unconditionally bumps the minimum version — which is probably wrong but hopefully unblocks the issue for now. Looking into a better solution at#8 — bumping the minimum version unleashed additional complexity. |
Required for missing `UTType`
zanieb commentedSep 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The Windows failure is a bit unhinged then lots of and finally The last error looks related to a change todisable bundled libmpdecimal by default which is okay in Unix because we use an external distribution
Ind33c58b, I try to just turn this off and use the bundled one again since it'll be around until Python 3.15. If that works, we can follow up with using an external Resolved by#7 |
zanieb commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
(x86_64_v4-unknown-linux-musl, cpython-3.13, noopt) is failing with As well as(x86_64_v4-unknown-linux-musl, cpython-3.13, lto) This looks related topython/cpython#107221 which changed the platform detection on 3.13 With7c3c95d this is resolved and we're encountering Which seems to indicate that the link created with Does not have a valid target. However... the logs look about the same as the successful 3.12 build so I'm not sure what's going on yet. I'm not sure what changed upstream. 931009e had no affect. Not did1d8da17 because the target triple includes GNU.4a78a31 did it though. |
zanieb commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
(x86_64-unknown-linux-gnu, cpython-3.13, pgo, true) is failing with Much discussion about this follows in the thread, concluding at#6 (comment) |
* Attempt to download and build `mpdecimal` on Windows* Patch `mpdecimal` in `python.props`* Remove `_msi` from expected global extensions* Allow `_msi` to be missing during `collect_python_build_artifacts`* Add `_testclinic_limited` and `_testlimitedcapi` to ignored extensions* Add `python313.dll` to allowed libraries* Fix expected global extensions for 3.13* Allow `_PyWarnings_Init` to be missing on 3.13* Include 3.8 in `_PyWarnings_Init` case* Include `_xxsubinterpreters` in 3.8 extensions
vstinner commentedSep 5, 2024
I don't know the See alsopython/cpython#119696 which discuss making these patches upstream. I asked basic questions, but so far, no one replied:
|
vstinner commentedSep 5, 2024
It fails differently: |
zanieb commentedSep 5, 2024
Here's a patch to actually show the Docker error correctlyastral-sh#315 I can go through the CPython patches and see if one seems relevant. Generally I'm not familiar with contents of the patches though.
We'll chime in there. I don't understand why nobody has answered your basic questions — but we are happy to engage. |
vstinner commentedSep 5, 2024
I failed to reproduce the segfault on Linux without optimization (without PGO). I built Python 3.13 with I created The script runs successfully: Note: I cannot run |
zanieb commentedSep 5, 2024
Interesting! Thank you for sharing those details. I am a bit surprised by this — I was about to conjecture that we only see failures in the PGO builds because we don't actually (as far as I know) run the tests in other builds. It also seems surprising that the build that we're profiling for PGO would be different than the base build? I'll see if I can reproduce the macOS test failures locally. |
vstinner commentedSep 5, 2024
Ah, I can reproduce the crash when building with PGO optimization on my Linux Fedora 40: All containers are destroyed when |
zanieb commentedSep 5, 2024
Okay, similarly if I build with Then follow the instructions you wrote there the test passes without issue. Of course, the test I pulled a failure for on macOS is different ( I'm not sure if I should spend time trying to get |
zanieb commentedSep 5, 2024
You may be able to keep the container around by applying diff --git a/pythonbuild/buildenv.py b/pythonbuild/buildenv.pyindex 0ce3cd0..03860e9 100644--- a/pythonbuild/buildenv.py+++ b/pythonbuild/buildenv.py@@ -274,7 +274,6 @@ def build_environment(client, image): yield context finally: if container:- container.stop(timeout=0)- container.remove()+ pass else: td.cleanup() |
zanieb commentedSep 5, 2024
If the test passes in non-PGO build but fails in a PGO build does that mean that the BOLT instrumentation is causing the problem? Does applying this to the passing debug binary cause it to fail the test? |
vstinner commentedSep 5, 2024
I built Python 3.13.0rc1 on Fedora 40 with the following patches but I reverted configure (to avoid enforced cross-compilation). I fail to reproduce the Note: It seems like python-build-standalone is using musl C library instead of the glibc C library. I tried building Python with |
vstinner commentedSep 5, 2024
Maybe. Try to disable BOLT and see if you can still reproduce the issue? Then try to disable some patches and see if you can reproduce the issue. If yes, disable more patches. etc. I think that I spent enough time attempting to reproduce the issue, I'm clueless at this point. Good luck to identify the root cause :-) |
zanieb commentedSep 5, 2024
Thanks for trying! I appreciate it. I'll ping you if I learn anything interesting. |
zanieb commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It looks like I was correct and BOLT is the problem, the following succeeded for me: diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.shindex 8cb47ae..da40703 100755--- a/cpython-unix/build-cpython.sh+++ b/cpython-unix/build-cpython.sh@@ -352,9 +352,6 @@ fi if [ -n "${CPYTHON_OPTIMIZED}" ]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-optimizations"- if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" && -n "${BOLT_CAPABLE}" ]]; then- CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-bolt"- fi fi if [ -n "${CPYTHON_LTO}" ]; then Maybe helpfulllvm/llvm-project#59025 Unfortunately this isn't the problem on macOS so I'll need to figure something else out there still. |
zanieb commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Okay the issue on aarch64-macos with the duplicate implementations is that the tcl/tk libraries are linked twice. This ugly patch resolves it diff --git a/Makefile.pre.in b/Makefile.pre.inindex f9932ddab9d..ba73e3d62a0 100644--- a/Makefile.pre.in+++ b/Makefile.pre.in@@ -1432,6 +1432,12 @@ regen-re: $(BUILDPYTHON) $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/generate_re_casefix.py $(srcdir)/Lib/re/_casefix.py Programs/_testembed: Programs/_testembed.o $(LINK_PYTHON_DEPS)+ $(eval SYSLIBS := $(subst -Xlinker -hidden-ltcl8.6, , $(SYSLIBS)))+ $(eval SYSLIBS := $(subst -Xlinker -hidden-ltk8.6, , $(SYSLIBS)))+ $(eval LIBS := $(subst -Xlinker -hidden-ltcl8.6, , $(LIBS)))+ $(eval LIBS := $(subst -Xlinker -hidden-ltk8.6, , $(LIBS)))+ $(eval MODLIBS := $(subst -Xlinker -hidden-ltcl8.6, , $(MODLIBS)))+ $(eval MODLIBS := $(subst -Xlinker -hidden-ltk8.6, , $(MODLIBS))) $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) ############################################################################ I'll narrow this down to a single variable... |
A continuation of the wonderful work by@kpfleming in#264Adds initial support for Python 3.13 using CPython 3.13.0rc1.There are a few caveats and interesting details:- BOLT is disabled. There's a segmentation fault in the tests with the BOLT instrumented binaries. The BOLT optimizations are not critical, so we'll follow up on this separately. [See more context](zanieb#6 (comment)).- `mpdecimal` is now built from source on Windows. We already did this in Unix builds, but in Windows we were still using the bundled library. The bundled library is no longer used upstream and it seemed prudent to switch though it will remain available until 3.15. [See more context](zanieb#6 (comment)).- Apple cross-compilation is not available. I have a patch that adds support, but need to test it and it's not needed for these builds. [See more context](zanieb@447fb86).- `run_tests.py` was removed upstream. We provide a compatibility script that calls the appropriate command still so that our distributions are stable. We may want to change how `run_tests.py` is declared in the distribution metadata though. [See more context](#319 (comment)) .
Uh oh!
There was an error while loading.Please reload this page.
Replacing#5 — need a different branch name for my sanity.
Personal branch ofastral-sh#264 for testing.