Skip to content

gh-62184: Remove _pyio import of _io.FileIO #134192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2025
Merged

Conversation

cmaloney
Copy link
Contributor

@cmaloney cmaloney commented May 18, 2025

This was added in the add of _io, isn't used since bpo-21859 added a Python-native _pyio implementation of FileIO further down in the file.

(Happy to add a news, but also don't think there is particularly a user visible change?)


This is the last direct import of _io in _pyio. _io is still imported indirectly (by way of io) for io.open_code, io.UnsupportedOperation, and registering _pyio base abstract classes to the general io ones for isinstance, and several constants (ex. SEEK_SET, ...).

This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test (maybe using the new helper) that _io isn't imported when importing _pyio?

A

@cmaloney
Copy link
Contributor Author

cmaloney commented May 19, 2025

_io is still imported indirectly (by way of io), so a test with new helper would fail currently I think? Can work on that, but I think splitting io.py into two parts (1. common base for _pyio and _io 2. forward/dispatch to _io) likely isn't worth the performance impact at the moment (see also changing from importing io to _io to increase performance in gh-132952).

@ambv ambv merged commit 0a68068 into python:main May 21, 2025
43 checks passed
@ambv ambv added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels May 21, 2025
@miss-islington-app
Copy link

Thanks @cmaloney for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @cmaloney for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 21, 2025
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
(cherry picked from commit 0a68068)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 21, 2025
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
(cherry picked from commit 0a68068)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented May 21, 2025

GH-134436 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 21, 2025
@bedevere-app
Copy link

bedevere-app bot commented May 21, 2025

GH-134437 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 21, 2025
ambv pushed a commit that referenced this pull request May 21, 2025
…4436)

This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
(cherry picked from commit 0a68068)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
@cmaloney cmaloney deleted the pyio_fileio branch May 21, 2025 15:57
ambv pushed a commit that referenced this pull request May 21, 2025
…4437)

This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
(cherry picked from commit 0a68068)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
lkollar pushed a commit to lkollar/cpython that referenced this pull request May 26, 2025
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants