-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-111354: remove comparisons with enum values, variable reuse, unused imports in genobject.c #111708
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
Conversation
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.
A few comments
/* Push arg onto the frame's value stack */ | ||
result = arg ? arg : Py_None; | ||
_PyFrame_StackPush(frame, Py_NewRef(result)); | ||
PyObject *arg_obj = arg ? arg : Py_None; |
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.
Would it make sense to require arg
to be not NULL
? This is a static function, so we know all the callers.
(Not necessarily in this PR, though)
Include/internal/pycore_frame.h
Outdated
@@ -45,6 +45,7 @@ typedef enum _framestate { | |||
} PyFrameState; | |||
|
|||
#define FRAME_STATE_SUSPENDED(S) ((S) == FRAME_SUSPENDED || (S) == FRAME_SUSPENDED_YIELD_FROM) | |||
#define FRAME_STATE_CLOSED(S) ((S) >= FRAME_COMPLETED) |
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.
Does the state being FRAME_COMPLETED
mean that it is closed?
Can't it be completed, but not closed?
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.
There is no CLOSED state. There is COMPLETED and CLEARED. CLOSED is a new category of both. Maybe FINISHED is a better name for this.
… unused imports in genobject.c (python#111708)
… unused imports in genobject.c (python#111708)
Tidies up genobject.c:
result
variable for thearg
Reviewing individual commits might be easier.