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

Replace Python 3.9 by 3.12 in Conda workflow #36431

Draft
wants to merge 26 commits into
base: develop
Choose a base branch
from

Commits on Oct 4, 2023

  1. py312: fix AttributeError doctests (sed changes)

    In python 3.12, attribute errors add a suggestion at the end of the
    usual error message ("Did you mean ...?").
    
    We add ... at the end of these doctest outputs to fix it.
    
    This commit has the bulk of the changes, obtained with:
    
        git grep -l "AttributeError:" src | xargs sed -ie \
            's/^ *\(AttributeError: .*\)\?has no attribute.*$/&.../'
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    bf4b9e5 View commit details
    Browse the repository at this point in the history
  2. py312: fix AttributeError doctests (manual changes)

    In python 3.12, attribute errors add a suggestion at the end of the
    usual error message ("Did you mean ...?").
    
    We add ... at the end of these doctest outputs to fix it.
    
    This commit has a few manual changes which didn't match the sed pattern
    in the previous commit.
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    f1b77b1 View commit details
    Browse the repository at this point in the history
  3. 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.
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    4e05725 View commit details
    Browse the repository at this point in the history
  4. py312: atexit_callback change

    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.
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    4ace19f View commit details
    Browse the repository at this point in the history
  5. 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
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    a676f6b View commit details
    Browse the repository at this point in the history
  6. 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.
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    6c69383 View commit details
    Browse the repository at this point in the history
  7. py312: use new api for ast

    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.
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    3b32f12 View commit details
    Browse the repository at this point in the history
  8. 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.
    tornaria committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    1a43ad6 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2023

  1. py312: don't use pkgutil.find_loader()

    Is deprecated, and it can be replaced just fine with
    `importlib.util.find_spec()`.
    tornaria committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    e46eec6 View commit details
    Browse the repository at this point in the history
  2. 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(...)`.
    tornaria committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    7fc35a6 View commit details
    Browse the repository at this point in the history
  3. 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
    tornaria committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    409c5bc View commit details
    Browse the repository at this point in the history
  4. 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.
    tornaria committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    9c1c7a0 View commit details
    Browse the repository at this point in the history
  5. 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.
    tornaria committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    93614fc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    352a4b6 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ef85779 View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2023

  1. Configuration menu
    Copy the full SHA
    34cc4d5 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2023

  1. Configuration menu
    Copy the full SHA
    38d206d View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2023

  1. Configuration menu
    Copy the full SHA
    f064baf View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2023

  1. Configuration menu
    Copy the full SHA
    7c1ac21 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f324e31 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2023

  1. Configuration menu
    Copy the full SHA
    33c20af View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2023

  1. Configuration menu
    Copy the full SHA
    e984bf0 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2023

  1. Configuration menu
    Copy the full SHA
    2809a33 View commit details
    Browse the repository at this point in the history

Commits on Dec 27, 2023

  1. Configuration menu
    Copy the full SHA
    42cf706 View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2024

  1. Configuration menu
    Copy the full SHA
    555ca00 View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2024

  1. Configuration menu
    Copy the full SHA
    e0cd6bb View commit details
    Browse the repository at this point in the history