You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Compare commits
129 Commits
release-py
...
release-3.
Author | SHA1 | Date | |
---|---|---|---|
|
350a16cfa2 | ||
|
5a7024d2a3 | ||
|
e16138527a | ||
|
2362045c84 | ||
|
a29afd6832 | ||
|
1bcf0d54f7 | ||
|
4c6bdd58ab | ||
|
7898fa157b | ||
|
bbdb238ddb | ||
|
ec42ee540c | ||
|
616e5c82f6 | ||
|
1cb31a85fd | ||
|
7d1ecf957c | ||
|
c96e796ff5 | ||
|
f14e1dd62f | ||
|
5f1667988f | ||
|
19ec52eb63 | ||
|
c3e722ad51 | ||
|
31de342528 | ||
|
70f25d5f8d | ||
|
1b71cfef07 | ||
|
e7845ed2e4 | ||
|
f4a1e9e40f | ||
|
b9e8e619f6 | ||
|
5c88f804c1 | ||
|
35834b06d4 | ||
|
27febca918 | ||
|
37b917ed7c | ||
|
82499b50bb | ||
|
c6b3e20b47 | ||
|
93e889e82a | ||
|
4cbd136635 | ||
|
488a14488c | ||
|
44321fcedf | ||
|
1e0a6d528e | ||
|
40fa379fd9 | ||
|
34ec41f274 | ||
|
3daf3732c3 | ||
|
988efa3693 | ||
|
bc16cc93d6 | ||
|
8d1bd6d5b5 | ||
|
c148e49670 | ||
|
fb31fe1f35 | ||
|
fa5da2b1ef | ||
|
f331deb864 | ||
|
1350f4c899 | ||
|
6fd8d2556b | ||
|
276fb77e71 | ||
|
f547ec9291 | ||
|
4f994b4cae | ||
|
98cd06d6e0 | ||
|
a3b6806c33 | ||
|
66ebb15d42 | ||
|
8955788990 | ||
|
9415ad34ff | ||
|
476db9ad1d | ||
|
9ba0b1bad2 | ||
|
b7942bc5f2 | ||
|
3ac4f1ee61 | ||
|
55d2df04f7 | ||
|
6d529d3cee | ||
|
201e5b18b1 | ||
|
ac2bbfc65a | ||
|
3b8e6635e2 | ||
|
7e172b63d1 | ||
|
c01eb554ed | ||
|
d32e67891b | ||
|
78b8d1cd06 | ||
|
600e56b1d7 | ||
|
170504c518 | ||
|
e3d918df3d | ||
|
e7b62a722f | ||
|
92d63ac598 | ||
|
79bed3419f | ||
|
0353b74a7a | ||
|
67910e7d8e | ||
|
61fa4fe391 | ||
|
a8cdcc4d85 | ||
|
f0176add7a | ||
|
45c8d62e68 | ||
|
096563cf91 | ||
|
7fd21aa227 | ||
|
82bc294995 | ||
|
9d3e4a6660 | ||
|
7dfade1195 | ||
|
1df5aa0ef9 | ||
|
c06ba45991 | ||
|
7fab91eb4e | ||
|
c2181e3235 | ||
|
3695921364 | ||
|
d14193f219 | ||
|
94251cd294 | ||
|
a9515c7aab | ||
|
e5f3d803a8 | ||
|
e5ae70bea8 | ||
|
189605ea2c | ||
|
4c74bf1d9d | ||
|
c087bd785e | ||
|
80b68af2d3 | ||
|
24ccc16701 | ||
|
69714fb65a | ||
|
b94f98f8f7 | ||
|
f05b092983 | ||
|
76a66c3460 | ||
|
91224b2382 | ||
|
e76f1f107f | ||
|
2f8e063a99 | ||
|
15533c5e38 | ||
|
6511cc4dd4 | ||
|
fdf97a1cc0 | ||
|
24011bb0da | ||
|
4f61321c91 | ||
|
269f4f2e1b | ||
|
aab951280b | ||
|
f1e48fb60a | ||
|
c0022ed5b7 | ||
|
41a50b5e46 | ||
|
0154c87d63 | ||
|
c9c70103aa | ||
|
a18dc340ce | ||
|
037648577f | ||
|
cd62e54c88 | ||
|
ef9ccc3a8c | ||
|
c397bf6bda | ||
|
0aa41058a6 | ||
|
27f67e6fca | ||
|
6fcf49b214 | ||
|
49661b222e | ||
|
c481d97866 |
89
.circleci/config.yml
Normal file
89
.circleci/config.yml
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# This configuration was automatically generated from a CircleCI 1.0 config.
|
||||||
|
# It should include any build commands you had along with commands that CircleCI
|
||||||
|
# inferred from your project structure. We strongly recommend you read all the
|
||||||
|
# comments in this file to understand the structure of CircleCI 2.0, as the idiom
|
||||||
|
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather
|
||||||
|
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated
|
||||||
|
# configuration as a reference rather than using it in production, though in most
|
||||||
|
# cases it should duplicate the execution of your original 1.0 config.
|
||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
working_directory: ~/rocky/python-uncompyle6
|
||||||
|
parallelism: 1
|
||||||
|
shell: /bin/bash --login
|
||||||
|
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
|
||||||
|
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables .
|
||||||
|
environment:
|
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||||
|
COMPILE: --compile
|
||||||
|
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages.
|
||||||
|
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images.
|
||||||
|
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job.
|
||||||
|
# We have selected a pre-built image that mirrors the build environment we use on
|
||||||
|
# the 1.0 platform, but we recommend you choose an image more tailored to the needs
|
||||||
|
# of each job. For more information on choosing an image (or alternatively using a
|
||||||
|
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/
|
||||||
|
# To see the list of pre-built images that CircleCI provides for most common languages see
|
||||||
|
# https://circleci.com/docs/2.0/circleci-images/
|
||||||
|
docker:
|
||||||
|
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
|
||||||
|
command: /sbin/init
|
||||||
|
steps:
|
||||||
|
# Machine Setup
|
||||||
|
# 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
|
||||||
|
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
||||||
|
- checkout
|
||||||
|
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
|
||||||
|
# In many cases you can simplify this from what is generated here.
|
||||||
|
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
|
||||||
|
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
||||||
|
# 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
|
||||||
|
# Dependencies
|
||||||
|
# This would typically go in either a build or a build-and-test job when using workflows
|
||||||
|
# Restore the dependency cache
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
# This branch if available
|
||||||
|
- v1-dep-{{ .Branch }}-
|
||||||
|
# Default branch if not
|
||||||
|
- v1-dep-master-
|
||||||
|
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
|
||||||
|
- v1-dep-
|
||||||
|
# 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
|
||||||
|
# Save dependency cache
|
||||||
|
- save_cache:
|
||||||
|
key: v1-dep-{{ .Branch }}-{{ epoch }}
|
||||||
|
paths:
|
||||||
|
# This is a broad list of cache paths to include many possible development environments
|
||||||
|
# You can probably delete some of these entries
|
||||||
|
- vendor/bundle
|
||||||
|
- ~/virtualenvs
|
||||||
|
- ~/.m2
|
||||||
|
- ~/.ivy2
|
||||||
|
- ~/.bundle
|
||||||
|
- ~/.go_workspace
|
||||||
|
- ~/.gradle
|
||||||
|
- ~/.cache/bower
|
||||||
|
# Test
|
||||||
|
# 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'
|
||||||
|
# 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
|
||||||
|
- store_test_results:
|
||||||
|
path: /tmp/circleci-test-results
|
||||||
|
# Save artifacts
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-artifacts
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-test-results
|
77
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
77
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Tell us about uncompyle6 bugs
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- __Note:__ Have you read https://github.com/rocky/python-uncompyle6/blob/master/HOW-TO-REPORT-A-BUG.md ?
|
||||||
|
|
||||||
|
Please remove any of the optional sections if they are not applicable.
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
|
||||||
|
* Make sure the bytecode you have can be disassembled with a
|
||||||
|
disassembler.
|
||||||
|
* Don't put bytecode and corresponding source code on any service that
|
||||||
|
requires registration to download.
|
||||||
|
* When you open a bug report there is no privacy. If the legitimacy of
|
||||||
|
the activity is deemed suspicous, I may flag it as suspicious,
|
||||||
|
making the issue even more easy to detect.
|
||||||
|
|
||||||
|
Bug reports that violate a prerequisite may be discarded.
|
||||||
|
|
||||||
|
Note that there are way more bug-fix requestors than there are bug
|
||||||
|
fixers. If you want you need more immediate, confidential or urgent
|
||||||
|
assistance
|
||||||
|
|
||||||
|
http://www.crazy-compilers.com/decompyle/ offers a byte-code
|
||||||
|
decompiler service for versions of Python up to 2.6.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- Add a clear and concise description of the bug. -->
|
||||||
|
|
||||||
|
## How to Reproduce
|
||||||
|
|
||||||
|
<!-- Please show both the input you gave and the
|
||||||
|
output you got in describing how to reproduce the bug:
|
||||||
|
|
||||||
|
or give a complete console log with input and output
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ uncompyle6 <command-line-options>
|
||||||
|
...
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
Provide links to the Python bytecode. For example you can create a
|
||||||
|
gist with the information. If you have the correct source code, you
|
||||||
|
can add that too.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Expected behavior
|
||||||
|
|
||||||
|
<!-- Add a clear and concise description of what you expected to happen. -->
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
|
||||||
|
<!-- _This section sometimes is optional but helpful to us._
|
||||||
|
|
||||||
|
Please modify for your setup
|
||||||
|
|
||||||
|
- Uncompyle6 version: output from `uncompyle6 --version` or `pip show uncompyle6`
|
||||||
|
- Python version: `python -V`
|
||||||
|
- OS and Version: [e.g. Ubuntu bionic]
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Additional Environment or Context
|
||||||
|
|
||||||
|
<!-- _This section is optional._
|
||||||
|
|
||||||
|
Add any other context about the problem here or special environment setup.
|
||||||
|
|
||||||
|
-->
|
22
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature Request
|
||||||
|
about: Tell us about a new feature that you would like to see in uncompyle6
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- Add a short description of the feature. This might
|
||||||
|
include same input and output. -->
|
||||||
|
|
||||||
|
## Background
|
||||||
|
|
||||||
|
<!-- Add any additional background for the
|
||||||
|
feature, for example: user scenarios, or the value of the feature. -->
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
<!-- _This section is optional._
|
||||||
|
|
||||||
|
Add text with suggestions on how to test the feature,
|
||||||
|
if it is not obvious.
|
||||||
|
-->
|
@@ -6,9 +6,7 @@ python:
|
|||||||
- '3.5'
|
- '3.5'
|
||||||
- '2.7'
|
- '2.7'
|
||||||
- '2.6'
|
- '2.6'
|
||||||
- '3.3'
|
|
||||||
- '3.4'
|
- '3.4'
|
||||||
- '3.2'
|
|
||||||
- '3.6'
|
- '3.6'
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
@@ -33,7 +33,7 @@ prescribed cases, the ill-defined amorphous cases as well will get
|
|||||||
handled as well.
|
handled as well.
|
||||||
|
|
||||||
In sum, you may need to do some work to have the bug you have found
|
In sum, you may need to do some work to have the bug you have found
|
||||||
handled before the hundreds of other bugs, and things I could be
|
handled before the hundreds of other bugs, and other things I could be
|
||||||
doing.
|
doing.
|
||||||
|
|
||||||
No one is getting paid to work to work on this project, let alone the
|
No one is getting paid to work to work on this project, let alone the
|
||||||
|
1
Makefile
1
Makefile
@@ -38,6 +38,7 @@ check-3.0 check-3.1 check-3.2 check-3.6:
|
|||||||
$(MAKE) -C test $@
|
$(MAKE) -C test $@
|
||||||
|
|
||||||
check-3.7: pytest
|
check-3.7: pytest
|
||||||
|
$(MAKE) -C test check
|
||||||
|
|
||||||
#:PyPy 2.6.1 PyPy 5.0.1, or PyPy 5.8.0-beta0
|
#:PyPy 2.6.1 PyPy 5.0.1, or PyPy 5.8.0-beta0
|
||||||
# Skip for now
|
# Skip for now
|
||||||
|
26
NEWS
26
NEWS
@@ -1,3 +1,29 @@
|
|||||||
|
uncompyle6 3.2.4 2018-06-04 7x9 release
|
||||||
|
|
||||||
|
- Bug fixes #180, #182, #187, #192
|
||||||
|
- Enhancements #189
|
||||||
|
- Internal improvements
|
||||||
|
|
||||||
|
uncompyle6 3.2.3 2018-06-04 Michael Cohen flips and Fleetwood Redux
|
||||||
|
|
||||||
|
- Python 1.3 support 3.0 bug and
|
||||||
|
- fix botched parameter ordering of 3.x in last release
|
||||||
|
|
||||||
|
uncompyle6 3.2.2 2018-06-04 When I'm 64
|
||||||
|
|
||||||
|
- Python 3.0 support and bug fixes
|
||||||
|
|
||||||
|
uncompyle6 3.2.1 2018-06-04 MF
|
||||||
|
|
||||||
|
- Python 1.4 and 1.5 bug fixes
|
||||||
|
|
||||||
|
uncompyle6 3.2.0 2018-05-19 Rocket Scientist
|
||||||
|
|
||||||
|
- Add rudimentary 1.4 support (still a bit buggy)
|
||||||
|
- add --tree+ option to show formatting rule, when it is constant
|
||||||
|
- Python 2.7.15candidate1 support (via xdis)
|
||||||
|
- bug fixes, especially for 3.7 (but 2.7 and 3.6 and others as well)
|
||||||
|
|
||||||
uncompyle6 3.1.3 2018-04-16
|
uncompyle6 3.1.3 2018-04-16
|
||||||
|
|
||||||
- Add some Python 3.7 rules, such as for handling LOAD_METHOD (not complete)
|
- Add some Python 3.7 rules, such as for handling LOAD_METHOD (not complete)
|
||||||
|
65
README.rst
65
README.rst
@@ -1,4 +1,4 @@
|
|||||||
|buildstatus|
|
|buildstatus| |Latest Version| |Supported Python Versions|
|
||||||
|
|
||||||
uncompyle6
|
uncompyle6
|
||||||
==========
|
==========
|
||||||
@@ -11,8 +11,9 @@ Introduction
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
*uncompyle6* translates Python bytecode back into equivalent Python
|
*uncompyle6* translates Python bytecode back into equivalent Python
|
||||||
source code. It accepts bytecodes from Python version 1.5, and 2.1 to
|
source code. It accepts bytecodes from Python version 1.3 to version
|
||||||
3.7 or so, including PyPy bytecode and Dropbox's Python 2.5 bytecode.
|
3.7, spanning over 22 years of Python releases. We include Dropbox's
|
||||||
|
Python 2.5 bytecode and some PyPy bytecode.
|
||||||
|
|
||||||
Why this?
|
Why this?
|
||||||
---------
|
---------
|
||||||
@@ -29,11 +30,11 @@ CPython bytecode decompilers is the ability to deparse just
|
|||||||
*fragments* of source code and give source-code information around a
|
*fragments* of source code and give source-code information around a
|
||||||
given bytecode offset.
|
given bytecode offset.
|
||||||
|
|
||||||
I use the tree fragments to deparse fragments of code inside my
|
I use the tree fragments to deparse fragments of code *at run time*
|
||||||
trepan_ debuggers_. For that, bytecode offsets are recorded and
|
inside my trepan_ debuggers_. For that, bytecode offsets are recorded
|
||||||
associated with fragments of the source code. This purpose, although
|
and associated with fragments of the source code. This purpose,
|
||||||
compatible with the original intention, is yet a little bit different.
|
although compatible with the original intention, is yet a little bit
|
||||||
See this_ for more information.
|
different. See this_ for more information.
|
||||||
|
|
||||||
Python fragment deparsing given an instruction offset is useful in
|
Python fragment deparsing given an instruction offset is useful in
|
||||||
showing stack traces and can be encorporated into any program that
|
showing stack traces and can be encorporated into any program that
|
||||||
@@ -58,7 +59,7 @@ provides decompilation for subset of Python versions, we generally do
|
|||||||
demonstrably better for those as well.
|
demonstrably better for those as well.
|
||||||
|
|
||||||
How can we tell? By taking Python bytecode that comes distributed with
|
How can we tell? By taking Python bytecode that comes distributed with
|
||||||
that version of Python and decompiling these. Among htose that
|
that version of Python and decompiling these. Among those that
|
||||||
successfully decompile, we can then make sure the resulting programs
|
successfully decompile, we can then make sure the resulting programs
|
||||||
are syntactically correct by running the Python interpreter for that
|
are syntactically correct by running the Python interpreter for that
|
||||||
bytecode version. Finally, in cases where the program has a test for
|
bytecode version. Finally, in cases where the program has a test for
|
||||||
@@ -75,7 +76,7 @@ Requirements
|
|||||||
The code here can be run on Python versions 2.6 or later, PyPy 3-2.4,
|
The code here can be run on Python versions 2.6 or later, PyPy 3-2.4,
|
||||||
or PyPy-5.0.1. Python versions 2.4-2.7 are supported in the
|
or PyPy-5.0.1. Python versions 2.4-2.7 are supported in the
|
||||||
python-2.4 branch. The bytecode files it can read have been tested on
|
python-2.4 branch. The bytecode files it can read have been tested on
|
||||||
Python bytecodes from versions 1.5, 2.1-2.7, and 3.0-3.6 and the
|
Python bytecodes from versions 1.4, 2.1-2.7, and 3.0-3.6 and the
|
||||||
above-mentioned PyPy versions.
|
above-mentioned PyPy versions.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
@@ -151,12 +152,12 @@ for that bytecode version. Having done this the bytecode produced
|
|||||||
could be compared with the original bytecode. However as Python's code
|
could be compared with the original bytecode. However as Python's code
|
||||||
generation got better, this is no longer feasible.
|
generation got better, this is no longer feasible.
|
||||||
|
|
||||||
There is a kind of *weak verification* that we use that doesn't check
|
There verification that we use that doesn't check bytecode for
|
||||||
bytecode for equivalence but does check to see if the resulting
|
equivalence but does check to see if the resulting decompiled source
|
||||||
decompiled source is a valid Python program by running the Python
|
is a valid Python program by running the Python interpreter. Because
|
||||||
interpreter. Because the Python language has changed so much, for best
|
the Python language has changed so much, for best results you should
|
||||||
results you should use the same Python version in checking as was used
|
use the same Python version in checking as was used in creating the
|
||||||
in creating the bytecode.
|
bytecode.
|
||||||
|
|
||||||
There are however an interesting class of these programs that is
|
There are however an interesting class of these programs that is
|
||||||
readily available give stronger verification: those programs that
|
readily available give stronger verification: those programs that
|
||||||
@@ -174,19 +175,21 @@ that era was minimal)
|
|||||||
|
|
||||||
There is some work to do on the lower end Python versions which is
|
There is some work to do on the lower end Python versions which is
|
||||||
more difficult for us to handle since we don't have a Python
|
more difficult for us to handle since we don't have a Python
|
||||||
interpreter for versions 1.5, 1.6, and 2.0.
|
interpreter for versions 1.6, and 2.0.
|
||||||
|
|
||||||
In the Python 3 series, Python support is is strongest around 3.4 or
|
In the Python 3 series, Python support is is strongest around 3.4 or
|
||||||
3.3 and drops off as you move further away from those versions. Python
|
3.3 and drops off as you move further away from those versions. Python
|
||||||
3.6 changes things drastically by using word codes rather than byte
|
3.0 is weird in that it in some ways resembles 2.6 more than it does
|
||||||
codes. As a result, the jump offset field in a jump instruction
|
3.1 or 2.7. Python 3.6 changes things drastically by using word codes
|
||||||
argument has been reduced. This makes the `EXTENDED_ARG` instructions
|
rather than byte codes. As a result, the jump offset field in a jump
|
||||||
are now more prevalent in jump instruction; previously they had been
|
instruction argument has been reduced. This makes the `EXTENDED_ARG`
|
||||||
rare. Perhaps to compensate for the additional `EXTENDED_ARG`
|
instructions are now more prevalent in jump instruction; previously
|
||||||
instructions, additional jump optimization has been added. So in sum
|
they had been rare. Perhaps to compensate for the additional
|
||||||
handling control flow by ad hoc means as is currently done is worse.
|
`EXTENDED_ARG` instructions, additional jump optimization has been
|
||||||
|
added. So in sum handling control flow by ad hoc means as is currently
|
||||||
|
done is worse.
|
||||||
|
|
||||||
Also, between Python 3.5, 3.6 and 3.7 there have been major changes to the
|
Between Python 3.5, 3.6 and 3.7 there have been major changes to the
|
||||||
`MAKE_FUNCTION` and `CALL_FUNCTION` instructions.
|
`MAKE_FUNCTION` and `CALL_FUNCTION` instructions.
|
||||||
|
|
||||||
Currently not all Python magic numbers are supported. Specifically in
|
Currently not all Python magic numbers are supported. Specifically in
|
||||||
@@ -212,11 +215,12 @@ There is lots to do, so please dig in and help.
|
|||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* https://github.com/zrax/pycdc : supports all versions of Python and is written in C++. Support for Python 3 is a bit lacking though.
|
* https://github.com/zrax/pycdc : purports to support all versions of Python. It is written in C++ and is most accurate for Python versions around 2.7 and 3.3 when the code was more actively developed. Accuracy for more recent versions of Python 3 and early versions of Python are especially lacking. See its `issue tracker <https://github.com/zrax/pycdc/issues>`_ for details. Currently lightly maintained.
|
||||||
* https://code.google.com/archive/p/unpyc3/ : supports Python 3.2 only. The above projects use a different decompiling technique than what is used here.
|
* https://code.google.com/archive/p/unpyc3/ : supports Python 3.2 only. The above projects use a different decompiling technique than what is used here. Currently unmaintained.
|
||||||
* https://github.com/figment/unpyc3/ : fork of above, but supports Python 3.3 only. Includes some fixes like supporting function annotations
|
* https://github.com/figment/unpyc3/ : fork of above, but supports Python 3.3 only. Includes some fixes like supporting function annotations. Currently unmaintained.
|
||||||
* The HISTORY_ file.
|
* https://github.com/wibiti/uncompyle2 : supports Python 2.7 only, but does that fairly well. There are situtations where `uncompyle6` results are incorrect while `uncompyle2` results are not, but more often uncompyle6 is correct when uncompyle2 is not. Because `uncompyle6` adheres to accuracy over idiomatic Python, `uncompyle2` can produce more natural-looking code when it is correct. Currently `uncompyle2` is lightly maintained. See its issue `tracker <https://github.com/wibiti/uncompyle2/issues>`_ for more details
|
||||||
* `How to report a bug <https://github.com/rocky/python-uncompyle6/blob/master/HOW-TO-REPORT-A-BUG.md>`_
|
* `How to report a bug <https://github.com/rocky/python-uncompyle6/blob/master/HOW-TO-REPORT-A-BUG.md>`_
|
||||||
|
* The HISTORY_ file.
|
||||||
* https://github.com/rocky/python-xdis : Cross Python version disassembler
|
* https://github.com/rocky/python-xdis : Cross Python version disassembler
|
||||||
* https://github.com/rocky/python-xasm : Cross Python version assembler
|
* https://github.com/rocky/python-xasm : Cross Python version assembler
|
||||||
* https://github.com/rocky/python-uncompyle6/wiki : Wiki Documents which describe the code and aspects of it in more detail
|
* https://github.com/rocky/python-uncompyle6/wiki : Wiki Documents which describe the code and aspects of it in more detail
|
||||||
@@ -234,3 +238,6 @@ See Also
|
|||||||
.. _PJOrion: http://www.koreanrandom.com/forum/topic/15280-pjorion-%D1%80%D0%B5%D0%B4%D0%B0%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F-%D0%B4%D0%B5%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F-%D0%BE%D0%B1%D1%84
|
.. _PJOrion: http://www.koreanrandom.com/forum/topic/15280-pjorion-%D1%80%D0%B5%D0%B4%D0%B0%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F-%D0%B4%D0%B5%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F-%D0%BE%D0%B1%D1%84
|
||||||
.. _Deobfuscator: https://github.com/extremecoders-re/PjOrion-Deobfuscator
|
.. _Deobfuscator: https://github.com/extremecoders-re/PjOrion-Deobfuscator
|
||||||
.. _Py2EXE: https://en.wikipedia.org/wiki/Py2exe
|
.. _Py2EXE: https://en.wikipedia.org/wiki/Py2exe
|
||||||
|
.. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/uncompyle6.svg
|
||||||
|
.. |Latest Version| image:: https://badge.fury.io/py/uncompyle6.svg
|
||||||
|
:target: https://badge.fury.io/py/uncompyle6
|
||||||
|
@@ -35,6 +35,7 @@ classifiers = ['Development Status :: 5 - Production/Stable',
|
|||||||
'Programming Language :: Python :: 2.5',
|
'Programming Language :: Python :: 2.5',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
|
'Programming Language :: Python :: 3.0',
|
||||||
'Programming Language :: Python :: 3.1',
|
'Programming Language :: Python :: 3.1',
|
||||||
'Programming Language :: Python :: 3.2',
|
'Programming Language :: Python :: 3.2',
|
||||||
'Programming Language :: Python :: 3.3',
|
'Programming Language :: Python :: 3.3',
|
||||||
@@ -55,8 +56,8 @@ entry_points = {
|
|||||||
'pydisassemble=uncompyle6.bin.pydisassemble:main',
|
'pydisassemble=uncompyle6.bin.pydisassemble:main',
|
||||||
]}
|
]}
|
||||||
ftp_url = None
|
ftp_url = None
|
||||||
install_requires = ['spark-parser >= 1.8.5, < 1.9.0',
|
install_requires = ['spark-parser >= 1.8.7, < 1.9.0',
|
||||||
'xdis >= 3.8.0, < 3.9.0', 'six']
|
'xdis >= 3.8.8, < 3.9.0']
|
||||||
|
|
||||||
license = 'GPL3'
|
license = 'GPL3'
|
||||||
mailing_list = 'python-debugger@googlegroups.com'
|
mailing_list = 'python-debugger@googlegroups.com'
|
||||||
|
@@ -16,6 +16,7 @@ if ! source ./setup-master.sh ; then
|
|||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
for version in $PYVERSIONS; do
|
for version in $PYVERSIONS; do
|
||||||
|
echo --- $version ---
|
||||||
if ! pyenv local $version ; then
|
if ! pyenv local $version ; then
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
@@ -23,4 +24,5 @@ for version in $PYVERSIONS; do
|
|||||||
if ! make check; then
|
if ! make check; then
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
echo === $version ===
|
||||||
done
|
done
|
||||||
|
@@ -15,6 +15,7 @@ fi
|
|||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
for version in $PYVERSIONS; do
|
for version in $PYVERSIONS; do
|
||||||
|
echo --- $version ---
|
||||||
if ! pyenv local $version ; then
|
if ! pyenv local $version ; then
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
@@ -22,4 +23,5 @@ for version in $PYVERSIONS; do
|
|||||||
if ! make check ; then
|
if ! make check ; then
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
echo === $version ===
|
||||||
done
|
done
|
||||||
|
@@ -5,4 +5,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
|
|||||||
echo "This script should be *sourced* rather than run directly through bash"
|
echo "This script should be *sourced* rather than run directly through bash"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
export PYVERSIONS='3.5.5 3.6.5 2.6.9 3.3.7 2.7.14 3.2.6 3.1.5 3.4.8'
|
export PYVERSIONS='3.5.5 3.6.6 3.7.1 2.6.9 3.3.7 2.7.15 3.2.6 3.1.5 3.4.8'
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
PYTHON_VERSION=3.6.4
|
PYTHON_VERSION=3.6.5
|
||||||
|
|
||||||
# FIXME put some of the below in a common routine
|
# FIXME put some of the below in a common routine
|
||||||
function finish {
|
function finish {
|
||||||
|
@@ -47,7 +47,7 @@ install:
|
|||||||
|
|
||||||
# Upgrade to the latest version of pip to avoid it displaying warnings
|
# Upgrade to the latest version of pip to avoid it displaying warnings
|
||||||
# about it being out of date.
|
# about it being out of date.
|
||||||
- "pip install --disable-pip-version-check --user --upgrade pip"
|
- "%PYTHON%\\python.exe -m pip install --disable-pip-version-check --user --upgrade pip"
|
||||||
|
|
||||||
# Install the build dependencies of the project. If some dependencies contain
|
# Install the build dependencies of the project. If some dependencies contain
|
||||||
# compiled extensions and are not provided as pre-built wheel packages,
|
# compiled extensions and are not provided as pre-built wheel packages,
|
||||||
|
14
circle.yml
14
circle.yml
@@ -1,14 +0,0 @@
|
|||||||
machine:
|
|
||||||
python:
|
|
||||||
version: 2.7.10
|
|
||||||
environment:
|
|
||||||
COMPILE: --compile
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
override:
|
|
||||||
- pip install -e .
|
|
||||||
- pip install pytest==3.2.5 hypothesis
|
|
||||||
test:
|
|
||||||
override:
|
|
||||||
- python ./setup.py develop && make check-2.7
|
|
||||||
- cd ./test/stdlib && pyenv local 2.7.10 && bash ./runtests.sh 'test_[p-z]*.py'
|
|
@@ -1,150 +1,154 @@
|
|||||||
# std
|
# std
|
||||||
import os
|
|
||||||
# test
|
# test
|
||||||
import pytest
|
|
||||||
import hypothesis
|
|
||||||
from hypothesis import strategies as st
|
|
||||||
# uncompyle6
|
|
||||||
from uncompyle6 import PYTHON_VERSION, deparse_code
|
from uncompyle6 import PYTHON_VERSION, deparse_code
|
||||||
|
import pytest
|
||||||
|
pytestmark = pytest.mark.skipif(PYTHON_VERSION <= 2.6,
|
||||||
|
reason='hypothesis needs 2.7 or later')
|
||||||
|
if PYTHON_VERSION > 2.6:
|
||||||
|
|
||||||
|
import hypothesis
|
||||||
|
from hypothesis import strategies as st
|
||||||
|
|
||||||
|
# uncompyle6
|
||||||
|
|
||||||
|
|
||||||
@st.composite
|
@st.composite
|
||||||
def expressions(draw):
|
def expressions(draw):
|
||||||
# todo : would be nice to generate expressions using hypothesis however
|
# todo : would be nice to generate expressions using hypothesis however
|
||||||
# this is pretty involved so for now just use a corpus of expressions
|
# this is pretty involved so for now just use a corpus of expressions
|
||||||
# from which to select.
|
# from which to select.
|
||||||
return draw(st.sampled_from((
|
return draw(st.sampled_from((
|
||||||
'abc',
|
'abc',
|
||||||
'len(items)',
|
'len(items)',
|
||||||
'x + 1',
|
'x + 1',
|
||||||
'lineno',
|
'lineno',
|
||||||
'container',
|
'container',
|
||||||
'self.attribute',
|
'self.attribute',
|
||||||
'self.method()',
|
'self.method()',
|
||||||
# These expressions are failing, I think these are control
|
# These expressions are failing, I think these are control
|
||||||
# flow problems rather than problems with FORMAT_VALUE,
|
# flow problems rather than problems with FORMAT_VALUE,
|
||||||
# however I need to confirm this...
|
# however I need to confirm this...
|
||||||
#'sorted(items, key=lambda x: x.name)',
|
#'sorted(items, key=lambda x: x.name)',
|
||||||
#'func(*args, **kwargs)',
|
#'func(*args, **kwargs)',
|
||||||
#'text or default',
|
#'text or default',
|
||||||
#'43 if life_the_universe and everything else None'
|
#'43 if life_the_universe and everything else None'
|
||||||
)))
|
)))
|
||||||
|
|
||||||
|
|
||||||
@st.composite
|
@st.composite
|
||||||
def format_specifiers(draw):
|
def format_specifiers(draw):
|
||||||
"""
|
"""
|
||||||
Generate a valid format specifier using the rules:
|
Generate a valid format specifier using the rules:
|
||||||
|
|
||||||
format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]
|
format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]
|
||||||
fill ::= <any character>
|
fill ::= <any character>
|
||||||
align ::= "<" | ">" | "=" | "^"
|
align ::= "<" | ">" | "=" | "^"
|
||||||
sign ::= "+" | "-" | " "
|
sign ::= "+" | "-" | " "
|
||||||
width ::= integer
|
width ::= integer
|
||||||
precision ::= integer
|
precision ::= integer
|
||||||
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
|
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
|
||||||
|
|
||||||
See https://docs.python.org/2/library/string.html
|
See https://docs.python.org/2/library/string.html
|
||||||
|
|
||||||
:param draw: Let hypothesis draw from other strategies.
|
:param draw: Let hypothesis draw from other strategies.
|
||||||
|
|
||||||
:return: An example format_specifier.
|
:return: An example format_specifier.
|
||||||
"""
|
"""
|
||||||
alphabet_strategy = st.characters(min_codepoint=ord('a'), max_codepoint=ord('z'))
|
alphabet_strategy = st.characters(min_codepoint=ord('a'), max_codepoint=ord('z'))
|
||||||
fill = draw(st.one_of(alphabet_strategy, st.none()))
|
fill = draw(st.one_of(alphabet_strategy, st.none()))
|
||||||
align = draw(st.sampled_from(list('<>=^')))
|
align = draw(st.sampled_from(list('<>=^')))
|
||||||
fill_align = (fill + align or '') if fill else ''
|
fill_align = (fill + align or '') if fill else ''
|
||||||
|
|
||||||
type_ = draw(st.sampled_from('bcdeEfFgGnosxX%'))
|
type_ = draw(st.sampled_from('bcdeEfFgGnosxX%'))
|
||||||
can_have_sign = type_ in 'deEfFgGnoxX%'
|
can_have_sign = type_ in 'deEfFgGnoxX%'
|
||||||
can_have_comma = type_ in 'deEfFgG%'
|
can_have_comma = type_ in 'deEfFgG%'
|
||||||
can_have_precision = type_ in 'fFgG'
|
can_have_precision = type_ in 'fFgG'
|
||||||
can_have_pound = type_ in 'boxX%'
|
can_have_pound = type_ in 'boxX%'
|
||||||
can_have_zero = type_ in 'oxX'
|
can_have_zero = type_ in 'oxX'
|
||||||
|
|
||||||
sign = draw(st.sampled_from(list('+- ') + [''])) if can_have_sign else ''
|
sign = draw(st.sampled_from(list('+- ') + [''])) if can_have_sign else ''
|
||||||
pound = draw(st.sampled_from(('#', '',))) if can_have_pound else ''
|
pound = draw(st.sampled_from(('#', '',))) if can_have_pound else ''
|
||||||
zero = draw(st.sampled_from(('0', '',))) if can_have_zero else ''
|
zero = draw(st.sampled_from(('0', '',))) if can_have_zero else ''
|
||||||
|
|
||||||
int_strategy = st.integers(min_value=1, max_value=1000)
|
int_strategy = st.integers(min_value=1, max_value=1000)
|
||||||
|
|
||||||
width = draw(st.one_of(int_strategy, st.none()))
|
width = draw(st.one_of(int_strategy, st.none()))
|
||||||
width = str(width) if width is not None else ''
|
width = str(width) if width is not None else ''
|
||||||
|
|
||||||
comma = draw(st.sampled_from((',', '',))) if can_have_comma else ''
|
comma = draw(st.sampled_from((',', '',))) if can_have_comma else ''
|
||||||
if can_have_precision:
|
if can_have_precision:
|
||||||
precision = draw(st.one_of(int_strategy, st.none()))
|
precision = draw(st.one_of(int_strategy, st.none()))
|
||||||
precision = '.' + str(precision) if precision else ''
|
precision = '.' + str(precision) if precision else ''
|
||||||
else:
|
else:
|
||||||
precision = ''
|
precision = ''
|
||||||
|
|
||||||
return ''.join((fill_align, sign, pound, zero, width, comma, precision, type_,))
|
return ''.join((fill_align, sign, pound, zero, width, comma, precision, type_,))
|
||||||
|
|
||||||
|
|
||||||
@st.composite
|
@st.composite
|
||||||
def fstrings(draw):
|
def fstrings(draw):
|
||||||
"""
|
"""
|
||||||
Generate a valid f-string.
|
Generate a valid f-string.
|
||||||
See https://www.python.org/dev/peps/pep-0498/#specification
|
See https://www.python.org/dev/peps/pep-0498/#specification
|
||||||
|
|
||||||
:param draw: Let hypothsis draw from other strategies.
|
:param draw: Let hypothsis draw from other strategies.
|
||||||
|
|
||||||
:return: A valid f-string.
|
:return: A valid f-string.
|
||||||
"""
|
"""
|
||||||
character_strategy = st.characters(
|
character_strategy = st.characters(
|
||||||
blacklist_characters='\r\n\'\\s{}',
|
blacklist_characters='\r\n\'\\s{}',
|
||||||
min_codepoint=1,
|
min_codepoint=1,
|
||||||
max_codepoint=1000,
|
max_codepoint=1000,
|
||||||
)
|
)
|
||||||
is_raw = draw(st.booleans())
|
is_raw = draw(st.booleans())
|
||||||
integer_strategy = st.integers(min_value=0, max_value=3)
|
integer_strategy = st.integers(min_value=0, max_value=3)
|
||||||
expression_count = draw(integer_strategy)
|
expression_count = draw(integer_strategy)
|
||||||
content = []
|
content = []
|
||||||
for _ in range(expression_count):
|
for _ in range(expression_count):
|
||||||
expression = draw(expressions())
|
expression = draw(expressions())
|
||||||
conversion = draw(st.sampled_from(('', '!s', '!r', '!a',)))
|
conversion = draw(st.sampled_from(('', '!s', '!r', '!a',)))
|
||||||
has_specifier = draw(st.booleans())
|
has_specifier = draw(st.booleans())
|
||||||
specifier = ':' + draw(format_specifiers()) if has_specifier else ''
|
specifier = ':' + draw(format_specifiers()) if has_specifier else ''
|
||||||
content.append('{{{}{}}}'.format(expression, conversion, specifier))
|
content.append('{{{}{}}}'.format(expression, conversion, specifier))
|
||||||
content.append(draw(st.text(character_strategy)))
|
content.append(draw(st.text(character_strategy)))
|
||||||
content = ''.join(content)
|
content = ''.join(content)
|
||||||
return "f{}'{}'".format('r' if is_raw else '', content)
|
return "f{}'{}'".format('r' if is_raw else '', content)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need at least python 3.6')
|
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need at least python 3.6')
|
||||||
@hypothesis.given(format_specifiers())
|
@hypothesis.given(format_specifiers())
|
||||||
def test_format_specifiers(format_specifier):
|
def test_format_specifiers(format_specifier):
|
||||||
"""Verify that format_specifiers generates valid specifiers"""
|
"""Verify that format_specifiers generates valid specifiers"""
|
||||||
try:
|
try:
|
||||||
exec('"{:' + format_specifier + '}".format(0)')
|
exec('"{:' + format_specifier + '}".format(0)')
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if 'Unknown format code' not in str(e):
|
if 'Unknown format code' not in str(e):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def run_test(text):
|
def run_test(text):
|
||||||
hypothesis.assume(len(text))
|
hypothesis.assume(len(text))
|
||||||
hypothesis.assume("f'{" in text)
|
hypothesis.assume("f'{" in text)
|
||||||
expr = text + '\n'
|
expr = text + '\n'
|
||||||
code = compile(expr, '<string>', 'single')
|
code = compile(expr, '<string>', 'single')
|
||||||
deparsed = deparse_code(PYTHON_VERSION, code, compile_mode='single')
|
deparsed = deparse_code(PYTHON_VERSION, code, compile_mode='single')
|
||||||
recompiled = compile(deparsed.text, '<string>', 'single')
|
recompiled = compile(deparsed.text, '<string>', 'single')
|
||||||
if recompiled != code:
|
if recompiled != code:
|
||||||
assert 'dis(' + deparsed.text.strip('\n') + ')' == 'dis(' + expr.strip('\n') + ')'
|
assert 'dis(' + deparsed.text.strip('\n') + ')' == 'dis(' + expr.strip('\n') + ')'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need at least python 3.6')
|
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need at least python 3.6')
|
||||||
@hypothesis.given(fstrings())
|
@hypothesis.given(fstrings())
|
||||||
def test_uncompyle_fstring(fstring):
|
def test_uncompyle_fstring(fstring):
|
||||||
"""Verify uncompyling fstring bytecode"""
|
"""Verify uncompyling fstring bytecode"""
|
||||||
run_test(fstring)
|
run_test(fstring)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need at least python 3.6')
|
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need at least python 3.6')
|
||||||
@pytest.mark.parametrize('fstring', [
|
@pytest.mark.parametrize('fstring', [
|
||||||
"f'{abc}{abc!s}'",
|
"f'{abc}{abc!s}'",
|
||||||
"f'{abc}0'",
|
"f'{abc}0'",
|
||||||
])
|
])
|
||||||
def test_uncompyle_direct(fstring):
|
def test_uncompyle_direct(fstring):
|
||||||
"""useful for debugging"""
|
"""useful for debugging"""
|
||||||
run_test(fstring)
|
run_test(fstring)
|
||||||
|
@@ -1,184 +1,185 @@
|
|||||||
# std
|
|
||||||
import string
|
import string
|
||||||
# 3rd party
|
|
||||||
from hypothesis import given, assume, example, settings, strategies as st
|
|
||||||
import pytest
|
|
||||||
# uncompyle
|
|
||||||
from validate import validate_uncompyle
|
|
||||||
from test_fstring import expressions
|
|
||||||
from uncompyle6 import PYTHON_VERSION
|
from uncompyle6 import PYTHON_VERSION
|
||||||
|
import pytest
|
||||||
|
pytestmark = pytest.mark.skip(PYTHON_VERSION < 2.7,
|
||||||
|
reason="need at least Python 2.7")
|
||||||
|
|
||||||
alpha = st.sampled_from(string.ascii_lowercase)
|
if PYTHON_VERSION > 2.6:
|
||||||
numbers = st.sampled_from(string.digits)
|
from hypothesis import given, assume, example, settings, strategies as st
|
||||||
alphanum = st.sampled_from(string.ascii_lowercase + string.digits)
|
from validate import validate_uncompyle
|
||||||
|
from test_fstring import expressions
|
||||||
|
|
||||||
|
alpha = st.sampled_from(string.ascii_lowercase)
|
||||||
|
numbers = st.sampled_from(string.digits)
|
||||||
|
alphanum = st.sampled_from(string.ascii_lowercase + string.digits)
|
||||||
|
|
||||||
|
|
||||||
@st.composite
|
@st.composite
|
||||||
def function_calls(draw,
|
def function_calls(draw,
|
||||||
min_keyword_args=0, max_keyword_args=5,
|
min_keyword_args=0, max_keyword_args=5,
|
||||||
min_positional_args=0, max_positional_args=5,
|
min_positional_args=0, max_positional_args=5,
|
||||||
min_star_args=0, max_star_args=1,
|
min_star_args=0, max_star_args=1,
|
||||||
min_double_star_args=0, max_double_star_args=1):
|
min_double_star_args=0, max_double_star_args=1):
|
||||||
"""
|
"""
|
||||||
Strategy factory for generating function calls.
|
Strategy factory for generating function calls.
|
||||||
|
|
||||||
:param draw: Callable which draws examples from other strategies.
|
:param draw: Callable which draws examples from other strategies.
|
||||||
|
|
||||||
:return: The function call text.
|
:return: The function call text.
|
||||||
"""
|
"""
|
||||||
st_positional_args = st.lists(
|
st_positional_args = st.lists(
|
||||||
alpha,
|
alpha,
|
||||||
min_size=min_positional_args,
|
min_size=min_positional_args,
|
||||||
max_size=max_positional_args
|
max_size=max_positional_args
|
||||||
)
|
)
|
||||||
st_keyword_args = st.lists(
|
st_keyword_args = st.lists(
|
||||||
alpha,
|
alpha,
|
||||||
min_size=min_keyword_args,
|
min_size=min_keyword_args,
|
||||||
max_size=max_keyword_args
|
max_size=max_keyword_args
|
||||||
)
|
)
|
||||||
st_star_args = st.lists(
|
st_star_args = st.lists(
|
||||||
alpha,
|
alpha,
|
||||||
min_size=min_star_args,
|
min_size=min_star_args,
|
||||||
max_size=max_star_args
|
max_size=max_star_args
|
||||||
)
|
)
|
||||||
st_double_star_args = st.lists(
|
st_double_star_args = st.lists(
|
||||||
alpha,
|
alpha,
|
||||||
min_size=min_double_star_args,
|
min_size=min_double_star_args,
|
||||||
max_size=max_double_star_args
|
max_size=max_double_star_args
|
||||||
)
|
)
|
||||||
|
|
||||||
positional_args = draw(st_positional_args)
|
positional_args = draw(st_positional_args)
|
||||||
keyword_args = draw(st_keyword_args)
|
keyword_args = draw(st_keyword_args)
|
||||||
st_values = st.lists(
|
st_values = st.lists(
|
||||||
expressions(),
|
expressions(),
|
||||||
min_size=len(keyword_args),
|
min_size=len(keyword_args),
|
||||||
max_size=len(keyword_args)
|
max_size=len(keyword_args)
|
||||||
)
|
)
|
||||||
keyword_args = [
|
keyword_args = [
|
||||||
x + '=' + e
|
x + '=' + e
|
||||||
for x, e in
|
for x, e in
|
||||||
zip(keyword_args, draw(st_values))
|
zip(keyword_args, draw(st_values))
|
||||||
]
|
]
|
||||||
star_args = ['*' + x for x in draw(st_star_args)]
|
star_args = ['*' + x for x in draw(st_star_args)]
|
||||||
double_star_args = ['**' + x for x in draw(st_double_star_args)]
|
double_star_args = ['**' + x for x in draw(st_double_star_args)]
|
||||||
|
|
||||||
arguments = positional_args + keyword_args + star_args + double_star_args
|
arguments = positional_args + keyword_args + star_args + double_star_args
|
||||||
draw(st.randoms()).shuffle(arguments)
|
draw(st.randoms()).shuffle(arguments)
|
||||||
arguments = ','.join(arguments)
|
arguments = ','.join(arguments)
|
||||||
|
|
||||||
function_call = 'fn({arguments})'.format(arguments=arguments)
|
function_call = 'fn({arguments})'.format(arguments=arguments)
|
||||||
try:
|
try:
|
||||||
# TODO: Figure out the exact rules for ordering of positional, keyword,
|
# TODO: Figure out the exact rules for ordering of positional, keyword,
|
||||||
# star args, double star args and in which versions the various
|
# star args, double star args and in which versions the various
|
||||||
# types of arguments are supported so we don't need to check that the
|
# types of arguments are supported so we don't need to check that the
|
||||||
# expression compiles like this.
|
# expression compiles like this.
|
||||||
compile(function_call, '<string>', 'single')
|
compile(function_call, '<string>', 'single')
|
||||||
except:
|
except:
|
||||||
assume(False)
|
assume(False)
|
||||||
return function_call
|
return function_call
|
||||||
|
|
||||||
|
|
||||||
def test_function_no_args():
|
def test_function_no_args():
|
||||||
validate_uncompyle("fn()")
|
validate_uncompyle("fn()")
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
|
||||||
reason="need at least Python 2.7")
|
|
||||||
def isolated_function_calls(which):
|
|
||||||
"""
|
|
||||||
Returns a strategy for generating function calls, but isolated to
|
|
||||||
particular types of arguments, for example only positional arguments.
|
|
||||||
|
|
||||||
This can help reason about debugging errors in specific types of function
|
|
||||||
calls.
|
|
||||||
|
|
||||||
:param which: One of 'keyword', 'positional', 'star', 'double_star'
|
|
||||||
|
|
||||||
:return: Strategy for generating an function call isolated to specific
|
|
||||||
argument types.
|
|
||||||
"""
|
|
||||||
kwargs = dict(
|
|
||||||
max_keyword_args=0,
|
|
||||||
max_positional_args=0,
|
|
||||||
max_star_args=0,
|
|
||||||
max_double_star_args=0,
|
|
||||||
)
|
|
||||||
kwargs['_'.join(('min', which, 'args'))] = 1
|
|
||||||
kwargs['_'.join(('max', which, 'args'))] = 5 if 'star' not in which else 1
|
|
||||||
return function_calls(**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
with settings(max_examples=25):
|
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
||||||
reason="need at least Python 2.7")
|
reason="need at least Python 2.7")
|
||||||
@given(isolated_function_calls('positional'))
|
def isolated_function_calls(which):
|
||||||
@example("fn(0)")
|
"""
|
||||||
def test_function_positional_only(expr):
|
Returns a strategy for generating function calls, but isolated to
|
||||||
validate_uncompyle(expr)
|
particular types of arguments, for example only positional arguments.
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
This can help reason about debugging errors in specific types of function
|
||||||
reason="need at least Python 2.7")
|
calls.
|
||||||
@given(isolated_function_calls('keyword'))
|
|
||||||
@example("fn(a=0)")
|
|
||||||
def test_function_call_keyword_only(expr):
|
|
||||||
validate_uncompyle(expr)
|
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
:param which: One of 'keyword', 'positional', 'star', 'double_star'
|
||||||
reason="need at least Python 2.7")
|
|
||||||
@given(isolated_function_calls('star'))
|
|
||||||
@example("fn(*items)")
|
|
||||||
def test_function_call_star_only(expr):
|
|
||||||
validate_uncompyle(expr)
|
|
||||||
|
|
||||||
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
:return: Strategy for generating an function call isolated to specific
|
||||||
reason="need at least Python 2.7")
|
argument types.
|
||||||
@given(isolated_function_calls('double_star'))
|
"""
|
||||||
@example("fn(**{})")
|
kwargs = dict(
|
||||||
def test_function_call_double_star_only(expr):
|
max_keyword_args=0,
|
||||||
validate_uncompyle(expr)
|
max_positional_args=0,
|
||||||
|
max_star_args=0,
|
||||||
|
max_double_star_args=0,
|
||||||
|
)
|
||||||
|
kwargs['_'.join(('min', which, 'args'))] = 1
|
||||||
|
kwargs['_'.join(('max', which, 'args'))] = 5 if 'star' not in which else 1
|
||||||
|
return function_calls(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
with settings(max_examples=25):
|
||||||
def test_BUILD_CONST_KEY_MAP_BUILD_MAP_UNPACK_WITH_CALL_BUILD_TUPLE_CALL_FUNCTION_EX():
|
|
||||||
validate_uncompyle("fn(w=0,m=0,**v)")
|
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
||||||
|
reason="need at least Python 2.7")
|
||||||
|
@given(isolated_function_calls('positional'))
|
||||||
|
@example("fn(0)")
|
||||||
|
def test_function_positional_only(expr):
|
||||||
|
validate_uncompyle(expr)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
||||||
|
reason="need at least Python 2.7")
|
||||||
|
@given(isolated_function_calls('keyword'))
|
||||||
|
@example("fn(a=0)")
|
||||||
|
def test_function_call_keyword_only(expr):
|
||||||
|
validate_uncompyle(expr)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
||||||
|
reason="need at least Python 2.7")
|
||||||
|
@given(isolated_function_calls('star'))
|
||||||
|
@example("fn(*items)")
|
||||||
|
def test_function_call_star_only(expr):
|
||||||
|
validate_uncompyle(expr)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
|
||||||
|
reason="need at least Python 2.7")
|
||||||
|
@given(isolated_function_calls('double_star'))
|
||||||
|
@example("fn(**{})")
|
||||||
|
def test_function_call_double_star_only(expr):
|
||||||
|
validate_uncompyle(expr)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_BUILD_MAP_BUILD_MAP_UNPACK_WITH_CALL_BUILD_TUPLE_CALL_FUNCTION_EX():
|
def test_BUILD_CONST_KEY_MAP_BUILD_MAP_UNPACK_WITH_CALL_BUILD_TUPLE_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(a=0,**g)")
|
validate_uncompyle("fn(w=0,m=0,**v)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_CALL_FUNCTION_EX():
|
def test_BUILD_MAP_BUILD_MAP_UNPACK_WITH_CALL_BUILD_TUPLE_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(*g,**j)")
|
validate_uncompyle("fn(a=0,**g)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_BUILD_MAP_CALL_FUNCTION_EX():
|
def test_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(*z,u=0)")
|
validate_uncompyle("fn(*g,**j)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_BUILD_TUPLE_CALL_FUNCTION_EX():
|
def test_BUILD_MAP_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(**a)")
|
validate_uncompyle("fn(*z,u=0)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_BUILD_MAP_BUILD_TUPLE_BUILD_TUPLE_UNPACK_WITH_CALL_CALL_FUNCTION_EX():
|
def test_BUILD_TUPLE_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(b,b,b=0,*a)")
|
validate_uncompyle("fn(**a)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_BUILD_TUPLE_BUILD_TUPLE_UNPACK_WITH_CALL_CALL_FUNCTION_EX():
|
def test_BUILD_MAP_BUILD_TUPLE_BUILD_TUPLE_UNPACK_WITH_CALL_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(*c,v)")
|
validate_uncompyle("fn(b,b,b=0,*a)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
@pytest.mark.xfail()
|
||||||
def test_BUILD_CONST_KEY_MAP_CALL_FUNCTION_EX():
|
def test_BUILD_TUPLE_BUILD_TUPLE_UNPACK_WITH_CALL_CALL_FUNCTION_EX():
|
||||||
validate_uncompyle("fn(i=0,y=0,*p)")
|
validate_uncompyle("fn(*c,v)")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason='skipping property based test until all individual tests are passing')
|
@pytest.mark.xfail()
|
||||||
@given(function_calls())
|
def test_BUILD_CONST_KEY_MAP_CALL_FUNCTION_EX():
|
||||||
def test_function_call(function_call):
|
validate_uncompyle("fn(i=0,y=0,*p)")
|
||||||
validate_uncompyle(function_call)
|
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason='skipping property based test until all individual tests are passing')
|
||||||
|
@given(function_calls())
|
||||||
|
def test_function_call(function_call):
|
||||||
|
validate_uncompyle(function_call)
|
||||||
|
@@ -46,13 +46,11 @@ def test_grammar():
|
|||||||
unused_rhs.add("mkfunc_annotate")
|
unused_rhs.add("mkfunc_annotate")
|
||||||
unused_rhs.add("dict_comp")
|
unused_rhs.add("dict_comp")
|
||||||
unused_rhs.add("classdefdeco1")
|
unused_rhs.add("classdefdeco1")
|
||||||
if PYTHON_VERSION != 3.6:
|
if PYTHON_VERSION >= 3.5:
|
||||||
if PYTHON_VERSION in (3.5, 3.7):
|
expect_right_recursive.add((('l_stmts',
|
||||||
expect_right_recursive.add((('l_stmts',
|
('lastl_stmt', 'come_froms', 'l_stmts'))))
|
||||||
('lastl_stmt', 'come_froms', 'l_stmts'))))
|
|
||||||
pass
|
|
||||||
pass
|
pass
|
||||||
else:
|
elif 3.0 < PYTHON_VERSION < 3.3:
|
||||||
expect_right_recursive.add((('l_stmts',
|
expect_right_recursive.add((('l_stmts',
|
||||||
('lastl_stmt', 'COME_FROM', 'l_stmts'))))
|
('lastl_stmt', 'COME_FROM', 'l_stmts'))))
|
||||||
pass
|
pass
|
||||||
|
@@ -1,21 +1,22 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from uncompyle6 import PYTHON_VERSION, deparse_code
|
from uncompyle6 import PYTHON_VERSION, code_deparse
|
||||||
|
pytestmark = pytest.mark.skip(PYTHON_VERSION < 2.7,
|
||||||
|
reason="need at least Python 2.7")
|
||||||
|
|
||||||
@pytest.mark.skip(PYTHON_VERSION < 2.7,
|
if PYTHON_VERSION > 2.6:
|
||||||
reason="need at least Python 2.7")
|
def test_single_mode():
|
||||||
def test_single_mode():
|
single_expressions = (
|
||||||
single_expressions = (
|
'i = 1',
|
||||||
'i = 1',
|
'i and (j or k)',
|
||||||
'i and (j or k)',
|
'i += 1',
|
||||||
'i += 1',
|
'i = j % 4',
|
||||||
'i = j % 4',
|
'i = {}',
|
||||||
'i = {}',
|
'i = []',
|
||||||
'i = []',
|
'for i in range(10):\n i\n',
|
||||||
'for i in range(10):\n i\n',
|
'for i in range(10):\n for j in range(10):\n i + j\n',
|
||||||
'for i in range(10):\n for j in range(10):\n i + j\n',
|
'try:\n i\nexcept Exception:\n j\nelse:\n k\n'
|
||||||
'try:\n i\nexcept Exception:\n j\nelse:\n k\n'
|
)
|
||||||
)
|
|
||||||
|
|
||||||
for expr in single_expressions:
|
for expr in single_expressions:
|
||||||
code = compile(expr + '\n', '<string>', 'single')
|
code = compile(expr + '\n', '<string>', 'single')
|
||||||
assert deparse_code(PYTHON_VERSION, code, compile_mode='single').text == expr + '\n'
|
assert code_deparse(code, compile_mode='single').text == expr + '\n'
|
||||||
|
@@ -6,16 +6,19 @@ import difflib
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import functools
|
import functools
|
||||||
# compatability
|
|
||||||
import six
|
|
||||||
# uncompyle6 / xdis
|
# uncompyle6 / xdis
|
||||||
from uncompyle6 import PYTHON_VERSION, IS_PYPY, deparse_code
|
from uncompyle6 import PYTHON_VERSION, PYTHON3, IS_PYPY, deparse_code
|
||||||
# TODO : I think we can get xdis to support the dis api (python 3 version) by doing something like this there
|
# TODO : I think we can get xdis to support the dis api (python 3 version) by doing something like this there
|
||||||
from xdis.bytecode import Bytecode
|
from xdis.bytecode import Bytecode
|
||||||
from xdis.main import get_opcode
|
from xdis.main import get_opcode
|
||||||
opc = get_opcode(PYTHON_VERSION, IS_PYPY)
|
opc = get_opcode(PYTHON_VERSION, IS_PYPY)
|
||||||
Bytecode = functools.partial(Bytecode, opc=opc)
|
Bytecode = functools.partial(Bytecode, opc=opc)
|
||||||
|
import six
|
||||||
|
|
||||||
|
if PYTHON3:
|
||||||
|
from io import StringIO
|
||||||
|
else:
|
||||||
|
from StringIO import StringIO
|
||||||
|
|
||||||
def _dis_to_text(co):
|
def _dis_to_text(co):
|
||||||
return Bytecode(co).dis()
|
return Bytecode(co).dis()
|
||||||
|
@@ -1,3 +1,2 @@
|
|||||||
pytest>=3.0.0,<=3.0.1
|
|
||||||
flake8
|
flake8
|
||||||
hypothesis<=3.0.0
|
hypothesis<=3.0.0
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
# Pick up stuff from setup.py
|
# Pick up stuff from setup.py
|
||||||
|
hypothesis==2.0.0
|
||||||
|
pytest
|
||||||
-e .
|
-e .
|
||||||
|
6
setup.py
6
setup.py
@@ -4,12 +4,12 @@ import sys
|
|||||||
"""Setup script for the 'uncompyle6' distribution."""
|
"""Setup script for the 'uncompyle6' distribution."""
|
||||||
|
|
||||||
SYS_VERSION = sys.version_info[0:2]
|
SYS_VERSION = sys.version_info[0:2]
|
||||||
if not ((2, 6) <= SYS_VERSION <= (3, 7)) or ((3, 0) <= SYS_VERSION <= (3, 0)):
|
if not ((2, 6) <= SYS_VERSION <= (3, 7)):
|
||||||
mess = "Python Release 2.6 .. 3.7 excluding 3.0 are supported in this code branch."
|
mess = "Python Release 2.6 .. 3.7 are supported in this code branch."
|
||||||
if ((2, 4) <= SYS_VERSION <= (2, 7)):
|
if ((2, 4) <= SYS_VERSION <= (2, 7)):
|
||||||
mess += ("\nFor your Python, version %s, use the python-2.4 code/branch." %
|
mess += ("\nFor your Python, version %s, use the python-2.4 code/branch." %
|
||||||
sys.version[0:3])
|
sys.version[0:3])
|
||||||
elif SYS_VERSION < (2, 4) or (3, 0) <= SYS_VERSION:
|
elif SYS_VERSION < (2, 4):
|
||||||
mess += ("\nThis package is not supported for Python version %s."
|
mess += ("\nThis package is not supported for Python version %s."
|
||||||
% sys.version[0:3])
|
% sys.version[0:3])
|
||||||
print(mess)
|
print(mess)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
PHONY=check clean dist distclean test test-unit test-functional rmChangeLog clean_pyc nosetests \
|
PHONY=check clean dist distclean test test-unit test-functional rmChangeLog clean_pyc nosetests \
|
||||||
check-bytecode-1.5 check-bytecode-1 check-bytecode-2 check-bytecode-3 \
|
check-bytecode-1 check-bytecode-1.3 check-bytecode-1.4 check-bytecode-1.5 \
|
||||||
|
check-bytecode-2 check-bytecode-3 check-bytecode-3-short \
|
||||||
check-bytecode-2.2 check-byteocde-2.3 check-bytecode-2.4 \
|
check-bytecode-2.2 check-byteocde-2.3 check-bytecode-2.4 \
|
||||||
check-short check-2.6 check-2.7 check-3.0 check-3.1 check-3.2 check-3.3 \
|
check-short check-2.6 check-2.7 check-3.0 check-3.1 check-3.2 check-3.3 \
|
||||||
check-3.4 check-3.5 check-3.6 check-3.7 check-5.6 5.6 5.8 \
|
check-3.4 check-3.5 check-3.6 check-3.7 check-5.6 5.6 5.8 \
|
||||||
@@ -21,7 +22,7 @@ COVER_DIR=../tmp/grammar-cover
|
|||||||
# Run short tests
|
# Run short tests
|
||||||
check-short:
|
check-short:
|
||||||
@$(PYTHON) -V && PYTHON_VERSION=`$(PYTHON) -V 2>&1 | cut -d ' ' -f 2 | cut -d'.' -f1,2`; \
|
@$(PYTHON) -V && PYTHON_VERSION=`$(PYTHON) -V 2>&1 | cut -d ' ' -f 2 | cut -d'.' -f1,2`; \
|
||||||
$(MAKE) check-bytecode
|
$(MAKE) check-bytecode-short
|
||||||
|
|
||||||
# Run all tests
|
# Run all tests
|
||||||
check:
|
check:
|
||||||
@@ -33,6 +34,7 @@ check-2.6 check-2.7: check-bytecode-2 check-bytecode-3 check-bytecode-1 check-na
|
|||||||
#: Run working tests from Python 3.0
|
#: Run working tests from Python 3.0
|
||||||
check-3.0: check-bytecode
|
check-3.0: check-bytecode
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.0 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.0 --weak-verify $(COMPILE)
|
||||||
|
$(PYTHON) test_pythonlib.py --bytecode-3.0-run --verify-run
|
||||||
|
|
||||||
#: Run working tests from Python 3.1
|
#: Run working tests from Python 3.1
|
||||||
check-3.1: check-bytecode
|
check-3.1: check-bytecode
|
||||||
@@ -76,7 +78,7 @@ check-disasm:
|
|||||||
$(PYTHON) dis-compare.py
|
$(PYTHON) dis-compare.py
|
||||||
|
|
||||||
#: Check deparsing bytecode 1.x only
|
#: Check deparsing bytecode 1.x only
|
||||||
check-bytecode-1: check-bytecode-1.5
|
check-bytecode-1: check-bytecode-1.4 check-bytecode-1.5
|
||||||
|
|
||||||
#: Check deparsing bytecode 2.x only
|
#: Check deparsing bytecode 2.x only
|
||||||
check-bytecode-2:
|
check-bytecode-2:
|
||||||
@@ -90,14 +92,35 @@ check-bytecode-3:
|
|||||||
--bytecode-3.1 --bytecode-3.2 --bytecode-3.3 \
|
--bytecode-3.1 --bytecode-3.2 --bytecode-3.3 \
|
||||||
--bytecode-3.4 --bytecode-3.5 --bytecode-3.6 --bytecode-pypy3.2
|
--bytecode-3.4 --bytecode-3.5 --bytecode-3.6 --bytecode-pypy3.2
|
||||||
|
|
||||||
#: Check deparsing bytecode that works running Python 2 and Python 3
|
#: Check deparsing on selected bytecode 3.x
|
||||||
|
check-bytecode-3-short:
|
||||||
|
$(PYTHON) test_pythonlib.py \
|
||||||
|
--bytecode-3.4 --bytecode-3.5 --bytecode-3.6
|
||||||
|
|
||||||
|
#: Check deparsing bytecode on all Python 2 and Python 3 versions
|
||||||
check-bytecode: check-bytecode-3
|
check-bytecode: check-bytecode-3
|
||||||
$(PYTHON) test_pythonlib.py \
|
$(PYTHON) test_pythonlib.py \
|
||||||
|
--bytecode-1.3 --bytecode-1.4 --bytecode-1.5 \
|
||||||
|
--bytecode-2.2 --bytecode-2.3 --bytecode-2.4 \
|
||||||
--bytecode-2.1 --bytecode-2.2 --bytecode-2.3 --bytecode-2.4 \
|
--bytecode-2.1 --bytecode-2.2 --bytecode-2.3 --bytecode-2.4 \
|
||||||
--bytecode-2.5 --bytecode-2.6 --bytecode-2.7 \
|
--bytecode-2.5 --bytecode-2.6 --bytecode-2.7 \
|
||||||
--bytecode-pypy2.7
|
--bytecode-pypy2.7
|
||||||
|
|
||||||
|
|
||||||
|
#: Check deparsing bytecode on selected Python 2 and Python 3 versions
|
||||||
|
check-bytecode-short: check-bytecode-3-short
|
||||||
|
$(PYTHON) test_pythonlib.py \
|
||||||
|
--bytecode-2.6 --bytecode-2.7 --bytecode-pypy2.7
|
||||||
|
|
||||||
|
|
||||||
|
#: Check deparsing bytecode 1.3 only
|
||||||
|
check-bytecode-1.3:
|
||||||
|
$(PYTHON) test_pythonlib.py --bytecode-1.3
|
||||||
|
|
||||||
|
#: Check deparsing bytecode 1.4 only
|
||||||
|
check-bytecode-1.4:
|
||||||
|
$(PYTHON) test_pythonlib.py --bytecode-1.4
|
||||||
|
|
||||||
#: Check deparsing bytecode 1.5 only
|
#: Check deparsing bytecode 1.5 only
|
||||||
check-bytecode-1.5:
|
check-bytecode-1.5:
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-1.5
|
$(PYTHON) test_pythonlib.py --bytecode-1.5
|
||||||
@@ -202,6 +225,7 @@ check-bytecode-2.7:
|
|||||||
#: Check deparsing Python 3.0
|
#: Check deparsing Python 3.0
|
||||||
check-bytecode-3.0:
|
check-bytecode-3.0:
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.0 --weak-verify
|
$(PYTHON) test_pythonlib.py --bytecode-3.0 --weak-verify
|
||||||
|
$(PYTHON) test_pythonlib.py --bytecode-3.0-run --verify-run
|
||||||
|
|
||||||
#: Check deparsing Python 3.1
|
#: Check deparsing Python 3.1
|
||||||
check-bytecode-3.1:
|
check-bytecode-3.1:
|
||||||
@@ -263,7 +287,7 @@ check-3.4-ok:
|
|||||||
2.6:
|
2.6:
|
||||||
|
|
||||||
#: PyPy 5.0.x with Python 2.7 ...
|
#: PyPy 5.0.x with Python 2.7 ...
|
||||||
pypy-2.7 5.0 5.3:
|
pypy-2.7 5.0 5.3 6.0:
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-pypy2.7 --verify
|
$(PYTHON) test_pythonlib.py --bytecode-pypy2.7 --verify
|
||||||
|
|
||||||
#: PyPy 2.4.x with Python 3.2 ...
|
#: PyPy 2.4.x with Python 3.2 ...
|
||||||
|
BIN
test/bytecode_1.3/test_builtin.pyc
Normal file
BIN
test/bytecode_1.3/test_builtin.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.3/test_exceptions.pyc
Normal file
BIN
test/bytecode_1.3/test_exceptions.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.3/test_operations.pyc
Normal file
BIN
test/bytecode_1.3/test_operations.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.3/testall.pyc
Normal file
BIN
test/bytecode_1.3/testall.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/01_print-1.4.pyc
Normal file
BIN
test/bytecode_1.4/01_print-1.4.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/02_continue.pyc
Normal file
BIN
test/bytecode_1.4/02_continue.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/addpack.pyc
Normal file
BIN
test/bytecode_1.4/addpack.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/anydbm.pyc
Normal file
BIN
test/bytecode_1.4/anydbm.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/bisect.pyc
Normal file
BIN
test/bytecode_1.4/bisect.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/cmp.pyc
Normal file
BIN
test/bytecode_1.4/cmp.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/cmpcache.pyc
Normal file
BIN
test/bytecode_1.4/cmpcache.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/dbhash.pyc
Normal file
BIN
test/bytecode_1.4/dbhash.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/emacs.pyc
Normal file
BIN
test/bytecode_1.4/emacs.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/glob.pyc
Normal file
BIN
test/bytecode_1.4/glob.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_class.pyc
Normal file
BIN
test/bytecode_1.4/test_class.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_del.pyc
Normal file
BIN
test/bytecode_1.4/test_del.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_docstring.pyc
Normal file
BIN
test/bytecode_1.4/test_docstring.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_empty.pyc
Normal file
BIN
test/bytecode_1.4/test_empty.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_exec.pyc
Normal file
BIN
test/bytecode_1.4/test_exec.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_global.pyc
Normal file
BIN
test/bytecode_1.4/test_global.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_globals.pyc
Normal file
BIN
test/bytecode_1.4/test_globals.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.4/test_single_stmt.pyc
Normal file
BIN
test/bytecode_1.4/test_single_stmt.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_1.5/00_unpack_list.pyc
Normal file
BIN
test/bytecode_1.5/00_unpack_list.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_2.4/03_iftrue.pyc
Normal file
BIN
test/bytecode_2.4/03_iftrue.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_2.6/04_lastc_with_loops.pyc
Normal file
BIN
test/bytecode_2.6/04_lastc_with_loops.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.6_run/01_ifelse_listcomp.pyc
Normal file
BIN
test/bytecode_2.6_run/01_ifelse_listcomp.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.6_run/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_2.6_run/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.6_run/03_complex_and.pyc-notyet
Normal file
BIN
test/bytecode_2.6_run/03_complex_and.pyc-notyet
Normal file
Binary file not shown.
BIN
test/bytecode_2.7.5/01_while1.pyc
Normal file
BIN
test/bytecode_2.7.5/01_while1.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_2.7/03_for_try_raise.pyc
Normal file
BIN
test/bytecode_2.7/03_for_try_raise.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.7/04_while1_while1.pyc
Normal file
BIN
test/bytecode_2.7/04_while1_while1.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.7/05_try_else.pyc-notyet
Normal file
BIN
test/bytecode_2.7/05_try_else.pyc-notyet
Normal file
Binary file not shown.
BIN
test/bytecode_2.7_run/01_ifelse_listcomp.pyc
Normal file
BIN
test/bytecode_2.7_run/01_ifelse_listcomp.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.7_run/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_2.7_run/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.7_run/05_dict_comp.pyc
Normal file
BIN
test/bytecode_2.7_run/05_dict_comp.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.0/01_comprehension.pyc
Normal file
BIN
test/bytecode_3.0/01_comprehension.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_3.0/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0/02_try_except_except.pyc
Normal file
BIN
test/bytecode_3.0/02_try_except_except.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0/03_if_try_raise.pyc
Normal file
BIN
test/bytecode_3.0/03_if_try_raise.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0/03_pop_top.pyc
Normal file
BIN
test/bytecode_3.0/03_pop_top.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0/05_abc_test.pyc
Normal file
BIN
test/bytecode_3.0/05_abc_test.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0_run/00_assign.pyc
Normal file
BIN
test/bytecode_3.0_run/00_assign.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0_run/00_chained-compare.pyc
Normal file
BIN
test/bytecode_3.0_run/00_chained-compare.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0_run/06_listcomp.pyc
Normal file
BIN
test/bytecode_3.0_run/06_listcomp.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.1_run/05_dict_comp.pyc
Normal file
BIN
test/bytecode_3.1_run/05_dict_comp.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.4_run/00_assign.pyc
Normal file
BIN
test/bytecode_3.4_run/00_assign.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.5_run/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_3.5_run/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.6/02_tryfinally_return.pyc
Normal file
BIN
test/bytecode_3.6/02_tryfinally_return.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.6/04_while1_while1.pyc
Normal file
BIN
test/bytecode_3.6/04_while1_while1.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.6_run/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_3.6_run/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_3.7/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/02_kwargs.pyc
Normal file
BIN
test/bytecode_3.7/02_kwargs.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/03_async_await.pyc
Normal file
BIN
test/bytecode_3.7/03_async_await.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/03_double_star_unpack.pyc
Normal file
BIN
test/bytecode_3.7/03_double_star_unpack.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/03_if_elif.pyc
Normal file
BIN
test/bytecode_3.7/03_if_elif.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/03_weird26.pyc
Normal file
BIN
test/bytecode_3.7/03_weird26.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/03_while-if-break.pyc
Normal file
BIN
test/bytecode_3.7/03_while-if-break.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/04_class_kwargs.pyc
Normal file
BIN
test/bytecode_3.7/04_class_kwargs.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/04_importlist.pyc
Normal file
BIN
test/bytecode_3.7/04_importlist.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/04_raise.pyc
Normal file
BIN
test/bytecode_3.7/04_raise.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/04_try_finally.pyc
Normal file
BIN
test/bytecode_3.7/04_try_finally.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/04_withas.pyc
Normal file
BIN
test/bytecode_3.7/04_withas.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/05_36lambda.pyc
Normal file
BIN
test/bytecode_3.7/05_36lambda.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/05_call_function_kw2.pyc
Normal file
BIN
test/bytecode_3.7/05_call_function_kw2.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7_run/01_fstring.pyc
Normal file
BIN
test/bytecode_3.7_run/01_fstring.pyc
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user