GH-118926: Better distinguish between pointer and arrays in interpreter generator (GH-121496)

This commit is contained in:
Mark Shannon 2024-07-09 11:33:56 +01:00 committed by GitHub
parent facf9862da
commit bf8686e1ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 73 additions and 19 deletions

View file

@ -28,14 +28,15 @@ def var_size(var: StackItem) -> str:
if var.condition == "0":
return "0"
elif var.condition == "1":
return var.size
elif var.condition == "oparg & 1" and var.size == "1":
return var.get_size()
elif var.condition == "oparg & 1" and not var.size:
return f"({var.condition})"
else:
return f"(({var.condition}) ? {var.size} : 0)"
else:
return f"(({var.condition}) ? {var.get_size()} : 0)"
elif var.size:
return var.size
else:
return "1"
@dataclass
class StackOffset: