@@ -311,7 +311,7 @@ optimize(_Py_CODEUNIT *instructions, int len)
311
311
else {
312
312
assert (!_PyOpcode_InlineCacheEntries [opcode ]);
313
313
switch (opcode ) {
314
- case JUMP_ABSOLUTE :
314
+ case JUMP_ABSOLUTE :
315
315
instructions [i ] = _Py_MAKECODEUNIT (JUMP_ABSOLUTE_QUICK , oparg );
316
316
break ;
317
317
case RESUME :
@@ -1475,10 +1475,6 @@ builtin_call_fail_kind(int ml_flags)
1475
1475
}
1476
1476
#endif
1477
1477
1478
- PyObject * builtin_isinstance = NULL ;
1479
- PyObject * builtin_len = NULL ;
1480
- PyObject * builtin_list_append = NULL ;
1481
-
1482
1478
static int
1483
1479
specialize_method_descriptor (PyMethodDescrObject * descr , _Py_CODEUNIT * instr ,
1484
1480
int nargs , PyObject * kwnames , int oparg )
@@ -1488,14 +1484,6 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
1488
1484
SPECIALIZATION_FAIL (PRECALL , SPEC_FAIL_CALL_KWNAMES );
1489
1485
return -1 ;
1490
1486
}
1491
- if (builtin_list_append == NULL ) {
1492
- builtin_list_append = _PyType_Lookup (& PyList_Type , & _Py_ID (append ));
1493
- }
1494
- assert (builtin_list_append != NULL );
1495
- if (nargs == 2 && (PyObject * )descr == builtin_list_append && oparg == 1 ) {
1496
- * instr = _Py_MAKECODEUNIT (PRECALL_NO_KW_LIST_APPEND , _Py_OPARG (* instr ));
1497
- return 0 ;
1498
- }
1499
1487
1500
1488
switch (descr -> d_method -> ml_flags &
1501
1489
(METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O |
@@ -1511,9 +1499,16 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
1511
1499
}
1512
1500
case METH_O : {
1513
1501
if (nargs != 2 ) {
1514
- SPECIALIZATION_FAIL (PRECALL , SPEC_FAIL_OUT_OF_RANGE );
1502
+ SPECIALIZATION_FAIL (PRECALL , SPEC_FAIL_WRONG_NUMBER_ARGUMENTS );
1515
1503
return -1 ;
1516
1504
}
1505
+ PyInterpreterState * interp = _PyInterpreterState_GET ();
1506
+ PyObject * list_append = interp -> callable_cache .list_append ;
1507
+ if ((PyObject * )descr == list_append && oparg == 1 ) {
1508
+ * instr = _Py_MAKECODEUNIT (PRECALL_NO_KW_LIST_APPEND ,
1509
+ _Py_OPARG (* instr ));
1510
+ return 0 ;
1511
+ }
1517
1512
* instr = _Py_MAKECODEUNIT (PRECALL_NO_KW_METHOD_DESCRIPTOR_O ,
1518
1513
_Py_OPARG (* instr ));
1519
1514
return 0 ;
@@ -1705,7 +1700,7 @@ _Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
1705
1700
fail = 0 ;
1706
1701
}
1707
1702
else {
1708
- SPECIALIZATION_FAIL (CALL , call_fail_kind (callable ));
1703
+ SPECIALIZATION_FAIL (PRECALL , call_fail_kind (callable ));
1709
1704
fail = -1 ;
1710
1705
}
1711
1706
if (fail ) {
0 commit comments