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: Convert _sre types to heap types and establish module state (PEP 384) by erlend-aasland · Pull Request #23393 · python/cpython

Conversation

@erlend-aasland

@erlend-aasland erlend-aasland commented Nov 19, 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
Erlend E. Aasland added 8 commits November 19, 2020 09:55
Erlend E. Aasland
Add convenience macro
78b9d53
Erlend E. Aasland
Convert _sre pattern type to heap type
ce746b3
Erlend E. Aasland
Convert _sre match type to heap type
529142d
Erlend E. Aasland
Convert _sre scanner type to heap type
7583104
Erlend E. Aasland
Establish global module state and add types to it
575fccf
Erlend E. Aasland
Convert global state to module state
f82463c
Erlend E. Aasland
Convert _sre to multi-phase initialisation
63ad0f1
Erlend E. Aasland
Add NEWS
27134f0
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 19, 2020
@bedevere-bot bedevere-bot added the awaiting review label Nov 19, 2020
@erlend-aasland

erlend-aasland commented Nov 19, 2020

Copy link
Copy Markdown
Contributor Author

@vstinner / @corona10: Would you mind reviewing this?

All reactions

Sorry, something went wrong.

Uh oh!

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

tiran
tiran suggested changes Nov 19, 2020
View reviewed changes

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

See inline comments

While you are working on the module, please remove PyModule_GetDict() and replace the code with PyModule_AddStringConstant().

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Modules/_sre.c Resolved

Uh oh!

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

Comment thread Modules/_sre.c Resolved

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting review label Nov 19, 2020
@bedevere-bot

bedevere-bot commented Nov 19, 2020

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added the awaiting changes label Nov 19, 2020
@erlend-aasland

erlend-aasland commented Nov 19, 2020

Copy link
Copy Markdown
Contributor Author

See inline comments

While you are working on the module, please remove PyModule_GetDict() and replace the code with PyModule_AddStringConstant().

I could merge #23101 into this PR. Would that be acceptable?

All reactions

Sorry, something went wrong.

Uh oh!

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

@tiran

tiran commented Nov 19, 2020

Copy link
Copy Markdown
Member

See inline comments
While you are working on the module, please remove PyModule_GetDict() and replace the code with PyModule_AddStringConstant().

I could merge #23101 into this PR. Would that be acceptable?

+1, good idea

You'll get bonus points for using PyModule_AddObjectRef.

erlend-aasland reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland

erlend-aasland commented Nov 19, 2020

Copy link
Copy Markdown
Contributor Author

You'll get bonus points for using PyModule_AddObjectRef.

GH-23101 merged with commit 38e3cd7.

All reactions

Sorry, something went wrong.

Uh oh!

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

Erlend E. Aasland added 3 commits November 19, 2020 10:54
Erlend E. Aasland
Address Heimes' review: improve module state naming
1c925b9
Erlend E. Aasland
Merge pythonGH-23101
12bf771
Erlend E. Aasland
Update clinic
0f10f7d
@erlend-aasland
erlend-aasland force-pushed the bpo-1635741/sre branch from 2aaa00a to 0f10f7d Compare November 19, 2020 09:55
Erlend E. Aasland
Address Heimes' review: Drop using _PyType_GetModuleByDef
bdd1338
@erlend-aasland
erlend-aasland force-pushed the bpo-1635741/sre branch from 6e6ab04 to bdd1338 Compare November 19, 2020 10:18
Erlend E. Aasland
Adjust idlelib tiptest
a6bc481
from Lib/idlelib/idle_test/test_calltip.py:
The tests of builtins may break if inspect or the docstrings change,
but a red buildbot is better than a user crash (as has happened).
For a simple mismatch, change the expected output to the actual.
@erlend-aasland
erlend-aasland requested a review from terryjreedy as a code owner November 19, 2020 11:19
@erlend-aasland

erlend-aasland commented Nov 19, 2020

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Nov 19, 2020
@bedevere-bot

bedevere-bot commented Nov 19, 2020

Copy link
Copy Markdown

Thanks for making the requested changes!

@tiran: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

tiran
tiran reviewed Nov 19, 2020
View reviewed changes

@tiran tiran 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!

I'm leaving the final ack to @corona10 and @vstinner

Sorry, something went wrong.

Uh oh!

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

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
corona10
corona10 previously approved these changes Nov 19, 2020
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.

lgtm awesome,

I ran manually some tests and works well.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting change review labels Nov 19, 2020
corona10
corona10 reviewed Nov 19, 2020
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.

But I want to know why this behavior is changed.

master

>>> import re
>>> p = re.compile('')
>>> p.sub.__doc__
'Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.'

PR

>>> import re
>>> p = re.compile('')
>>> p.sub.__doc__
None

Sorry, something went wrong.

Uh oh!

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

All reactions
@corona10
corona10 dismissed their stale review November 19, 2020 13:12

pending

@erlend-aasland

erlend-aasland commented Nov 19, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

But I want to know why this behavior is changed.

I find that odd as well. At first, I though it was just the AC that messed up the argument list, but it's not. The docstring is clearly there in line 1214. Try this:

>>> import re
>>> p = re.compile('')
>>> help(p.sub)

It seems to happen only with methods with the defining_class converter. Could it be a bug in AC?

UPDATE

Seems like dbm has the same problem. For example, the _dbm.dbm.keys method, which also has a defining_class converter, and is a method defined on a type belonging to the module:

>>> import dbm
>>> d = dbm.open('test.db', 'c')
>>> d
<_gdbm.gdbm object at 0x103eeb500>
>>> d.keys.__doc__  # <= this returns None iso. the docstring as defined in AC
>>> help(d.keys)    # <= this displays the docstring as defined in AC
All reactions

Sorry, something went wrong.

Uh oh!

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

Erlend E. Aasland
Revert "Adjust idlelib tiptest"
2fd3bd1
This reverts commit a6bc481.
@erlend-aasland

erlend-aasland commented Nov 19, 2020

Copy link
Copy Markdown
Contributor Author

@corona10 or @tiran can you remove Terry J. Reedy as reviewer? Adjusting the idlelib test was a bad idea. Dong-hee Na is right; there's something fishy about the __doc__ attributes for some of the methods.

All reactions

Sorry, something went wrong.

Uh oh!

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

terryjreedy
terryjreedy requested changes Nov 19, 2020
View reviewed changes
Comment thread Lib/idlelib/idle_test/test_calltip.py Resolved

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting merge label Nov 19, 2020
@bedevere-bot

bedevere-bot commented Nov 19, 2020

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added the awaiting changes label Nov 19, 2020
@terryjreedy terryjreedy closed this Nov 20, 2020
@terryjreedy

terryjreedy commented Nov 20, 2020

Copy link
Copy Markdown
Member

Actually, tests should pass now because test runners will use revised idlelib.

erlend-aasland 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.

@terryjreedy terryjreedy reopened this Nov 20, 2020
terryjreedy
terryjreedy approved these changes Nov 20, 2020
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting changes labels Nov 20, 2020
@terryjreedy

terryjreedy commented Nov 20, 2020

Copy link
Copy Markdown
Member

@tiran The IDLE test failure is gone. Do you still want changes?

All reactions

Sorry, something went wrong.

Uh oh!

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

Erlend E. Aasland
Merge branch 'master' into bpo-1635741/sre
d9ca7a6
@erlend-aasland

erlend-aasland commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

@corona10 IDLE has been fixed, so tests pass fine now. I'll file an issue about the missing __doc__ strings in builtin methods.

All reactions

Sorry, something went wrong.

Uh oh!

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

corona10
corona10 approved these changes Nov 20, 2020
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.

lgtm

Sorry, something went wrong.

Uh oh!

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

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@corona10
corona10 merged commit a6109ef into python:master Nov 20, 2020
@bedevere-bot bedevere-bot removed the awaiting merge label Nov 20, 2020
@erlend-aasland erlend-aasland mentioned this pull request Nov 20, 2020
bpo-42243: Use PyModule_Add*() in _sre iso. direct module dict manipulation #23101
Closed
@erlend-aasland
erlend-aasland deleted the bpo-1635741/sre branch November 20, 2020 15:02
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Erlend Egeberg Aasland @adorilson
bpo-1635741: Convert _sre types to heap types and establish module st…
acdf30c
…ate (PEP 384) (pythonGH-23393)
@serhiy-storchaka serhiy-storchaka mentioned this pull request Apr 15, 2022
Regression in the AC generated code #91583
Closed
@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

@corona10 corona10 corona10 approved these changes
@terryjreedy terryjreedy terryjreedy approved these changes
+1 more reviewer
@tiran tiran tiran requested changes
Reviewers whose approvals may not affect merge requirements

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

@erlend-aasland @bedevere-bot @tiran @terryjreedy @corona10 @the-knights-who-say-ni
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.