Skip to content

shlex.split: allow TextIO and deprecate None#11451

Merged
srittau merged 1 commit intopython:mainfrom
Avasam:shlex.split
Feb 19, 2024
Merged

shlex.split: allow TextIO and deprecate None#11451
srittau merged 1 commit intopython:mainfrom
Avasam:shlex.split

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Feb 19, 2024

Whilst working on a setuptools stubs update (namely in setuptools.command.easy_install.CommandSpec.from_param), I noticed that shlex.split didn't allow TextIO like shlex.shlex.__init__ does. And that passing None can be allowed (but deprecated) until Python 3.12.

Unless s being anything else than a str is an accidental implementation detail that should be hidden away.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
Copy link
Collaborator

srittau commented Feb 19, 2024

Just a general note: TextIO isn't an ideal annotation for parameters (similar to BinaryIO and IO). Usually, a protocol is a better option. That said, as this is only forwarded, this is better than leaving it out.

@srittau srittau merged commit bb6613f into python:main Feb 19, 2024
@Avasam Avasam deleted the shlex.split branch February 19, 2024 05:19
@Avasam Avasam mentioned this pull request Feb 22, 2024
2 tasks
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