@@ -1417,28 +1417,28 @@ dummy_func(void) {
14171417
14181418 op (_CALL_LEN , (callable , null , arg -- res , a , c )) {
14191419 res = sym_new_type (ctx , & PyLong_Type );
1420- PyObject * temp = NULL ;
1421-
14221420 Py_ssize_t length = sym_tuple_length (arg );
1423- if (length >= 0 ) {
1424- temp = PyLong_FromSsize_t (length );
1425- if (temp == NULL ) {
1426- goto error ;
1427- }
1428- }
1429- else if (sym_is_const (ctx , arg )) {
1421+
1422+ // Not a tuple, check if it's a const string
1423+ if (length < 0 && sym_is_const (ctx , arg )) {
14301424 PyObject * const_val = sym_get_const (ctx , arg );
1431- if (const_val != NULL && PyUnicode_CheckExact (const_val )) {
1432- temp = PyLong_FromSsize_t (PyUnicode_GET_LENGTH (const_val ));
1433- if (temp == NULL ) {
1434- goto error ;
1425+ if (const_val != NULL ) {
1426+ if (PyUnicode_CheckExact (const_val )) {
1427+ length = PyUnicode_GET_LENGTH (const_val );
1428+ }
1429+ else if (PyBytes_CheckExact (const_val )) {
1430+ length = PyBytes_GET_SIZE (const_val );
14351431 }
14361432 }
14371433 }
1438- if (temp != NULL ) {
1434+
1435+ if (length >= 0 ) {
1436+ PyObject * temp = PyLong_FromSsize_t (length );
1437+ if (temp == NULL ) {
1438+ goto error ;
1439+ }
14391440 if (_Py_IsImmortal (temp )) {
1440- ADD_OP (_SHUFFLE_3_LOAD_CONST_INLINE_BORROW ,
1441- 0 , (uintptr_t )temp );
1441+ ADD_OP (_SHUFFLE_3_LOAD_CONST_INLINE_BORROW , 0 , (uintptr_t )temp );
14421442 }
14431443 res = sym_new_const (ctx , temp );
14441444 Py_DECREF (temp );
0 commit comments