From bad793c1211f4e94c2932c5efa7fa49b00eefc7e Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Tue, 22 May 2018 23:35:23 +0200 Subject: [PATCH] PEP 574: fix error in code sample (#662) --- pep-0574.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0574.rst b/pep-0574.rst index b943f196549..05e2ed04cc3 100644 --- a/pep-0574.rst +++ b/pep-0574.rst @@ -164,8 +164,8 @@ to be returned from ``__reduce__`` implementations:: class bytearray: def __reduce_ex__(self, protocol): - if protocol == 5: - return type(self), PickleBuffer(self), None + if protocol >= 5: + return type(self), (PickleBuffer(self),), None # Legacy code for earlier protocols omitted ``PickleBuffer`` is a simple wrapper that doesn't have all the memoryview