Skip to content

Buffer support for re - #7679

Merged
JelleZijlstra merged 2 commits into
python:masterfrom
JelleZijlstra:pickle
Apr 24, 2022
Merged

Buffer support for re#7679
JelleZijlstra merged 2 commits into
python:masterfrom
JelleZijlstra:pickle

Conversation

@JelleZijlstra

Copy link
Copy Markdown
Member

No description provided.

@JelleZijlstra

Copy link
Copy Markdown
MemberAuthor

Also showed up in python/mypy#12661. Replaces #7158.

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/map_taxonomy.py:223: error: Argument 1 to "append" of "list" has incompatible type "str"; expected "TaxonName"
core (https://github.com/home-assistant/core)
+ homeassistant/components/huawei_lte/device_tracker.py:170: error: On Python 3 formatting "b'abc'" with "{}" produces "b'abc'", not "abc"; use "{!r}" if this is desired behavior [str-bytes-safe]

@Akuli

Copy link
Copy Markdown
Collaborator

Maybe we should update the third-party regex stubs too.

@hauntsaninjahauntsaninja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! The homeassistant one looks like a false positive to me, probably a mypy bug, although we should be able to work around it if we wanted by using self types for Match.group

@JelleZijlstra

Copy link
Copy Markdown
MemberAuthor

@Akuli sure, I'll do that in a separate PR.

@hauntsaninja yes that one is weird to me. Not sure where mypy gets bytes from in this code: https://github.com/home-assistant/core/blob/859dcb396a6f7a1712a188fc67060019aea24e9c/homeassistant/components/huawei_lte/device_tracker.py#L170. I don't understand how self types would help either.

(Also, the paroxython one looks like a true positive. I don't know why mypy didn't catch it before.)

@hauntsaninja

Copy link
Copy Markdown
Collaborator

I filed python/mypy#12666 for it

@JelleZijlstraJelleZijlstra mentioned this pull request Apr 24, 2022
JelleZijlstra added a commit to JelleZijlstra/typeshed that referenced this pull request Apr 24, 2022
JelleZijlstra added a commit that referenced this pull request May 10, 2022
Similar to #7679
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
Sign up for freeto 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

@JelleZijlstra@Akuli@hauntsaninja