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 — gh-118803: Make `ByteString` deprecations louder; remove `ByteString` from `typing.__all__` and `collections.abc.__all__` by AlexWaygood · Pull Request #139127 · python/cpython

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Sep 18, 2025 •
edited by github-actions Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Remove ByteString from typing and collections.abc #118803

📚 Documentation preview 📚: https://cpython-previews--139127.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

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

All reactions
@AlexWaygood
pythongh-118803: Make ByteString deprecations louder; remove `ByteS…
b508dd0
…tring` from `typing.__all__` and `collections.abc.__all__`
@bedevere-app bedevere-app Bot mentioned this pull request Sep 18, 2025
Remove ByteString from typing and collections.abc #118803
Closed
@AlexWaygood
improvements
fc787a5
@AlexWaygood
AlexWaygood marked this pull request as ready for review September 18, 2025 14:22
@AlexWaygood
AlexWaygood requested review from AA-Turner, JelleZijlstra and rhettinger as code owners September 18, 2025 14:22
@bedevere-app bedevere-app Bot added the awaiting core review label Sep 18, 2025
@AlexWaygood AlexWaygood added 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section and removed awaiting core review labels Sep 18, 2025
@bedevere-bot

bedevere-bot commented Sep 18, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @AlexWaygood for commit fc787a5 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F139127%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Sep 18, 2025
@AlexWaygood AlexWaygood added the awaiting core review label Sep 18, 2025
JelleZijlstra
JelleZijlstra reviewed Sep 18, 2025
View reviewed changes
Comment thread Lib/_collections_abc.py
if attr == "ByteString":
import warnings
warnings._deprecated("collections.abc.ByteString", remove=(3, 17))
globals()["ByteString"] = _deprecated_ByteString

@JelleZijlstra JelleZijlstra Sep 18, 2025

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.

This means only the first time anyone does from collections.abc import ByteString in a program will trigger a warning, right? That seems potentially problematic: maybe the first time is in some dependency you don't control, so you ignore the warning, and then it happens again in your code and you miss it.

Sorry, something went wrong.

Uh oh!

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

All reactions

@AlexWaygood AlexWaygood Sep 18, 2025

Copy link
Copy Markdown
Member Author

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.

That's correct. I did that deliberately so that the warning wouldn't be too noisy, and since it's what we previously did for other modules such as ast:

cpython/Lib/ast.py

Lines 1897 to 1905 in d065edf

def __getattr__(name):
if name in _deprecated_globals:
globals()[name] = value = _deprecated_globals[name]
import warnings
warnings._deprecated(
f"ast.{name}", message=_DEPRECATED_CLASS_MESSAGE, remove=(3, 14)
)
return value
raise AttributeError(f"module 'ast' has no attribute '{name}'")

But I'm happy to switch to it emitting the deprecation warning even on subsequent imports, if you prefer! It would simplify the implementation a little

Sorry, something went wrong.

Uh oh!

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

All reactions

@JelleZijlstra JelleZijlstra Sep 18, 2025

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.

Probably OK to stick with the standard format here, hopefully it's enough to get people to notice...

Sorry, something went wrong.

Uh oh!

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

AlexWaygood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
JelleZijlstra
JelleZijlstra approved these changes Sep 18, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Sep 18, 2025
@AlexWaygood
deprecation warnings for issubclass() too, why not
9836443
@AlexWaygood

AlexWaygood commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

The buildbots report a number of reference leaks on this branch, but I can reproduce them all locally on main, and none of them look related to this PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood
AlexWaygood enabled auto-merge (squash) September 18, 2025 18:35
@AlexWaygood
AlexWaygood merged commit 293b05c into python:main Sep 18, 2025
@AlexWaygood
AlexWaygood deleted the alex/louder-bytestring-deprecation branch September 18, 2025 18:58
@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 18, 2025
@Glinte Glinte mentioned this pull request Oct 7, 2025
[Build] Blacklist obsolete Python 3.14 release candidates (i.e., !<=3.14rc2) beartype/beartype#561
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@rhettinger rhettinger Awaiting requested review from rhettinger rhettinger is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

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.

3 participants

@AlexWaygood @bedevere-bot @JelleZijlstra
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.