GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-111354: remove comparisons with enum values, variable reuse, unused imports in genobject.c by iritkatriel · Pull Request #111708 · python/cpython

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Nov 3, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Tidies up genobject.c:

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

Reviewing individual commits might be easier.

  • Issue: remove hacks in genobject.c #111354

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iritkatriel added 4 commits November 3, 2023 17:15
@iritkatriel
inline exc_state_traverse
367f548
@iritkatriel
remove comparisons with frame states
470f82e
@iritkatriel
variable reused for two different purposes
3dc7586
@iritkatriel
remove unused #includes
677fc3e
@iritkatriel
iritkatriel requested a review from markshannon as a code owner November 3, 2023 18:17
@bedevere-app bedevere-app Bot added the awaiting core review label Nov 3, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Nov 3, 2023
remove hacks in genobject.c #111354
Closed
iritkatriel and others added 3 commits November 3, 2023 18:45
@iritkatriel
add RESUME_WITH_SUBITERATOR macro
0936160
@iritkatriel
Merge branch 'main' into genobject
e7a4b70
@iritkatriel
Merge branch 'main' into genobject
8bba3dc
@iritkatriel iritkatriel added the skip news label Nov 6, 2023
markshannon
markshannon reviewed Nov 6, 2023
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Objects/genobject.c
/* 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;

@markshannon markshannon Nov 6, 2023

Copy link
Copy Markdown
Member

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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iritkatriel reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Objects/genobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Include/internal/pycore_frame.h Outdated
} PyFrameState;

#define FRAME_STATE_SUSPENDED(S) ((S) == FRAME_SUSPENDED || (S) == FRAME_SUSPENDED_YIELD_FROM)
#define FRAME_STATE_CLOSED(S) ((S) >= FRAME_COMPLETED)

@markshannon markshannon Nov 6, 2023

Copy link
Copy Markdown
Member

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iritkatriel iritkatriel Nov 6, 2023

Copy link
Copy Markdown
Member Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iritkatriel added 2 commits November 6, 2023 19:55
@iritkatriel
Revert "add RESUME_WITH_SUBITERATOR macro"
6bd958c
This reverts commit 0936160.
@iritkatriel
FRAME_STATE_CLOSED --> FRAME_STATE_FINISHED
1f30519
markshannon
markshannon approved these changes Nov 9, 2023
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Nov 9, 2023
@iritkatriel
iritkatriel merged commit 30ec968 into python:main Nov 9, 2023
@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 9, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@iritkatriel @aisk
pythongh-111354: remove comparisons with enum values, variable reuse,…
881ecbb
… unused imports in genobject.c (python#111708)
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@iritkatriel @Glyphack
pythongh-111354: remove comparisons with enum values, variable reuse,…
2af823b
… unused imports in genobject.c (python#111708)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@iritkatriel @markshannon
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.