summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
Diffstat (limited to 'Tools')
-rw-r--r--Tools/cases_generator/analyzer.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Tools/cases_generator/analyzer.py b/Tools/cases_generator/analyzer.py
index 679beca..4e1d472 100644
--- a/Tools/cases_generator/analyzer.py
+++ b/Tools/cases_generator/analyzer.py
@@ -8,6 +8,7 @@ from typing import Optional
@dataclass
class Properties:
escaping_calls: dict[lexer.Token, tuple[lexer.Token, lexer.Token]]
+ escapes: bool
error_with_pop: bool
error_without_pop: bool
deopts: bool
@@ -45,6 +46,7 @@ class Properties:
escaping_calls.update(p.escaping_calls)
return Properties(
escaping_calls=escaping_calls,
+ escapes = any(p.escapes for p in properties),
error_with_pop=any(p.error_with_pop for p in properties),
error_without_pop=any(p.error_without_pop for p in properties),
deopts=any(p.deopts for p in properties),
@@ -68,12 +70,9 @@ class Properties:
def infallible(self) -> bool:
return not self.error_with_pop and not self.error_without_pop
- @property
- def escapes(self) -> bool:
- return bool(self.escaping_calls)
-
SKIP_PROPERTIES = Properties(
escaping_calls={},
+ escapes=False,
error_with_pop=False,
error_without_pop=False,
deopts=False,
@@ -815,8 +814,19 @@ def compute_properties(op: parser.InstDef) -> Properties:
)
error_with_pop = has_error_with_pop(op)
error_without_pop = has_error_without_pop(op)
+ escapes = (
+ bool(escaping_calls) or
+ variable_used(op, "Py_DECREF") or
+ variable_used(op, "Py_XDECREF") or
+ variable_used(op, "Py_CLEAR") or
+ variable_used(op, "PyStackRef_CLOSE") or
+ variable_used(op, "PyStackRef_XCLOSE") or
+ variable_used(op, "PyStackRef_CLEAR") or
+ variable_used(op, "SETLOCAL")
+ )
return Properties(
escaping_calls=escaping_calls,
+ escapes=escapes,
error_with_pop=error_with_pop,
error_without_pop=error_without_pop,
deopts=deopts_if,