Skip to content

Update stub for tarfile#1389

Merged
matthiaskramm merged 1 commit intopython:masterfrom
ymyzk:update-tarfile
Jun 9, 2017
Merged

Update stub for tarfile#1389
matthiaskramm merged 1 commit intopython:masterfrom
ymyzk:update-tarfile

Conversation

@ymyzk
Copy link
Copy Markdown
Contributor

@ymyzk ymyzk commented Jun 4, 2017

  • Many methods allow PathLike objects in Python 3.6
  • Update type for path from str to AnyStr Union[str, unicode] in Python 2 or Union[bytes, str] in Python 3

Comment thread stdlib/2and3/tarfile.pyi
TAR_GZIPPED = ... # type: int

def open(name: Optional[str] = ..., mode: str = ...,
def open(name: Optional[_Path] = ..., mode: str = ...,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think AnyStr makes sense here, because this is the only argument to the function (AnyStr is a typevar, and it should be used to constrain multiple arguments or an argument and the return value to be the same typE). I think this function can just take Union[bytes, str] as an argument; same for most others below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay. I misunderstood use of AnyStr.

Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

for the previous comment

@ymyzk ymyzk force-pushed the update-tarfile branch from 9cc4735 to 2a267be Compare June 4, 2017 17:21
@ymyzk ymyzk force-pushed the update-tarfile branch from 2a267be to 03901c6 Compare June 5, 2017 00:39
@matthiaskramm matthiaskramm merged commit 8f47637 into python:master Jun 9, 2017
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