diff options
author | morpheus65535 <[email protected]> | 2021-01-17 20:52:56 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2021-01-17 20:52:56 -0500 |
commit | 240a3759cf131fdee8767871ee68356785ff4f9e (patch) | |
tree | 09df0073bc61418fd29467d4edbbf02bf4b5f20e | |
parent | b291746a49bcd77db40d65676e3762668076643f (diff) | |
download | bazarr-240a3759cf131fdee8767871ee68356785ff4f9e.tar.gz bazarr-240a3759cf131fdee8767871ee68356785ff4f9e.zip |
Partial fix for #1230: js2py issue under Python 3.8+v0.9.0.8
-rw-r--r-- | libs/js2py/utils/injector.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/js2py/utils/injector.py b/libs/js2py/utils/injector.py index dd714a482..ea236d5e7 100644 --- a/libs/js2py/utils/injector.py +++ b/libs/js2py/utils/injector.py @@ -115,7 +115,16 @@ def append_arguments(code_obj, new_locals): code_obj.co_freevars, code_obj.co_cellvars) # Done modifying codestring - make the code object - return types.CodeType(*args) + if hasattr(code_obj, "replace"): + # Python 3.8+ + return code_obj.replace( + co_argcount=co_argcount + new_locals_len, + co_nlocals=code_obj.co_nlocals + new_locals_len, + co_code=code, + co_names=names, + co_varnames=varnames) + else: + return types.CodeType(*args) def instructions(code_obj): |