Skip to content
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
Prev Previous commit
Next Next commit
add some comments.
  • Loading branch information
gpshead committed Jan 26, 2023
commit a0b6672656a414e9f6a453f3e28b7c2e3947ab20
2 changes: 2 additions & 0 deletions Lib/test/test_ctypes/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def test_from_param_result_refcount(self):
from ctypes import PyDLL, c_int, c_void_p, py_object, Structure

class X(Structure):
"""This struct size is <= sizeof(void*)."""
_fields_ = [("a", c_void_p)]

def __del__(self):
Expand All @@ -295,6 +296,7 @@ def from_param(cls, value):
self.assertEqual(trace, [1, 2, 3, 4, 5])

class Y(Structure):
"""This struct size is > sizeof(void*)."""
_fields_ = [("a", c_void_p), ("b", c_void_p)]

def __del__(self):
Expand Down
2 changes: 1 addition & 1 deletion Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ _ctypes_alloc_format_string_with_shape(int ndim, const Py_ssize_t *shape,
typedef struct {
PyObject_HEAD
void *ptr;
PyObject *keep;
PyObject *keep; // If set, a reference to the original CDataObject.
} StructParamObject;


Expand Down