-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Support python 3.12 on sagemath-standard #36407
Commits on Oct 9, 2023
-
py312: changes in PyLong internals
The layout for python integers changed in python 3.12. We add a module `sage.cpython.pycore_long` which copies the new (internal) api of PyLong from python 3.12. We also implement fallback version of these functions suitable for python pre-3.12. Note the files implementing the `pycore_long` module (`pycore_long.pxd` and `pycore_long.h`) are shared with fpylll and cypari2.
Configuration menu - View commit details
-
Copy full SHA for dc71bd0 - Browse repository at this point
Copy the full SHA dc71bd0View commit details -
In python 3.12, the `struct atexit_callback` was renamed to `struct atexit_py_callback`. The easiest workaround is to add `#define atexit_callback atexit_py_callback` in the right place when building using python 3.12 or newer.
Configuration menu - View commit details
-
Copy full SHA for 4d35af2 - Browse repository at this point
Copy the full SHA 4d35af2View commit details -
py312: disable cython profile=true in one file
Tracing has changed in python 3.12 in such a way that cython doesn't support it properly anymore. This one file sets `profile=true` for cython which won't work anymore (and it fails to build, at least with cython 0.29). We just disable that line. See also: cython/cython#5450
Configuration menu - View commit details
-
Copy full SHA for 2f31aa8 - Browse repository at this point
Copy the full SHA 2f31aa8View commit details -
py312: fix issue when including internal python header
To use some (internal) declarations related to dict type, we have to include `<internal/pycore_dict.h>` which needs `#define Py_BUILD_CORE` to be loaded. This causes trouble when `Python.h` was included before defining `Py_BUILD_CORE`, due to a macro `_PyGC_FINALIZED`. We fix it by undefining said macro.
Configuration menu - View commit details
-
Copy full SHA for c9c5026 - Browse repository at this point
Copy the full SHA c9c5026View commit details -
Some changes in ast, the old `node.n` and `node.s` are deprecated in favour of a common `node.value`. Making this change seems better than just ignoring the deprecation warning.
Configuration menu - View commit details
-
Copy full SHA for ca63dcf - Browse repository at this point
Copy the full SHA ca63dcfView commit details -
py312: filter deprecation warnings
This adds some filterwarnings that trigger with python 3.12. - deprecation of `datetime.datetime.utcfromtimestamp()` this is triggered by python modules `dateutil` and `sphinx`. - `os.fork()` and `os.ptyfork()` are deprecated when running multi-threaded; I don't see an easy way out of this, so ignore it. - itertools won't support pickling in python 3.14; let's ignore this for now with the hope there's an alternative before 3.14.
Configuration menu - View commit details
-
Copy full SHA for 7710fc0 - Browse repository at this point
Copy the full SHA 7710fc0View commit details -
py312: don't use
pkgutil.find_loader()
Is deprecated, and it can be replaced just fine with `importlib.util.find_spec()`.
Configuration menu - View commit details
-
Copy full SHA for 57a5468 - Browse repository at this point
Copy the full SHA 57a5468View commit details -
py312: fix
sage.misc.dev_tools.load_submodules()
Since `importer.find_module(...)` was removed in 3.12. We just follow the suggestion from https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly Note that the last three added lines here could be replaced instead by spec.loader.load_module(module_name) which works; however this is deprecated so it's better to use the recommended way using `importlib.util.module_from_spec(...)` and `spec.loader.execute_module(...)`.
Configuration menu - View commit details
-
Copy full SHA for 29e4ebd - Browse repository at this point
Copy the full SHA 29e4ebdView commit details -
py312: sum changed in python 3.12, fix doctest
In python < 3.12 we have sage: a = delta_qexp(1000) sage: sum(a[n]/float(n)^14 for n in range(1,1000)) 0.9985830631627459 This changed in python 3.12 to sage: sum(a[n]/float(n)^14 for n in range(1,1000)) 0.9985830631627461 The latter is the correct one as can be seen using rationals: sage: float(sum(a[n]/n^14 for n in range(1,1000))) 0.9985830631627461 As a workaround, we do the sum in reverse (from small to large terms), which gives the correct result in any case: sage: sum(a[n]/float(n)^14 for n in reversed(range(1,1000))) 0.9985830631627461
Configuration menu - View commit details
-
Copy full SHA for 07ee873 - Browse repository at this point
Copy the full SHA 07ee873View commit details -
py312: use dict instead of OrderedDict for consistent printing
In python 3.12 the printing of OrderedDict has been changed. As of Python 3.7, regular dicts are guaranteed to be ordered, so it's safe to replace OrderedDict by dict. Maybe convenient to replace other uses of OrderedDict, although this is out of scope of python 3.12 support.
Configuration menu - View commit details
-
Copy full SHA for 3600123 - Browse repository at this point
Copy the full SHA 3600123View commit details -
py312: fix crash in polyhedron face iterator
Running sage: g = Polyhedron().face_generator() sage: g.__next__() A -1-dimensional face of a Polyhedron in ZZ^0 sage: g.__next__() is supposed to raise `StopIteration`. However in python 3.12 the second call to `__next__()` leads to a crash. This is caused by a `return -1` in `next_face_loop()` which is supposed to mean `raise StopIteration`. Using raise explicitly fixes the crash.
Configuration menu - View commit details
-
Copy full SHA for 168063c - Browse repository at this point
Copy the full SHA 168063cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a1dd38 - Browse repository at this point
Copy the full SHA 0a1dd38View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a7cd3f - Browse repository at this point
Copy the full SHA 3a7cd3fView commit details
Commits on Oct 17, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 1cf3634 - Browse repository at this point
Copy the full SHA 1cf3634View commit details