-
-
Notifications
You must be signed in to change notification settings - Fork 684
Closed
Labels
Description
Steps To Reproduce
sage: P.<x,y> = QQ[]
sage: x.leading_coefficient()
Expected Behavior
Not sure. I think the method is new (i.e. this used to raise an AttributeError). It should probably do the same as lc(), at least if the definitions are compatible.
Actual Behavior
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File ~/co/sage/src/sage/categories/modules_with_basis.py:1676, in ModulesWithBasis.ElementMethods.support(self)
1675 try:
-> 1676 return self._support_view
1677 except AttributeError:
File ~/co/sage/src/sage/structure/element.pyx:495, in sage.structure.element.Element.__getattr__()
494 """
--> 495 return self.getattr_from_category(name)
496
File ~/co/sage/src/sage/structure/element.pyx:508, in sage.structure.element.Element.getattr_from_category()
507 cls = P._abstract_element_class
--> 508 return getattr_from_other_class(self, cls, name)
509
File ~/co/sage/src/sage/cpython/getattr.pyx:363, in sage.cpython.getattr.getattr_from_other_class()
362 dummy_error_message.name = name
--> 363 raise AttributeError(dummy_error_message)
364 attribute = <object>attr
AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular' object has no attribute '_support_view'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 x.leading_coefficient()
File ~/co/sage/src/sage/categories/modules_with_basis.py:1923, in ModulesWithBasis.ElementMethods.leading_coefficient(self, *args, **kwds)
1896 def leading_coefficient(self, *args, **kwds):
1897 r"""
1898 Return the leading coefficient of ``self``.
1899
(...)
1921 -5
1922 """
-> 1923 return self.leading_item(*args, **kwds)[1]
File ~/co/sage/src/sage/categories/modules_with_basis.py:1864, in ModulesWithBasis.ElementMethods.leading_item(self, *args, **kwds)
1831 def leading_item(self, *args, **kwds):
1832 r"""
1833 Return the pair ``(k, c)`` where
1834
(...)
1862 ([3], -5)
1863 """
-> 1864 k = self.leading_support(*args, **kwds)
1865 return k, self[k]
File ~/co/sage/src/sage/categories/modules_with_basis.py:1829, in ModulesWithBasis.ElementMethods.leading_support(self, *args, **kwds)
1802 def leading_support(self, *args, **kwds):
1803 r"""
1804 Return the maximal element of the support of ``self``.
1805
(...)
1827 [3]
1828 """
-> 1829 return max(self.support(), *args, **kwds)
File ~/co/sage/src/sage/categories/modules_with_basis.py:1680, in ModulesWithBasis.ElementMethods.support(self)
1678 from sage.structure.support_view import SupportView
1679 zero = self.parent().base_ring().zero()
-> 1680 mc = self.monomial_coefficients(copy=False)
1681 support_view = SupportView(mc, zero=zero)
1682 try:
1683 # Try to cache it for next time, but this may fail for Cython classes
TypeError: monomial_coefficients() got an unexpected keyword argument 'copy'
Additional Information
Probably an unintended consequence of #38767. The same issue likely applies to leading_monomial() and possibly some other methods.
Environment
Sage 10.5.rc0
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