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 — bpo-38823: Clean up refleaks in _ast initialization. by brandtbucher · Pull Request #17276 · python/cpython

Conversation

@brandtbucher

@brandtbucher brandtbucher commented Nov 20, 2019 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

https://bugs.python.org/issue38823

Sorry, something went wrong.

Uh oh!

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

All reactions
brandtbucher added 2 commits November 19, 2019 23:52
@brandtbucher
Clean up refleaks in module initialization.
8e30e51
@brandtbucher
Regenerate _ast.
2c8a50f
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 20, 2019
@bedevere-bot bedevere-bot added the awaiting review label Nov 20, 2019
@brandtbucher brandtbucher added skip news type-bug An unexpected behavior, bug, or error labels Nov 20, 2019
@corona10
corona10 requested a review from vstinner November 24, 2019 16:23
corona10
corona10 approved these changes Nov 24, 2019
View reviewed changes

@corona10 corona10 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.

PR looks good to me.
The specific change is that error handling is done by the goto statement
and this decision is looking good to me for this situation.

@vstinner
Please take a look at @brandtbucher 's PR as the core developer.
Thank you for understanding.

Sorry, something went wrong.

Uh oh!

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

brandtbucher reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Nov 24, 2019
vstinner
vstinner reviewed Dec 5, 2019
View reviewed changes
Comment thread Parser/asdl_c.py Outdated
self.emit("if (!init_types()) return NULL;", 1)
self.emit('m = PyState_FindModule(&_astmodule);', 1)
self.emit("if (!m) return NULL;", 1)
self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) goto error;', 1)

@vstinner vstinner Dec 5, 2019

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.

Please add braces, see PEP 7.

Suggested change
self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) goto error;', 1)
self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) { goto error; }', 1)

Same for changes below.

Sorry, something went wrong.

Uh oh!

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

All reactions
@Yhg1s Yhg1s added the awaiting changes label Jan 3, 2020
@csabella

csabella commented Jan 26, 2020

Copy link
Copy Markdown
Contributor

@brandtbucher, please address the review comments. Thanks!

brandtbucher reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

brandtbucher added 2 commits January 27, 2020 19:56
@brandtbucher
Fix formatting.
5a2ec26
@brandtbucher
Fix remaining formatting.
2c30229
@brandtbucher

brandtbucher commented Jan 28, 2020

Copy link
Copy Markdown
Member Author

Sorry @vstinner, I didn't realize that PEP 7 applied to generated code. Fixed!

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher brandtbucher removed the awaiting changes label Jan 28, 2020
@isidentical isidentical mentioned this pull request Feb 5, 2020
bpo-1635741: Calling Py_INCREF() after PyModule_AddObject() success to run #18365
Closed
shihai1991
shihai1991 approved these changes Feb 6, 2020
View reviewed changes

@shihai1991 shihai1991 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.

Thanks, LGTM.

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
vstinner merged commit d2f9667 into python:master Feb 6, 2020
@bedevere-bot bedevere-bot removed the awaiting core review label Feb 6, 2020
@vstinner

vstinner commented Feb 6, 2020

Copy link
Copy Markdown
Member

I don't see the need to backport such change. Errors in _ast init function are very unlikely. I prefer to reduce the number of backported changes to stable branches to reduce the risk of regression.

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher

brandtbucher commented Feb 6, 2020

Copy link
Copy Markdown
Member Author

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher
brandtbucher deleted the _ast branch February 6, 2020 15:26
@brandtbucher
brandtbucher restored the _ast branch March 4, 2020 06:13
@brandtbucher
brandtbucher deleted the _ast branch July 21, 2022 20:01
@brandtbucher brandtbucher mentioned this pull request Apr 10, 2022
Improve stdlib module initialization error handling. #83004
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@corona10 corona10 corona10 approved these changes
@shihai1991 shihai1991 shihai1991 approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

skip news type-bug An unexpected behavior, bug, or error

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.

8 participants

@brandtbucher @csabella @vstinner @corona10 @shihai1991 @Yhg1s @the-knights-who-say-ni @bedevere-bot
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.