New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py3: several long/int related fixes #24588
Comments
comment:1
I think this uses |
comment:2
Several quick comments:
And you sure that you need the
|
comment:4
Replying to @jdemeyer:
Yes, I think when I wrote that one bit I just forgot I was in a Cython module. |
comment:5
Replying to @jdemeyer:
I believe so. In Python 2 we need both |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:9
does not apply |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:11
Well, it does now... |
comment:12
First of all, the check for
by
|
comment:14
Can you explain this a little more? I used to have the latter but I changed it because in the past you've told me to use |
comment:15
Also, I'm not entirely convinced by the logic in |
Last 10 new commits:
|
comment:39
I had already fixed those things... I'm not sure why this change:
Why a relatively slow |
comment:40
Replying to @embray:
But not in a branch on this ticket.
First of all, it's not at all slow. This uses #define PyLong_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) This shouldn't take any measurable time. The reason that I changed it is because I want to check the actual condition that I need: it must be an actual Python |
comment:41
I think by the time I pushed my fixes you changed it to your branch. I see now, upon closer inspection, that |
comment:42
While you're at it, one (small) gripe I have with |
comment:43
To be honest, it was not easy to decide the API for But that shouldn't affect the status of this ticket. |
comment:44
Replying to @embray:
Then the only information that you have is that the object is an integer of some sort where you don't care about its value. To me, that sounds unlikely so I wonder where it came up. |
comment:45
Replying to @jdemeyer:
Perhaps you're right. I definitely remember times during development where I wanted this, but I think maybe it was only while testing things and ignoring the error value. Unless a specific example comes up again I won't worry about it. The other thing I would still change. It doesn't make sense to have a superfluous |
comment:46
Replying to @embray:
I think it does make sense. It doesn't hurt and it's a safety net against calling |
comment:47
Please re-read #24588 comment:41. The (as you wrote, somewhat loose to begin with) API for |
comment:48
The following small change is all I'm suggesting. This brings the API for New commits:
|
Changed branch from u/jdemeyer/python3/long-int-fixes to u/embray/python3/long-int-fixes |
comment:49
I don't agree entirely with this change: @@ -176,10 +176,11 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
err[0] = ERR_OVERFLOW
return 1
elif PyIndex_Check(x):
- err[0] = ERR_INDEX
+ err[0] = 0
try:
x = PyNumber_Index(x)
except TypeError:
+ err[0] = ERR_INDEX
return 0
return integer_check_long_py(x, value, err)
else: It seems safer and more natural to set I just reverted that. If you agree, you can set positive review. |
Changed branch from u/embray/python3/long-int-fixes to u/jdemeyer/python3/long-int-fixes |
Changed author from Erik Bray to Erik Bray, Jeroen Demeyer |
comment:51
Yep, I think I was misunderstanding what New commits:
|
Changed branch from u/jdemeyer/python3/long-int-fixes to |
These fix a number of major crashes related to handling of Python
int
s on Python 3, especially in cases that were trying to cram them into Clong
s.CC: @jdemeyer @fchapoton
Component: python3
Author: Erik Bray, Jeroen Demeyer
Branch/Commit:
5ed4bda
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/24588
The text was updated successfully, but these errors were encountered: