Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
iritkatriel merged 9 commits intopython:mainfromiritkatriel:genobject
Nov 9, 2023

Conversation

iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedNov 3, 2023
edited by bedevere-appbot
Loading

Tidies up genobject.c:

  • remove unused imports
  • inline a one-line function that is only called once
  • do not reuse theresult variable for thearg
  • remove comparisons with frame state enum values

Reviewing individual commits might be easier.

Copy link
Member

@markshannonmarkshannon left a 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;
Copy link
Member

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 requirearg to be notNULL? This is a static function, so we know all the callers.
(Not necessarily in this PR, though)

iritkatriel reacted with thumbs up emoji
@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Does the state beingFRAME_COMPLETED mean that it is closed?
Can't it be completed, but not closed?

Copy link
MemberAuthor

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.

@iritkatrieliritkatriel merged commit30ec968 intopython:mainNov 9, 2023
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@markshannonmarkshannonmarkshannon approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@iritkatriel@markshannon

[8]ページ先頭

©2009-2025 Movatter.jp