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
I am not sure it is purely about Python types since it gets changed into C
code. (For reference, I changed your snippet to cpdef and got the same
result too.) It would be nice if there was an actual specification for
this in Cython. I just get slightly worried after getting translated into C
Hi Travis,
No, these routines are about the python types. They get used as `type(x) is
int` and `type(x) is long`. They are used in a different namespace from
`cdef int x` and `cdef long x` and cdef long long x` (well, the `x` is in
the cython object namespace. The C-types don't make it into
On Sun, Feb 25, 2024 at 9:48 AM Travis Scrimshaw wrote:
> Sorry for the delayed response.
>
> If the C compiler can't tell the difference between an int and a long,
> then that suggests that there is still a difference. I am not sure that
> Cython has any specification that these are different.
Sorry for the delayed response.
If the C compiler can't tell the difference between an int and a long, then
that suggests that there is still a difference. I am not sure that Cython
has any specification that these are different. My understanding is Cython
treats these as C types. Can we be
I tried removal here:
https://github.com/sagemath/sage/pull/37420
and as expected it looks like it's working fine.
On Wednesday 21 February 2024 at 19:06:50 UTC-8 Nils Bruin wrote:
> well, I don't expect the C compiler to be smart enough to recognise the
> second is an "elif False:", so the
well, I don't expect the C compiler to be smart enough to recognise the
second is an "elif False:", so the "hurt" would be in additional code
executed. Plus, having hidden "elif False:"s in a code base is a really bad
code smell, so I think there is a penalty. What do you want to guard
I think so, but it might not hurt to have it.
Best,
Travis
On Thursday, February 22, 2024 at 9:54:32 AM UTC+9 Nils Bruin wrote:
> I noticed the following cython code
>
> if S is long:
> return sage.rings.integer.long_to_Z()
> elif S is int:
> return