CONTRIBUTING: Note no bytearray promotion (#9005)

Closes #9001
This commit is contained in:
Jelle Zijlstra
2022-10-28 13:48:59 -07:00
committed by GitHub
parent 4c48fd63b1
commit b5c4580d52

View File

@@ -286,6 +286,15 @@ Two exceptions are `Protocol` and `runtime_checkable`: although
these were added in Python 3.8, they can be used in stubs regardless
of Python version.
[PEP 688](https://www.python.org/dev/peps/pep-0688/), which is
currently a draft, removes the implicit promotion of the
`bytearray` and `memoryview` classes to `bytes`.
Typeshed stubs should be written assuming that this proposal
is accepted, so a parameter that accepts either `bytes` or
`bytearray` should be typed as `bytes | bytearray`.
Often one of the aliases from `_typeshed`, such as
`_typeshed.ReadableBuffer`, can be used instead.
### What to include
Stubs should include the complete interface (classes, functions,