Open jackyzy823 opened 2 months ago
Simpler code:
a = True
b = False
if a and not b:
print("In if")
else:
print("In false")
decompile to
# Source Generated with Decompyle++
# File: sample.cpython-312.pyc (Python 3.12)
a = True
b = False
if not a and b:
print('In if')
return None
print('In false')
ASM
sample.cpython-312.pyc (Python 3.12)
[Code]
File Name: ./sample.py
Object Name: <module>
Qualified Name: <module>
Arg Count: 0
Pos Only Arg Count: 0
KW Only Arg Count: 0
Stack Size: 3
Flags: 0x00000000
[Names]
'a'
'b'
'print'
[Locals+Names]
[Constants]
True
False
'In if'
'In false'
None
[Disassembly]
0 RESUME 0
2 LOAD_CONST 0: True
4 STORE_NAME 0: a
6 LOAD_CONST 1: False
8 STORE_NAME 1: b
10 LOAD_NAME 0: a
12 POP_JUMP_IF_FALSE 11 (to 36)
14 LOAD_NAME 1: b
16 POP_JUMP_IF_TRUE 9 (to 36)
18 PUSH_NULL
20 LOAD_NAME 2: print
22 LOAD_CONST 2: 'In if'
24 CALL 1
32 POP_TOP
34 RETURN_CONST 4: None
36 PUSH_NULL
38 LOAD_NAME 2: print
40 LOAD_CONST 3: 'In false'
42 CALL 1
50 POP_TOP
52 RETURN_CONST 4: None
Test under Python 3.10
Original file (sample.py)
// Decompile with pycdc
Output file
First, the condition is incorrect. Second the
ext_method2
becomeNone
Disassmeble with pycdas