marshal.py: Python2 marshal code shouldn't try to turn a code object

into a string. parse3.py: handle both keyword and positional function
calls. scanner34.py: Remove extra level of quoting in LOAD_CONST.
Keyward handling now works cross Python 2/3. Some other spelling and doc fixes.
This commit is contained in:
rocky
2015-12-18 21:15:54 -05:00
parent 347219a009
commit 6bc425b45e
12 changed files with 63 additions and 44 deletions

View File

@@ -60,11 +60,16 @@ class Scanner34(scan.Scanner):
jump_idx += 1
pass
pass
# For constants, the pattr is the same as attr. Using pattr adds
# an extra level of quotes which messes other things up, like getting
# keyword attribute names in a call. I suspect there will be things
# other than LOAD_CONST, but we'll start out with just this for now.
pattr = inst.argval if inst.opname in ['LOAD_CONST'] else inst.argrepr
tokens.append(
Token(
type_ = inst.opname,
attr = inst.argval,
pattr = inst.argrepr,
pattr = pattr,
offset = inst.offset,
linestart = inst.starts_line,
)