Skip to content

Commit 3158b4d

Browse files
miss-islingtonJelleZijlstrakumaraditya303
authored
[3.12] gh-104955: Fix __release_buffer__ signature (GH-104956) (#104973)
(cherry picked from commit 6e1eccd) Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Kumar Aditya <[email protected]>
1 parent 83bdfa4 commit 3158b4d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Lib/test/test_inspect.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,6 +2766,11 @@ class ThisWorksNow:
27662766
# Regression test for issue #20586
27672767
test_callable(_testcapi.docstring_with_signature_but_no_doc)
27682768

2769+
# Regression test for gh-104955
2770+
method = bytearray.__release_buffer__
2771+
sig = test_unbound_method(method)
2772+
self.assertEqual(list(sig.parameters), ['self', 'buffer'])
2773+
27692774
@cpython_only
27702775
@unittest.skipIf(MISSING_C_DOCSTRINGS,
27712776
"Signature information for builtins requires docstrings")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix signature for the new :meth:`~object.__release_buffer__` slot. Patch by Jelle
2+
Zijlstra.

Objects/typeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9428,7 +9428,7 @@ static pytype_slotdef slotdefs[] = {
94289428
"__buffer__($self, flags, /)\n--\n\n"
94299429
"Return a buffer object that exposes the underlying memory of the object."),
94309430
BUFSLOT(__release_buffer__, bf_releasebuffer, slot_bf_releasebuffer, wrap_releasebuffer,
9431-
"__release_buffer__($self, /)\n--\n\n"
9431+
"__release_buffer__($self, buffer, /)\n--\n\n"
94329432
"Release the buffer object that exposes the underlying memory of the object."),
94339433

94349434
AMSLOT(__await__, am_await, slot_am_await, wrap_unaryfunc,

0 commit comments

Comments
 (0)