I went to type some sagelib code into ipython this morning, and got a
circular import error. The simplest reproducer is,

  $ python -q
  >>> from sage.rings.integer_ring import ZZ
  ...
  ImportError: cannot import name 'ZZ' from partially initialized module
  'sage.rings.integer_ring' (most likely due to a circular import)
  (/home/mjo/.../integer_ring.cpython-313-riscv64-linux-musl.so)

This particular instance is from the loop,

  integer_ring -> integer
               -> rational
               -> rational_field
               -> categories/finite_fields
               -> integer_ring

which is easily fixable. Yet after fixing it, I still get an
AttributeError from the integer <-> integer_ring loop:

  $ python -q
  >>> from sage.rings.integer_ring import ZZ
  Traceback (most recent call last):
    File "<python-input-0>", line 1, in <module>
      from sage.rings.integer_ring import ZZ
    File "sage/rings/integer_ring.pyx", line 1, in init sage.rings.integer_ring
      r"""
    File "sage/rings/integer.pyx", line 312, in init sage.rings.integer
      cdef Parent the_integer_ring = integer_ring.ZZ
  AttributeError: partially initialized module
  'sage.rings.integer_ring' from
  '/home/mjo/.../integer_ring.cpython-313-riscv64-linux-musl.so'
  has no attribute 'ZZ' (most likely due to a circular import)

This has me confused. I'm certain I've imported ZZ from python before,
and I'm also pretty sure that the integer <-> integer_ring loop is not
new.

Has anything else changed? Is it just me? (This requires sagelib to be
installed as a python package via pip, meson, or a package manager; it
works fine from within a sage prompt.)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/aNQFbtxtRcU2xMIf%40mertle.

Reply via email to