Skip to content

Commit f346d6e

Browse files
author
Release Manager
committed
gh-40281: Remove programmatic usage of analyse() `analyse` is meant to be used by the user, it is (very likely, because of all the extra explanation) slower than `common_parent`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40281 Reported by: user202729 Reviewer(s):
2 parents 7bdfb22 + a4a4fd2 commit f346d6e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/sage/geometry/polyhedron/parent.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,7 @@ def _coerce_base_ring(self, other):
896896
if not other_ring.is_exact():
897897
other_ring = RDF # the only supported floating-point numbers for now
898898

899-
cm_map, cm_ring = get_coercion_model().analyse(self.base_ring(), other_ring)
900-
if cm_ring is None:
901-
raise TypeError(f'Could not coerce type {other} into ZZ, QQ, or RDF.')
902-
return cm_ring
899+
return get_coercion_model().common_parent(self.base_ring(), other_ring)
903900

904901
def _coerce_map_from_(self, X):
905902
r"""

src/sage/structure/coerce.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,9 @@ cdef class CoercionModel:
808808
elements or parents). If the parent of the result can be determined
809809
then it will be returned.
810810
811+
For programmatic usages, use :meth:`canonical_coercion` and
812+
:meth:`common_parent` instead.
813+
811814
EXAMPLES::
812815
813816
sage: cm = sage.structure.element.get_coercion_model()
@@ -938,6 +941,9 @@ cdef class CoercionModel:
938941
the actual morphism and action objects (rather than their string
939942
representations), then this is the function to use.
940943
944+
For programmatic usages, use :meth:`canonical_coercion` and
945+
:meth:`common_parent` instead.
946+
941947
EXAMPLES::
942948
943949
sage: cm = sage.structure.element.get_coercion_model()

0 commit comments

Comments
 (0)