diff options
author | Pablo Galindo <pablogsal@gmail.com> | 2022-02-03 22:56:59 (GMT) |
---|---|---|
committer | Pablo Galindo <pablogsal@gmail.com> | 2022-02-03 22:56:59 (GMT) |
commit | bd8b05395ad8877f4a065562444e117b1650c022 (patch) | |
tree | 62635cab257bf3217e660d2f0a6d52b9c96df8b5 /Python/specialize.c | |
parent | 276f38f0a237aa26337a8c0e7633488e2e89d722 (diff) | |
parent | d1df81a730499cc6286d02afa6028a1e9c22bbbf (diff) | |
download | cpython-bd8b05395ad8877f4a065562444e117b1650c022.zip cpython-bd8b05395ad8877f4a065562444e117b1650c022.tar.gz cpython-bd8b05395ad8877f4a065562444e117b1650c022.tar.bz2 |
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'Python/specialize.c')
-rw-r--r-- | Python/specialize.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Python/specialize.c b/Python/specialize.c index 214f297..4070d6a 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -572,6 +572,10 @@ initial_counter_value(void) { #define SPEC_FAIL_ITER_DICT_VALUES 22 #define SPEC_FAIL_ITER_ENUMERATE 23 +/* UNPACK_SEQUENCE */ +#define SPEC_FAIL_TUPLE 10 +#define SPEC_FAIL_LIST 11 + static int specialize_module_load_attr( @@ -1880,7 +1884,6 @@ success: adaptive->counter = initial_counter_value(); } - int _PySpecialization_ClassifyIterator(PyObject *iter) { @@ -1930,3 +1933,15 @@ int } return SPEC_FAIL_OTHER; } + +int +_PySpecialization_ClassifySequence(PyObject *seq) +{ + if (PyTuple_CheckExact(seq)) { + return SPEC_FAIL_TUPLE; + } + if (PyList_CheckExact(seq)) { + return SPEC_FAIL_LIST; + } + return SPEC_FAIL_OTHER; +} |