Skip to content

Commit cfdb5ee

Browse files
committed
Use PYTHONCAPI_COMPAT_EXPECT_TYPE()
Avoid "%T" formatting which was was only added to Python 3.13.
1 parent cb26b93 commit cfdb5ee

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎pythoncapi_compat.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ static inline int PyLong_IsPositive(PyObject *obj)
17591759
PyObject *zero = Py_GetConstant(Py_CONSTANT_ZERO);
17601760

17611761
if (!PyLong_Check(obj)) {
1762-
PyErr_Format(PyExc_TypeError, "expect int, got %R", obj);
1762+
PYTHONCAPI_COMPAT_EXPECT_TYPE("expected int, got ", obj);
17631763
return -1;
17641764
}
17651765

@@ -1870,8 +1870,7 @@ static inline PyObject* PyBytes_Join(PyObject *sep, PyObject *iterable)
18701870
return NULL;
18711871
}
18721872
if (!PyBytes_Check(sep)) {
1873-
PyErr_Format(PyExc_TypeError,
1874-
"sep: expected bytes, got %T", sep);
1873+
PYTHONCAPI_COMPAT_EXPECT_TYPE("sep: expected bytes, got ", sep);
18751874
return NULL;
18761875
}
18771876

0 commit comments

Comments
 (0)