Skip to content

Commit 7835cbf

Browse files
authored
bpo-46417: Use _PyType_CAST() in Python directory (GH-30769)
1 parent 8ee07dd commit 7835cbf

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Python/bltinmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static PyObject *
536536
filter_vectorcall(PyObject *type, PyObject * const*args,
537537
size_t nargsf, PyObject *kwnames)
538538
{
539-
PyTypeObject *tp = (PyTypeObject *)type;
539+
PyTypeObject *tp = _PyType_CAST(type);
540540
if (tp == &PyFilter_Type && !_PyArg_NoKwnames("filter", kwnames)) {
541541
return NULL;
542542
}
@@ -1251,7 +1251,7 @@ static PyObject *
12511251
map_vectorcall(PyObject *type, PyObject * const*args,
12521252
size_t nargsf, PyObject *kwnames)
12531253
{
1254-
PyTypeObject *tp = (PyTypeObject *)type;
1254+
PyTypeObject *tp = _PyType_CAST(type);
12551255
if (tp == &PyMap_Type && !_PyArg_NoKwnames("map", kwnames)) {
12561256
return NULL;
12571257
}

Python/specialize.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,7 @@ specialize_class_call(
13391339
PyObject *callable, _Py_CODEUNIT *instr,
13401340
int nargs, SpecializedCacheEntry *cache)
13411341
{
1342-
assert(PyType_Check(callable));
1343-
PyTypeObject *tp = (PyTypeObject *)callable;
1342+
PyTypeObject *tp = _PyType_CAST(callable);
13441343
if (_Py_OPCODE(instr[-1]) == PRECALL_METHOD) {
13451344
SPECIALIZATION_FAIL(CALL_NO_KW, SPEC_FAIL_METHOD_CALL_CLASS);
13461345
return -1;

0 commit comments

Comments
 (0)