Add semantic rule for 3.x "conditionalnot"

This commit is contained in:
rocky
2019-04-22 21:18:17 -04:00
parent f1b69a8a28
commit 3730946a1a
5 changed files with 21 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View 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])

View File

@@ -1,6 +1,7 @@
# Bug in 3.3 weakset
# Bug was not having a rule for 3.x "comp_for"
# RUNNABLE!
class WeakSet:
def __init__(self, data=None):
self.data = set(data)

View File

@@ -27,15 +27,17 @@ from uncompyle6.semantics.customize38 import customize_for_version38
def customize_for_version3(self, version):
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') ),
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
'import_cont' : ( ', %c', 2 ),
'store_locals': ( '%|# inspect.currentframe().f_locals = __locals__\n', ),
'withstmt': ( '%|with %c:\n%+%c%-', 0, 3),
'withasstmt': ( '%|with %c as (%c):\n%+%c%-', 0, 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 ),
'store_locals' : ( '%|# inspect.currentframe().f_locals = __locals__\n', ),
'withstmt' : ( '%|with %c:\n%+%c%-', 0, 3),
'withasstmt' : ( '%|with %c as (%c):\n%+%c%-', 0, 2, 3),
})
assert version >= 3.0