Skip to content

Meson build: cached methods are broken if the source is unavailable #39735

@antonio-rojas

Description

@antonio-rojas

Steps To Reproduce

If the source used to build Sage (with meson) is not available at runtime in the same path where it was at build time, (some?) cached methods are completely broken.

  • Build sage with meson: python -m build --wheel --no-isolation
  • Install the produced wheel
  • Delete the sage source code

Expected Behavior

If the source is available:

$ python -c "from sage.all import QQ, PolynomialRing; print(PolynomialRing(QQ, 'x,y').gens_dict())"
{'x': x, 'y': y}

Actual Behavior

If the source is not available:

$ python -c "from sage.all import QQ, PolynomialRing; print(PolynomialRing(QQ, 'x,y').gens_dict())"
Traceback (most recent call last):
  File "category_object.pyx", line 857, in sage.structure.category_object.CategoryObject.getattr_from_category
KeyError: '_CategoryObject__gens_dict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from sage.all import QQ, PolynomialRing; PolynomialRing(QQ, 'x,y').gens_dict()
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "category_object.pyx", line 293, in sage.structure.category_object.CategoryObject.gens_dict
  File "category_object.pyx", line 851, in sage.structure.category_object.CategoryObject.__getattr__
  File "category_object.pyx", line 866, in sage.structure.category_object.CategoryObject.getattr_from_category
  File "getattr.pyx", line 363, in sage.cpython.getattr.getattr_from_other_class
AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular' object has no attribute '_CategoryObject__gens_dict'

Additional Information

No response

Environment

  • OS: Arch Linux, Python 3.13
  • Sage Version: 10.6.beta9

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions