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-43680: _pyio.open() becomes a static method by vstinner · Pull Request #25354 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Apr 12, 2021 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

The Python _pyio.open() function becomes a static method to behave as
io.open() built-in function: don't become a bound method when stored
as a class variable. It becomes possible since static methods are now
callable in Python 3.10. Moreover, _pyio.OpenWrapper becomes a simple
alias to _pyio.open.

init_set_builtins_open() now sets builtins.open to io.open, rather
than setting it to io.OpenWrapper, since OpenWrapper is now an alias
to open in the io and _pyio modules.

https://bugs.python.org/issue43680

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
bpo-43680: _pyio.open() becomes a static method
3aa6d18
The Python _pyio.open() function becomes a static method to behave as
io.open() built-in function: don't become a bound method when stored
as a class variable. It becomes possible since static methods are now
callable in Python 3.10. Moreover, _pyio.OpenWrapper becomes a simple
alias to _pyio.open.

init_set_builtins_open() now sets builtins.open to io.open, rather
than setting it to io.OpenWrapper, since OpenWrapper is now an alias
to open in the io and _pyio modules.
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Apr 12, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Apr 12, 2021
@vstinner

vstinner commented Apr 12, 2021

Copy link
Copy Markdown
Member Author

@methane: Would you mind to review this change?

Thanks to https://bugs.python.org/issue43682, it becomes possible to put @staticmethod on _pyio.open. I propose to start with this change. Then I will propose a change to deprecate io.OpenWrapper and _pyio.OpenWrapper.

All reactions

Sorry, something went wrong.

Uh oh!

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

methane
methane reviewed Apr 12, 2021
View reviewed changes

@methane methane 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 except one nitpick.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Misc/NEWS.d/next/Library/2021-04-12-09-57-37.bpo-43680.o1zEk_.rst Resolved

Uh oh!

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

vstinner and others added 2 commits April 12, 2021 10:13
@vstinner @methane
Update Misc/NEWS.d/next/Library/2021-04-12-09-57-37.bpo-43680.o1zEk_.rst
4f5e199
Co-authored-by: Inada Naoki <[email protected]>
@vstinner
Update NEWS entry
67bbfe6
@vstinner
vstinner merged commit 77d668b into python:master Apr 12, 2021
@bedevere-bot bedevere-bot removed the awaiting core review label Apr 12, 2021
@vstinner
vstinner deleted the pyio_openwrapper branch April 12, 2021 08:46
@methane

methane commented Apr 14, 2021

Copy link
Copy Markdown
Member

Can we remove DocDescriptor too?

It is not defined in C _io module. So I think it is safe to remove.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Apr 14, 2021

Copy link
Copy Markdown
Member Author

Can we remove DocDescriptor too?
It is not defined in C _io module. So I think it is safe to remove.

Sure, it was not documented and doesn't exist in the io module. I already removed it: 3bc694d

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot mentioned this pull request Nov 6, 2024
Deprecate undocumented io.OpenWrapper and _pyio.OpenWrapper #87846
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

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

4 participants

@vstinner @methane @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.