8000 gh-107659: ctypes: Add docstrings for `ctypes.pointer` and `ctypes.POINTER` by tomasr8 · Pull Request #107660 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107659: ctypes: Add docstrings for ctypes.pointer and ctypes.POINTER #107660

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 9 commits into from
Aug 8, 2023
Merged
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
Prev Previous commit
Next Next commit
Keep the original argument name
  • Loading branch information
tomasr8 committed Aug 5, 2023
commit f80e89ba3a116410795d903c9bd36f9e689912ab
14 changes: 7 additions & 7 deletions Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ create_pointer_type(PyObject *module, PyObject *cls)
/*[clinic input]
_ctypes.pointer as create_pointer_inst

obj: object
obj as arg: object
/

Creates a new pointer instance, pointing to 'obj'.
Expand All @@ -1977,23 +1977,23 @@ you should use byref(obj) which is much faster.
[clinic start generated code]*/

static PyObject *
create_pointer_inst(PyObject *module, PyObject *obj)
/*[clinic end generated code: output=1039888809db21a2 input=925d2ec210c75c47]*/
create_pointer_inst(PyObject *module, PyObject *arg)
/*[clinic end generated code: output=3b543bc9f0de2180 input=649dec8dad8c0e52]*/
{
PyObject *result;
PyObject *typ;

typ = PyDict_GetItemWithError(_ctypes_ptrtype_cache, (PyObject *)Py_TYPE(obj));
typ = PyDict_GetItemWithError(_ctypes_ptrtype_cache, (PyObject *)Py_TYPE(arg));
if (typ) {
return PyObject_CallOneArg(typ, obj);
return PyObject_CallOneArg(typ, arg);
}
else if (PyErr_Occurred()) {
return NULL;
}
typ = create_pointer_type(NULL, (PyObject *)Py_TYPE(obj));
typ = create_pointer_type(NULL, (PyObject *)Py_TYPE(arg));
if (typ == NULL)
return NULL;
result = PyObject_CallOneArg(typ, obj);
result = PyObject_CallOneArg(typ, arg);
Py_DECREF(typ);
return result;
}
Expand Down
0