Skip to content

Commit 7b51201

Browse files
committed
Lock not needed.
1 parent cdeb279 commit 7b51201

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ bytes(cdata)
110110
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
111111
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
112112
#include "pycore_pyatomic_ft_wrappers.h"
113+
#include "pycore_object.h"
113114
#ifdef MS_WIN32
114115
# include "pycore_modsupport.h" // _PyArg_NoKeywords()
115116
#endif
@@ -932,7 +933,8 @@ CDataType_from_buffer_copy_impl(PyObject *type, PyTypeObject *cls,
932933

933934
result = generic_pycdata_new(st, (PyTypeObject *)type, NULL, NULL);
934935
if (result != NULL) {
935-
locked_memcpy_to((CDataObject *) result, (char *)buffer->buf + offset, info->size);
936+
assert(_PyObject_IsUniquelyReferenced(result));
937+
memcpy(((CDataObject *) result)->b_ptr, (char *)buffer->buf + offset, info->size);
936938
}
937939
return result;
938940
}

0 commit comments

Comments
 (0)