Skip to content

Commit ef761f0

Browse files
committed
Use _Py_CAST() in test_pythoncapi_compat_cext.c
Avoid old-style cast in C++.
1 parent 5287eac commit ef761f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_pythoncapi_compat_cext.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ test_interpreter(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
263263
static PyObject *
264264
test_calls(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
265265
{
266-
PyObject *func = (PyObject *)&PyUnicode_Type;
266+
PyObject *func = _Py_CAST(PyObject*, &PyUnicode_Type);
267267

268268
// test PyObject_CallNoArgs(): str() returns ''
269269
PyObject *res = PyObject_CallNoArgs(func);
@@ -337,7 +337,7 @@ test_module_add_type(PyObject *module)
337337
if (attr == _Py_NULL) {
338338
return -1;
339339
}
340-
assert(attr == (PyObject *)type);
340+
assert(attr == _Py_CAST(PyObject*, type));
341341
Py_DECREF(attr);
342342

343343
if (PyObject_DelAttrString(module, type_name) < 0) {

0 commit comments

Comments
 (0)