Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check for PyReversed_Type
  • Loading branch information
sweeneyde committed Mar 28, 2022
commit 64f77dfc3018e6efd52055daf303e559e498d35a
4 changes: 4 additions & 0 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ initial_counter_value(void) {
#define SPEC_FAIL_COMPARE_OP_EXTENDED_ARG 24

/* FOR_ITER */
#define SPEC_FAIL_FOR_ITER_REVERSED 4
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values below 8 are common, in the section marked /* Common */ above.
You can always raise SPECIALIZATION_FAILURE_KINDS if you need.

#define SPEC_FAIL_FOR_ITER_SQLITE 5
#define SPEC_FAIL_FOR_ITER_IO 6
#define SPEC_FAIL_FOR_ITER_CALLABLE 7
Expand Down Expand Up @@ -2061,6 +2062,9 @@ int
if (t == &PyFilter_Type) {
return SPEC_FAIL_FOR_ITER_FILTER;
}
if (t == &PyReversed_Type) {
return SPEC_FAIL_FOR_ITER_REVERSED;
}
const char *name = t->tp_name;
if (strncmp(name, "_elementtree", 12) == 0) {
return SPEC_FAIL_FOR_ITER_ELEMENTTREE;
Expand Down