Skip to content

free-threading: one test failure #167

@neutrinoceros

Description

@neutrinoceros

I'm starting to study this lib's needs to support free-threading Python.
First things first; I found a failure in the existing test suite in free-threading python 3.13:

______________________________________ [doctest] README.rst _______________________________________
091   86400.0
092 
093 It is also possible to use the ufuncs directly, though then one has to
094 deal with the warning and error states explicitly.  For instance, compare::
095 
096   >>> erfa.jd2cal(-600000., [0, 1, 2, 3])
097   Traceback (most recent call last):
098   ...
099   ErfaError: ERFA function "jd2cal" yielded 4 of "unacceptable date (Note 1)"
100   >>> erfa.ufunc.jd2cal(-600000., [0, 1, 2, 3])
Expected:
    (array([-1, -1, -1, -1], dtype=int32),
     ...,
     array([-1, -1, -1, -1], dtype=int32))
Got:
    (array([0, 0, 0, 0], dtype=int32), array([0, 0, 0, 0], dtype=int32), array([0, 0, 0, 0], dtype=int32), array([0., 0., 0., 0.]), array([-1, -1, -1, -1], dtype=int32))

/Users/clm/dev/astropy-project/liberfa/pyerfa/README.rst:100: DocTestFailure
======================================== warnings summary =========================================
README.rst::README.rst
  /Users/clm/dev/astropy-project/liberfa/pyerfa/erfa/_dev/scm_version.py:21: UserWarning: liberfa/erfa not at a tagged release, but at <ScmVersion 2.0.1 dist=0 node=g9915ba3 dirty=True branch=HEAD>
    warn(f'liberfa/erfa not at a tagged release, but at {erfa_version}')

README.rst::README.rst
  <frozen importlib._bootstrap>:488: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'erfa.ufunc', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================== short test summary info =====================================
FAILED README.rst::README.rst
================================== 1 failed, 2 warnings in 0.17s ==================================

So, there are two independent problems that surface here:

  • the GIL is actually re-enabled at runtime (this can be worked-around with PYTHON_GIL=0, and there's no need to declare support until it's properly tested)
  • this test actually fails. I haven't dug through it yet (but plan to), so it seems plausible at this stage that the bug isn't necessarily in pyerfa but could be in Cython or numpy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions