diff --git a/.circleci/config.yml b/.circleci/config.yml index 502464e0..5a65a3d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,7 +42,7 @@ jobs: # This is based on your 1.0 configuration file or project settings - run: working_directory: ~/rocky/python-uncompyle6 - command: pyenv install 2.7.13 && pyenv local 2.7.13 && pyenv rehash && pip install virtualenv && pip install nose && pip install pep8 && pip install six && pyenv rehash + command: pyenv local 2.7.11 && pyenv rehash && pip install virtualenv && pip install nose && pip install pep8 && pip install six && pyenv rehash # Dependencies # This would typically go in either a build or a build-and-test job when using workflows # Restore the dependency cache @@ -57,7 +57,7 @@ jobs: # This is based on your 1.0 configuration file or project settings - run: pip install --upgrade setuptools - run: pip install -e . - - run: pip install pytest==3.2.5 hypothesis + - run: pip install pytest==3.2.5 hypothesis==3.0.0 # Save dependency cache - save_cache: key: v1-dep-{{ .Branch }}-{{ epoch }} @@ -76,7 +76,7 @@ jobs: # This would typically be a build job when using workflows, possibly combined with build # This is based on your 1.0 configuration file or project settings - run: python ./setup.py develop && make check-2.7 - - run: cd ./test/stdlib && pyenv local 2.7.13 && bash ./runtests.sh 'test_[p-z]*.py' + - run: cd ./test/stdlib && pyenv local 2.7.11 && bash ./runtests.sh 'test_[p-z]*.py' # Teardown # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each # Save test results diff --git a/test/bytecode_3.7_run/07_kwargs.pyc b/test/bytecode_3.7_run/07_kwargs.pyc new file mode 100644 index 00000000..20178a52 Binary files /dev/null and b/test/bytecode_3.7_run/07_kwargs.pyc differ diff --git a/test/simple_source/bug36/07_kwargs.py b/test/simple_source/bug36/07_kwargs.py new file mode 100644 index 00000000..88636e24 --- /dev/null +++ b/test/simple_source/bug36/07_kwargs.py @@ -0,0 +1,9 @@ +# Bug in Python 3.6 and 3.7 was getting comma before **kw + +def fn(arg, *, kwarg='test', **kw): + assert arg == 1 + assert kwarg == 'testing' + assert kw['foo'] == 'bar' + + +fn(1, kwarg='testing', foo='bar') diff --git a/uncompyle6/main.py b/uncompyle6/main.py index 3bbbe62d..a5a0daf7 100644 --- a/uncompyle6/main.py +++ b/uncompyle6/main.py @@ -40,10 +40,9 @@ def _get_outstream(outfile): except OSError: pass if PYTHON_VERSION < 3.0: - mode = 'wb' + return open(outfile, mode='wb') else: - mode = 'w' - return open(outfile, mode) + return open(outfile, mode='w', encoding='utf-8') def decompile( bytecode_version, co, out=None, showasm=None, showast=False, diff --git a/uncompyle6/semantics/make_function.py b/uncompyle6/semantics/make_function.py index 7ccd48e1..67d43982 100644 --- a/uncompyle6/semantics/make_function.py +++ b/uncompyle6/semantics/make_function.py @@ -735,7 +735,7 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None): self.write(sep) self.write("%s=%s" % (n, defaults[i])) sep = ', ' - ends_in_comma = True + ends_in_comma = False pass pass pass