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
{{ message }}
Repository navigation
Add support for typing.ByteString/collections.abc.ByteString #52
When parsing type signatures for structs, it'd be useful to support a more abstract bytes-like object. For encoding this would result in no major changes (encoding only deals with concrete types). For decoding, this would decode the type as bytes (unless an extension type was used).
Oh, interesting. That certainly seems like a bug (at least in the documentation). mypy does count memoryviews here. You can make the runtime check work by calling
collections.abc.ByteString.register(memoryview)
but that applies a global change that may break things elsewhere (but is probably harmless).
Activity
jakirkham commentedon Sep 9, 2021
This would be great and supporting both makes sense.
It's worth noting the docs say...
jakirkham commentedon Sep 9, 2021
Also interesting in
collections.abc.ByteStringthey mentionmemoryviews are supported, but that doesn't appear to be the case.jcrist commentedon Sep 9, 2021
Oh, interesting. That certainly seems like a bug (at least in the documentation).
mypydoes count memoryviews here. You can make the runtime check work by callingbut that applies a global change that may break things elsewhere (but is probably harmless).
jakirkham commentedon Sep 9, 2021
Good point
This upstream issue ( https://bugs.python.org/issue33864 ) looks related. Seems like there is confusion as to if/how this should be included
Independently does annotating with
memoryviewwork currently?Fix `Meta(pattern=..)` memory leak / corruption (msgspec#1256)