From 09ae69c0272f0caa2c841c91799a4c118f82836d Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 27 Oct 2022 19:10:29 -0700 Subject: [PATCH 1/3] CONTRIBUTING: Note no bytearray promotion Closes #9001 --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36d67c31ed0d..17c522be2bd2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -286,6 +286,13 @@ 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`. + ### What to include Stubs should include the complete interface (classes, functions, From 61c951046d2eaf1b4f84881b1b11db4ad17f1960 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 27 Oct 2022 19:50:35 -0700 Subject: [PATCH 2/3] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17c522be2bd2..f6da05131a53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -292,6 +292,8 @@ currently a draft, removes the implicit promotion of the 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 From be553642fbffbbc14457acc1eb50d22b6e396732 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 27 Oct 2022 19:50:49 -0700 Subject: [PATCH 3/3] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6da05131a53..dee7be8e89fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -293,7 +293,7 @@ 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. +`_typeshed.ReadableBuffer`, can be used instead. ### What to include