8000 gh-104955: Fix __release_buffer__ signature by JelleZijlstra · Pull Request #104956 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104955: Fix __release_buffer__ signature #104956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-104955: Fix __release_buffer__ signature
  • Loading branch information
JelleZijlstra committed May 26, 2023
commit 74617c78f7986bba7d0b4b02393a16fcb8c08ec4
5 changes: 5 additions & 0 deletions Lib/test/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,11 @@ class ThisWorksNow:
# Regression test for issue #20586
test_callable(_testcapi.docstring_with_signature_but_no_doc)

# Regression test for gh-104955
method = bytearray.__release_buffer__
sig = test_unbound_method(method)
self.assertEqual(list(sig.parameters), ['self', 'buffer'])

@cpython_only
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix signature for the new :meth:`__release_buffer__` slot. Patch by Jelle
Zijlstra.
2 changes: 1 addition & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -9428,7 +9428,7 @@ static pytype_slotdef slotdefs[] = {
"__buffer__($self, flags, /)\n--\n\n"
"Return a buffer object that exposes the underlying memory of the object."),
BUFSLOT(__release_buffer__, bf_releasebuffer, slot_bf_releasebuffer, wrap_releasebuffer,
"__release_buffer__($self, /)\n--\n\n"
"__release_buffer__($self, buffer, /)\n--\n\n"
"Release the buffer object that exposes the underlying memory of the object."),

AMSLOT(__await__, am_await, slot_am_await, wrap_unaryfunc,
Expand Down
0