Skip to content

Conversation

GiacomoPope
Copy link
Contributor

Currently there is a call to x.parent() which crashes for x of type int, but I think it should silently coerce to ZZ

Currently there is a call to `x.parent()` which crashes for `x` of type `int`, but I think it should silently coerce to `ZZ`
Copy link

github-actions bot commented Sep 5, 2025

Documentation preview for this PR (built with commit 33c5ebc; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@user202729
Copy link
Contributor

user202729 commented Sep 6, 2025

Use py_scalar_to_element instead. We do support elliptic curves over RDF and such.

hopefully it's not slower.

(speaking of which… rg -U 'isinstance.*\<int\).*\n.*Integer' return a huge number of cases.)

@GiacomoPope
Copy link
Contributor Author

What's the benefit of this?

There's already the later lines which handle coercion between the parent of x and the ring of the curve -- this commit was to fix the issue with int especially.

Are you suggesting to change more of the coercion here?

@user202729
Copy link
Contributor

user202729 commented Sep 6, 2025

sage: E = EllipticCurve(RDF, [1, 2])
sage: E.lift_x(1.0r)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
...
AttributeError: 'float' object has no attribute 'parent'
sage: E.lift_x(RDF(1.0))
(1.0 : -2.0 : 1.0)

@GiacomoPope
Copy link
Contributor Author

Oh thanks. I understand now

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 7, 2025
Currently there is a call to `x.parent()` which crashes for `x` of type
`int`, but I think it should silently coerce to `ZZ`

URL: sagemath#40772
Reported by: Giacomo Pope
Reviewer(s):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants