Sorry, something went wrong.
There was a problem hiding this comment.
Could you avoid the custom metaclass by using a combination of __init_subclass__ and __subclasshook__ instead?
Sorry, something went wrong.
|
Yeah, I started by trying to get that to work, but didn't see a way of making __subclasshook__ viable, since it would affect things like isinstance(bytes, Sequence) (it also has some other trickiness, e.g. I'd need to import warnings at collections.abc import time to silence the warning when we register / I think I'd need to make stacklevel configurable in warnings._deprecated to make it work?) |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
It's unfortunate there's no warning on issubclass() but I don't have ideas for how to do that reliably either.
Sorry, something went wrong.
There was a problem hiding this comment.
Glad to see it deprecated!
Sorry, something went wrong.
| class ByteString(Sequence, metaclass=_DeprecateByteStringMeta): | ||
| """This unifies bytes and bytearray. | ||
|
|
||
| XXX Should add all their methods. |
There was a problem hiding this comment.
You can also remove this comment.
Sorry, something went wrong.
Getting a DeprecationWarning on issubclass proved to be difficult, because it could affect unrelated looking things like isinstance(bytes, Sequence)