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-1635741: port pyexpat to multi-phase init (PEP 489) by koubaa · Pull Request #22222 · python/cpython

Conversation

@koubaa

@koubaa koubaa commented Sep 13, 2020 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue1635741

Sorry, something went wrong.

Uh oh!

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

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Sep 13, 2020
@bedevere-bot bedevere-bot added the awaiting review label Sep 13, 2020
@koubaa

koubaa commented Sep 13, 2020

Copy link
Copy Markdown
Contributor Author

@vstinner @corona10 @shihai1991 please review.

There's PyCapsule_New usage but the capsule methods did not depend on any globals so it isn't a concern in this case.

rsumner868 reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

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

shihai1991
shihai1991 reviewed Sep 13, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

@shihai1991

shihai1991 commented Sep 13, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

compile warning in here:

##[warning]/home/runner/work/cpython/cpython/Modules/pyexpat.c:1185:1: warning: ‘xmlparse_dealloc’ defined but not used [-Wunused-function]
 xmlparse_dealloc(xmlparseobject *self)
 ^~~~~~~~~~~~~~~~
All reactions

Sorry, something went wrong.

Uh oh!

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

shihai1991
shihai1991 reviewed Sep 13, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

@koubaa

koubaa commented Sep 13, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

compile warning in here:

##[warning]/home/runner/work/cpython/cpython/Modules/pyexpat.c:1185:1: warning: ‘xmlparse_dealloc’ defined but not used [-Wunused-function]
 xmlparse_dealloc(xmlparseobject *self)
 ^~~~~~~~~~~~~~~~

Oops, I forgot to add this to the type slots. Should be fixed now

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner
vstinner reviewed Sep 15, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

vstinner
vstinner reviewed Sep 21, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

vstinner
vstinner reviewed Sep 22, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

vstinner
vstinner reviewed Sep 23, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Outdated

@vstinner vstinner Sep 23, 2020

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.

DECREF is needed on error, no? Same comment for the following PyModule_AddObject calls.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Outdated

@vstinner vstinner Sep 23, 2020

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.

I would prefer to "goto error" if PyModule_New() fails.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

@vstinner

vstinner commented Sep 23, 2020

Copy link
Copy Markdown
Member

Maybe it would be simpler to extract changes which add error handling to the exec function, and write a second PR to convert the module to multi-phase init. Since the existing code basically has no code to handle errors :-(

You can rename pyexpat_exec() to PyInit_pyexpat() and just add Py_DECREF(m) in "goto error".

All reactions

Sorry, something went wrong.

Uh oh!

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

@koubaa koubaa mentioned this pull request Oct 2, 2020
bpo-1635741: pyexpat error handling #22489
Merged
@vstinner

vstinner commented Oct 2, 2020

Copy link
Copy Markdown
Member

I would prefer to get PR #22489 merged before this one, to ease review ;-)

All reactions

Sorry, something went wrong.

Uh oh!

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

@koubaa
koubaa force-pushed the bpo-1635741-pyexpat branch from bf06df6 to c483618 Compare November 7, 2020 02:07
@koubaa

koubaa commented Nov 7, 2020

Copy link
Copy Markdown
Contributor Author

@vstinner rebased and I think ready to go. Please review

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner
vstinner reviewed Nov 12, 2020
View reviewed changes
Comment thread Modules/pyexpat.c Resolved

Uh oh!

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

koubaa added 3 commits November 15, 2020 11:24
@koubaa
port to multi-phase init
731d859
@koubaa
blurb
22ecb23
@koubaa
improve ref counting
5262887
@koubaa
koubaa force-pushed the bpo-1635741-pyexpat branch from c483618 to 5262887 Compare November 15, 2020 17:32
@erlend-aasland

erlend-aasland commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

Shouldn't handler_info also be a part of the module state?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit c8a87ad into python:master Jan 4, 2021
@bedevere-bot bedevere-bot removed the awaiting review label Jan 4, 2021
@vstinner

vstinner commented Jan 4, 2021

Copy link
Copy Markdown
Member

@shihai1991 made expat_CAPI per module instance in commit 7c83eaa.

I merged the PR, thanks @koubaa!

Shouldn't handler_info also be a part of the module state?

Hum. It doesn't contain anything dynamically allocated. It's a static array of static data. I don't think that we have to make it per instance.

erlend-aasland and shihai1991 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
@koubaa @adorilson
bpo-1635741: Port pyexpat to multi-phase init (PEP 489) (pythonGH-22222)
08043d6
@kylotan kylotan mannequin mentioned this pull request Sep 19, 2022
Py_Finalize() doesn't clear all Python objects at exit #44470
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
@shihai1991 shihai1991 shihai1991 left review comments

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

6 participants

@koubaa @shihai1991 @vstinner @erlend-aasland @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.