Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
gh-89279: In ceval.c, redefine some macros for speed #32387
gh-89279: In ceval.c, redefine some macros for speed #32387
Changes from 17 commits
0be9d62
abd9118
1724056
50e3d7b
59da3bf
ab6660e
ae6b53c
01cff81
69da380
2894f6e
4b70976
5617fcd
a901b91
cceb531
26e8107
11084c0
b7dfcdc
9a5c57c
a8cba6e
c43ec56
9a15194
5c992d2
7b342e4
3b21c52
41cb067
87aaf81
3508f45
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only MSVC is affected, only redefine these macros for MSVC, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer us running the same code on all platforms if possible, so that it's less likely that someone accidentally breaks the Windows version by want appears to be an innocent change on Linux.
(I have to make an exception for load_relaxed because it is heavily platform-specific.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be extra safe, you may also check Py_REF_DEBUG, even if Py_REF_DEBUG should not be defined if Py_DEBUG is defined.
Or maybe object.h should fail with
#error
with Py_REF_DEBUG is defined whereas Py_DEBUG is not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such long line is one of the reason why I wrote PEP 670 :-) I propose to make the code more readable by putting one statement per line, as done in static inline functions:
I declared Py_XDECREF just after Py_DECREF. I also renamed "op1" to "xop" in Py_XDECREF.
UPDATE: Oh, and to copy/paste Py_IS_TYPE(), I used _PyObject_CAST_CONST().