Skip to content

Commit 2fb9993

Browse files
committed
fix test
1 parent 6084ba5 commit 2fb9993

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Lib/test/test_ctypes/test_parameters.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ def test_parameter_repr(self):
245245
self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")
246246

247247
@test.support.cpython_only
248-
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
249248
def test_from_param_result_refcount(self):
250249
# Issue #99952
251250
import sys
@@ -263,7 +262,7 @@ def from_param(cls, value):
263262
trace.append(2)
264263
return cls()
265264

266-
PyList_Append = PyDLL("python", handle=sys.dllhandle).PyList_Append
265+
PyList_Append = PyDLL(_ctypes_test.__file__)._testfunc_pylist_append
267266
PyList_Append.restype = c_int
268267
PyList_Append.argtypes = [py_object, py_object, X]
269268

@@ -285,7 +284,7 @@ def from_param(cls, value):
285284
trace.append(2)
286285
return cls()
287286

288-
PyList_Append = PyDLL("python", handle=sys.dllhandle).PyList_Append
287+
PyList_Append = PyDLL(_ctypes_test.__file__)._testfunc_pylist_append
289288
PyList_Append.restype = c_int
290289
PyList_Append.argtypes = [py_object, py_object, Y]
291290

Modules/_ctypes/_ctypes_test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,12 @@ EXPORT(long) _test_i38748_runCallback(_test_i38748_funcType callback, int a, int
10471047

10481048
#endif
10491049

1050+
EXPORT(int)
1051+
_testfunc_pylist_append(PyObject *list, PyObject *item)
1052+
{
1053+
return PyList_Append(list, item);
1054+
}
1055+
10501056
static struct PyModuleDef_Slot _ctypes_test_slots[] = {
10511057
{0, NULL}
10521058
};

0 commit comments

Comments
 (0)