8000 gh-103092: Port some `_ctypes` data types to heap types by neonene · Pull Request #113630 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-103092: Port some _ctypes data types to heap types #113630

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

Closed
wants to merge 20 commits into from
Closed
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
Prev Previous commit
Next Next commit
minor adjustments
  • Loading branch information
neonene committed Jan 5, 2024
commit a1752d4a2cc5f45d09de5c2056e125bf5e5fa7f8
7 changes: 4 additions & 3 deletions Modules/_ctypes/_ctypes.c
8000
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ static PyType_Spec structparam_spec = {

/*
PyCStructType_Type - a meta type/class. Creating a new class using this one as
__metaclass__ will call the constructor StructUnionType_new. It replaces the
tp_dict member with a new instance of StgDict, and initializes the C
__metaclass__ will call the constructor StructUnionType_new/init. It replaces
the tp_dict member with a new instance of StgDict, and initializes the C
accessible fields somehow.
*/

Expand Down Expand Up @@ -2715,8 +2715,9 @@ PyCData_clear(CDataObject *self)
{
Py_CLEAR(self->b_objects);
if ((self->b_needsfree)
&& _CDataObject_HasExternalBuffer(self))
&& _CDataObject_HasExternalBuffer(self)) {
PyMem_Free(self->b_ptr);
}
self->b_ptr = NULL;
Py_CLEAR(self->b_base);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_ctypes/ctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ extern PyTypeObject PyCStructType_Type;
#define ArrayObject_Check(st, v) PyObject_TypeCheck((v), (st)->PyCArray_Type)
#define PointerObject_Check(st, v) PyObject_TypeCheck((v), (st)->PyCPointer_Type)
#define PyCPointerTypeObject_Check(v) PyObject_TypeCheck(v, &PyCPointerType_Type)
#define PyCFuncPtrObject_Check(st,v) PyObject_TypeCheck((v), (st)->PyCFuncPtr_Type)
#define PyCFuncPtrObject_Check(st, v) PyObject_TypeCheck((v), (st)->PyCFuncPtr_Type)
#define PyCFuncPtrTypeObject_Check(v) PyObject_TypeCheck(v, &PyCFuncPtrType_Type)
#define PyCStructTypeObject_Check(v) PyObject_TypeCheck(v, &PyCStructType_Type)

Expand Down
0