Skip to content

generate_tokens(readline) must return bytes#3372

Merged
JelleZijlstra merged 1 commit intopython:masterfrom
srittau:fix-tokenize
Oct 16, 2019
Merged

generate_tokens(readline) must return bytes#3372
JelleZijlstra merged 1 commit intopython:masterfrom
srittau:fix-tokenize

Conversation

@srittau
Copy link
Collaborator

@srittau srittau commented Oct 16, 2019

No description provided.

@JelleZijlstra JelleZijlstra merged commit 299d89a into python:master Oct 16, 2019
@srittau srittau deleted the fix-tokenize branch October 16, 2019 17:22
def detect_encoding(readline: Callable[[], bytes]) -> Tuple[str, Sequence[bytes]]: ...
def tokenize(readline: Callable[[], bytes]) -> Generator[TokenInfo, None, None]: ...
def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ...
def generate_tokens(readline: Callable[[], bytes]) -> Generator[TokenInfo, None, None]: ... # undocumented
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes, confirmed in shell on 3.6. @srittau what was the basis for your change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I've noticed that there are difference with py27 in this regard, so maybe it got confused?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No idea why I thought readline() should return bytes or why I even stumbled over this. I probably misread _tokenize().

srittau added a commit to srittau/typeshed that referenced this pull request Nov 23, 2019
readline callback must return str, not bytes.
srittau added a commit that referenced this pull request Nov 23, 2019
readline callback must return str, not bytes.
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