You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Pattern(Generic[AnyStr]):
def match(self, string: AnyStr) -> Match[AnyStr]: ...
This disallows mixing bytes/unicode. Is this what we want?
Matching a bytes regexp against unicode is a TypeError in Python 3, so there's a case for not supporting this; however we do have some cases on our side were this is flagged as a type error in valid Python 2 code.
The text was updated successfully, but these errors were encountered:
The following is valid Python 2:
Should typeshed allow this? Right now, https://github.com/python/typeshed/blob/master/stdlib/2/re.pyi defines compile as:
And
match()
, inPattern
, is defined in https://github.com/python/typeshed/blob/master/stdlib/2/typing.pyi#L350 as:This disallows mixing bytes/unicode. Is this what we want?
Matching a bytes regexp against unicode is a
TypeError
in Python 3, so there's a case for not supporting this; however we do have some cases on our side were this is flagged as a type error in valid Python 2 code.The text was updated successfully, but these errors were encountered: