Skip to content

Commit 5a4c1d6

Browse files
Update Modules/_ctypes/_ctypes.c
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent d6a4bc8 commit 5a4c1d6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3117,8 +3117,11 @@ static int
31173117
PyCData_MallocBuffer(CDataObject *obj, StgInfo *info)
31183118
{
31193119
/* We don't have to lock in this function, because it's only
3120-
used in constructors and therefore does not have concurrent
3121-
access. */
3120+
* used in constructors and therefore does not have concurrent
3121+
* access.
3122+
*/
3123+
assert (Py_REFCNT(obj) == 1);
3124+
31223125
if ((size_t)info->size <= sizeof(obj->b_value)) {
31233126
/* No need to call malloc, can use the default buffer */
31243127
obj->b_ptr = (char *)&obj->b_value;

0 commit comments

Comments
 (0)