You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Add semantic rule for 3.x "conditionalnot"
This commit is contained in:
BIN
test/bytecode_3.3_run/08_if_else.pyc
Normal file
BIN
test/bytecode_3.3_run/08_if_else.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.6_run/08_if_else.pyc
Normal file
BIN
test/bytecode_3.6_run/08_if_else.pyc
Normal file
Binary file not shown.
10
test/simple_source/bug33/08_if_else.py
Normal file
10
test/simple_source/bug33/08_if_else.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# From python 3.3.7 trace
|
||||||
|
# Bug was not having not having semantic rule for conditional not
|
||||||
|
|
||||||
|
# RUNNABLE!
|
||||||
|
def init(modules=None):
|
||||||
|
mods = set() if not modules else set(modules)
|
||||||
|
return mods
|
||||||
|
|
||||||
|
assert init() == set()
|
||||||
|
assert init([1, 2, 3]) == set([1, 2, 3])
|
@@ -1,6 +1,7 @@
|
|||||||
# Bug in 3.3 weakset
|
# Bug in 3.3 weakset
|
||||||
# Bug was not having a rule for 3.x "comp_for"
|
# Bug was not having a rule for 3.x "comp_for"
|
||||||
|
|
||||||
|
# RUNNABLE!
|
||||||
class WeakSet:
|
class WeakSet:
|
||||||
def __init__(self, data=None):
|
def __init__(self, data=None):
|
||||||
self.data = set(data)
|
self.data = set(data)
|
||||||
|
@@ -27,15 +27,17 @@ from uncompyle6.semantics.customize38 import customize_for_version38
|
|||||||
|
|
||||||
def customize_for_version3(self, version):
|
def customize_for_version3(self, version):
|
||||||
TABLE_DIRECT.update({
|
TABLE_DIRECT.update({
|
||||||
'except_cond2': ( '%|except %c as %c:\n', 1, 5 ),
|
|
||||||
'function_def_annotate': ( '\n\n%|def %c%c\n', -1, 0),
|
|
||||||
'comp_for' : ( ' for %c in %c',
|
'comp_for' : ( ' for %c in %c',
|
||||||
(2, 'store') , (0, 'expr') ),
|
(2, 'store') , (0, 'expr') ),
|
||||||
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
|
'conditionalnot' : ( '%c if not %c else %c',
|
||||||
|
(2, 'expr') , (0, 'expr'), (4, 'expr') ),
|
||||||
|
'except_cond2' : ( '%|except %c as %c:\n', 1, 5 ),
|
||||||
|
'function_def_annotate': ( '\n\n%|def %c%c\n', -1, 0),
|
||||||
|
'importmultiple' : ( '%|import %c%c\n', 2, 3 ),
|
||||||
'import_cont' : ( ', %c', 2 ),
|
'import_cont' : ( ', %c', 2 ),
|
||||||
'store_locals': ( '%|# inspect.currentframe().f_locals = __locals__\n', ),
|
'store_locals' : ( '%|# inspect.currentframe().f_locals = __locals__\n', ),
|
||||||
'withstmt': ( '%|with %c:\n%+%c%-', 0, 3),
|
'withstmt' : ( '%|with %c:\n%+%c%-', 0, 3),
|
||||||
'withasstmt': ( '%|with %c as (%c):\n%+%c%-', 0, 2, 3),
|
'withasstmt' : ( '%|with %c as (%c):\n%+%c%-', 0, 2, 3),
|
||||||
})
|
})
|
||||||
|
|
||||||
assert version >= 3.0
|
assert version >= 3.0
|
||||||
|
Reference in New Issue
Block a user