From b5c4580d529c03efe7b4546ed9d3632befd5fb49 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 28 Oct 2022 13:48:59 -0700 Subject: [PATCH] CONTRIBUTING: Note no bytearray promotion (#9005) Closes #9001 --- CONTRIBUTING.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36d67c31e..dee7be8e8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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,