On Tuesday 27 February 2024 at 18:09:42 UTC-8 Travis Scrimshaw wrote: I am not sure it is purely about Python types since it gets changed into C code.
well ... code dealing with python ints in Py3 needs to deal with multi-precision PyInt objects, so it can't unwrap these. Whether they are internally represented as "compact" integers is an implementation detail (see https://docs.python.org/3/c-api/long.html#c.PyUnstable_Long_IsCompact) I have no succeeded in finding the exact place where the bindings for the `int` and `long` names are made for the cython namespace -- but we've already established that they refer in runtime to identical objects. This was a reasonable indication: https://github.com/cython/cython/blob/03d982be010b7b94a3c3317c462b2b803ce916af/Cython/Compiler/Code.py#L46-L47 and for pure python mode, there are the type wrappers: https://github.com/cython/cython/blob/03d982be010b7b94a3c3317c462b2b803ce916af/Cython/Shadow.py#L426-L427 (where we also see the instructive comment for `py_long` "# for legacy Py2 code only" -- so I think cython is indeed only keeping "long" bound for legacy reasons) On the original ticket we actually found that `int_to_Z` was really just literally kept from Py2, so was actually buggy! (in Py2, a py_int was guaranteed to fit in a system integer, but in Py3 it's just a multiprec integer) So removing it was actually beneficial (although it was only used in a dead branch of the code, so can code that is guaranteed to be never called be buggy?) -- 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 sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/34d80bc9-c77b-4c74-a758-510ad4595c6dn%40googlegroups.com.