Skip to content

Commit b5c4580

Browse files
CONTRIBUTING: Note no bytearray promotion (#9005)
Closes #9001
1 parent 4c48fd6 commit b5c4580

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

CONTRIBUTING.md

+9
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ Two exceptions are `Protocol` and `runtime_checkable`: although
286286
these were added in Python 3.8, they can be used in stubs regardless
287287
of Python version.
288288

289+
[PEP 688](https://www.python.org/dev/peps/pep-0688/), which is
290+
currently a draft, removes the implicit promotion of the
291+
`bytearray` and `memoryview` classes to `bytes`.
292+
Typeshed stubs should be written assuming that this proposal
293+
is accepted, so a parameter that accepts either `bytes` or
294+
`bytearray` should be typed as `bytes | bytearray`.
295+
Often one of the aliases from `_typeshed`, such as
296+
`_typeshed.ReadableBuffer`, can be used instead.
297+
289298
### What to include
290299

291300
Stubs should include the complete interface (classes, functions,

0 commit comments

Comments
 (0)