Skip to content

Replication of original PR #582: Add Reader and Writer protocols #4

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

Open
wants to merge 1 commit into
base: replicated-pr-582-before
Choose a base branch
from

Conversation

yashwanthatla
Copy link
Owner

@yashwanthatla yashwanthatla commented Jun 21, 2025

PR Summary

Add Reader and Writer Protocol Classes to typing_extensions

Overview

This PR adds new Reader and Writer Protocol classes to the typing_extensions module, with a fallback mechanism that checks if the io module already has these classes.

Change Types

Type Description
Feature Add Reader and Writer Protocol classes
Test Add tests for new protocol classes

Affected Modules

Module / File Change Description
typing_extensions.py Add Reader and Writer Protocol classes with fallback mechanism
typing_extensions.py Import io module to support new protocol classes
typing_extensions.py Add 'Reader' and 'Writer' to all list
test_typing_extensions.py Add SpecificProtocolTests class with tests for new protocols
conf.py Update Python documentation reference URL and add comments

Notes for Reviewers

  • The implementation includes a fallback mechanism that checks if the io module already has these classes
  • The protocols are runtime checkable

intersphinx_mapping = {'py': ('https://docs.python.org/3', None)}
# This should usually point to /3, unless there is a necessity to link to
# features in future versions of Python.
intersphinx_mapping = {'py': ('https://docs.python.org/3.14', None)}
Copy link

Choose a reason for hiding this comment

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

🐛 Correctness Issue

Reference to non-existent Python version 3.14.

The intersphinx_mapping points to Python 3.14 documentation which doesn't exist yet, causing broken documentation links and build failures.

Current Code (Diff):

- intersphinx_mapping = {'py': ('https://docs.python.org/3.14', None)}
+ intersphinx_mapping = {'py': ('https://docs.python.org/3', None)}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
intersphinx_mapping = {'py': ('https://docs.python.org/3.14', None)}
intersphinx_mapping = {'py': ('https://docs.python.org/3', None)}

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.

2 participants