You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Slightly nicer docstring detection for closure
This commit is contained in:
@@ -207,17 +207,12 @@ def customize_for_version36(self, version):
|
|||||||
elif build_class[1][0] == "load_closure":
|
elif build_class[1][0] == "load_closure":
|
||||||
# Python 3 with closures not functions
|
# Python 3 with closures not functions
|
||||||
load_closure = build_class[1]
|
load_closure = build_class[1]
|
||||||
if load_closure[-4] == "LOAD_CODE":
|
subclass_code = None
|
||||||
subclass_code = load_closure[-4].attr
|
for i in range(-4, -1):
|
||||||
elif hasattr(load_closure[-3], "attr"):
|
if load_closure[i] == "LOAD_CODE":
|
||||||
# Python 3.3 classes with closures work like this.
|
subclass_code = load_closure[i].attr
|
||||||
# Note have to test before 3.2 case because
|
break
|
||||||
# index -2 also has an attr.
|
if subclass_code is None:
|
||||||
subclass_code = load_closure[-3].attr
|
|
||||||
elif hasattr(load_closure[-2], "attr"):
|
|
||||||
# Python 3.2 works like this
|
|
||||||
subclass_code = load_closure[-2].attr
|
|
||||||
else:
|
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Internal Error n_classdef: cannot find " "class body"
|
"Internal Error n_classdef: cannot find " "class body"
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user