Speaking with my typeshed maintainer hat: If we are removing that
promotion, we need a transition strategy. Here's my suggestion for
typeshed:
- Introduce a TypeAlias `_typeshed.OldBytes = bytes | bytearray
| memoryview` (or similar).
- Document that `OldBytes` must not be used manually.
- Programmatically replace all occurrences of "bytes" in
argument types with `OldBytes`. (We can only do this for
third-party stubs once all typecheckers include
`_typeshed.OldBytes`. This should ideally happen, *before*
typecheckers remove support for the automatic promotion.)
- Check all occurrences of `OldBytes` manually and replace them
with the appropriate types. This can be done over time when
touching a particular stub file anyway.
- Eventually (in a few years) remove `_typeshed.OldBytes`.
Sounds like a good transition plan.
If it's for internal use only, why not name it `_typeshed._OldBytes`?
And what would be lost if even that dropped `memoryview`? (Probably the world would explode, never change something that's deprecated anyway no matter how much you want to. :-)
--