-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
gh-117764: Fix and add signatures for many builtins #117769
gh-117764: Fix and add signatures for many builtins #117769
Conversation
serhiy-storchaka
commented
Apr 11, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Add more signatures for builtin functions and methods #117764
PyDoc_STRVAR(memory_exit_doc, | ||
"__exit__($self, /, *exc_info)\n--\n\n" | ||
"Release the underlying buffer exposed by the memoryview object."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyDoc_STRVAR(memory_exit_doc, | |
"__exit__($self, /, *exc_info)\n--\n\n" | |
"Release the underlying buffer exposed by the memoryview object."); | |
PyDoc_STRVAR(memory_enter_doc, | |
"__enter__($self)\n--\n\n" | |
"Check the underlying buffer has not been released."); | |
PyDoc_STRVAR(memory_exit_doc, | |
"__exit__($self, /, *exc_info)\n--\n\n" | |
"Release the underlying buffer exposed by the memoryview object."); |
(maybe the signature for enter is not correct, it returns a reference to itself)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is rather the side effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this for future. The __enter__
methods either acquire the resource, in which case it should be explicitly documented, or do not have a side effect, in which case they do not need a docstring. I am not sure what is closer to this case.
@@ -3283,7 +3286,7 @@ static PyMethodDef memory_methods[] = { | |||
MEMORYVIEW_TOREADONLY_METHODDEF | |||
MEMORYVIEW__FROM_FLAGS_METHODDEF | |||
{"__enter__", memory_enter, METH_NOARGS, NULL}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{"__enter__", memory_enter, METH_NOARGS, NULL}, | |
{"__enter__", memory_enter, METH_NOARGS, memory_enter_doc}, |
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>