You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Towards fixing a 3.8 try except-as bug
This commit is contained in:
@@ -2,17 +2,17 @@
|
|||||||
**Table of Contents**
|
**Table of Contents**
|
||||||
|
|
||||||
- [Get latest sources:](#get-latest-sources)
|
- [Get latest sources:](#get-latest-sources)
|
||||||
- [Change version in uncompyle6/version.py](#change-version-in-uncompyle6versionpy)
|
- [Change version in uncompyle6/version.py:](#change-version-in-uncompyle6versionpy)
|
||||||
- [Update ChangeLog:](#update-changelog)
|
- [Update ChangeLog:](#update-changelog)
|
||||||
- [Update NEWS from ChangeLog:](#update-news-from-changelog)
|
- [Update NEWS.md from ChangeLog:](#update-newsmd-from-changelog)
|
||||||
- [Make sure pyenv is running and check newer versions](#make-sure-pyenv-is-running-and-check-newer-versions)
|
- [Make sure pyenv is running and check newer versions](#make-sure-pyenv-is-running-and-check-newer-versions)
|
||||||
- [Switch to python-2.4, sync that up and build that first since it creates a tarball which we don't want.](#switch-to-python-24-sync-that-up-and-build-that-first-since-it-creates-a-tarball-which-we-dont-want)
|
- [Switch to python-2.4, sync that up and build that first since it creates a tarball which we don't want.](#switch-to-python-24-sync-that-up-and-build-that-first-since-it-creates-a-tarball-which-we-dont-want)
|
||||||
- [Update NEWS from master branch](#update-news-from-master-branch)
|
- [Check against older versions](#check-against-older-versions)
|
||||||
- [Check against all versions](#check-against-all-versions)
|
|
||||||
- [Make packages and tag](#make-packages-and-tag)
|
- [Make packages and tag](#make-packages-and-tag)
|
||||||
- [Upload single package and look at Rst Formating](#upload-single-package-and-look-at-rst-formating)
|
- [Check package on github](#check-package-on-github)
|
||||||
- [Upload rest of versions](#upload-rest-of-versions)
|
- [Release on Github](#release-on-github)
|
||||||
- [Push tags:](#push-tags)
|
- [Get onto PyPI](#get-onto-pypi)
|
||||||
|
- [Update tags:](#update-tags)
|
||||||
|
|
||||||
<!-- markdown-toc end -->
|
<!-- markdown-toc end -->
|
||||||
# Get latest sources:
|
# Get latest sources:
|
||||||
@@ -84,25 +84,12 @@ Todo: turn this into a script in `admin-tools`
|
|||||||
$ popd
|
$ popd
|
||||||
|
|
||||||
|
|
||||||
# Upload single package and look at Rst Formating
|
# Get onto PyPI
|
||||||
|
|
||||||
$ twine check dist/uncompyle6-${VERSION}*
|
|
||||||
|
|
||||||
# Upload rest of versions
|
|
||||||
|
|
||||||
$ twine upload dist/uncompyle6-${VERSION}*
|
$ twine upload dist/uncompyle6-${VERSION}*
|
||||||
|
|
||||||
|
|
||||||
# Push tags:
|
# Update tags:
|
||||||
|
|
||||||
$ git push --tags
|
$ git push --tags
|
||||||
|
$ git pull --tags
|
||||||
# Check on a VM
|
|
||||||
|
|
||||||
$ cd /virtual/vagrant/virtual/vagrant/ubuntu-zesty
|
|
||||||
$ vagrant up
|
|
||||||
$ vagrant ssh
|
|
||||||
$ pyenv local 3.5.2
|
|
||||||
$ pip install --upgrade uncompyle6
|
|
||||||
$ exit
|
|
||||||
$ vagrant halt
|
|
||||||
|
@@ -45,6 +45,7 @@ class Python38Parser(Python37Parser):
|
|||||||
stmt ::= try_elsestmtl38
|
stmt ::= try_elsestmtl38
|
||||||
stmt ::= try_except_ret38
|
stmt ::= try_except_ret38
|
||||||
stmt ::= try_except38
|
stmt ::= try_except38
|
||||||
|
stmt ::= try_except_as
|
||||||
stmt ::= whilestmt38
|
stmt ::= whilestmt38
|
||||||
stmt ::= whileTruestmt38
|
stmt ::= whileTruestmt38
|
||||||
stmt ::= call_stmt
|
stmt ::= call_stmt
|
||||||
@@ -133,6 +134,8 @@ class Python38Parser(Python37Parser):
|
|||||||
except_cond1 ::= DUP_TOP expr COMPARE_OP jmp_false
|
except_cond1 ::= DUP_TOP expr COMPARE_OP jmp_false
|
||||||
POP_TOP POP_TOP POP_TOP
|
POP_TOP POP_TOP POP_TOP
|
||||||
POP_EXCEPT
|
POP_EXCEPT
|
||||||
|
except_cond_as ::= DUP_TOP expr COMPARE_OP POP_JUMP_IF_FALSE
|
||||||
|
POP_TOP STORE_FAST POP_TOP
|
||||||
|
|
||||||
try_elsestmtl38 ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
try_elsestmtl38 ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
||||||
except_handler38 COME_FROM
|
except_handler38 COME_FROM
|
||||||
@@ -145,6 +148,10 @@ class Python38Parser(Python37Parser):
|
|||||||
# suite_stmts has a return
|
# suite_stmts has a return
|
||||||
try_except38 ::= SETUP_FINALLY POP_BLOCK suite_stmts
|
try_except38 ::= SETUP_FINALLY POP_BLOCK suite_stmts
|
||||||
except_handler38b
|
except_handler38b
|
||||||
|
try_except_as ::= SETUP_FINALLY POP_BLOCK suite_stmts
|
||||||
|
except_handler_as END_FINALLY COME_FROM
|
||||||
|
try_except_as ::= SETUP_FINALLY suite_stmts
|
||||||
|
except_handler_as END_FINALLY COME_FROM
|
||||||
|
|
||||||
try_except_ret38 ::= SETUP_FINALLY returns except_ret38a
|
try_except_ret38 ::= SETUP_FINALLY returns except_ret38a
|
||||||
try_except_ret38a ::= SETUP_FINALLY returns except_handler38c
|
try_except_ret38a ::= SETUP_FINALLY returns except_handler38c
|
||||||
@@ -165,6 +172,11 @@ class Python38Parser(Python37Parser):
|
|||||||
except_handler38a ::= COME_FROM_FINALLY POP_TOP POP_TOP POP_TOP
|
except_handler38a ::= COME_FROM_FINALLY POP_TOP POP_TOP POP_TOP
|
||||||
POP_EXCEPT POP_TOP stmts END_FINALLY
|
POP_EXCEPT POP_TOP stmts END_FINALLY
|
||||||
|
|
||||||
|
except_handler38c ::= COME_FROM_FINALLY except_cond1a except_stmts
|
||||||
|
POP_EXCEPT JUMP_FORWARD COME_FROM
|
||||||
|
except_handler_as ::= COME_FROM_FINALLY except_cond_as tryfinallystmt
|
||||||
|
POP_EXCEPT JUMP_FORWARD COME_FROM
|
||||||
|
|
||||||
tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
||||||
BEGIN_FINALLY COME_FROM_FINALLY suite_stmts_opt
|
BEGIN_FINALLY COME_FROM_FINALLY suite_stmts_opt
|
||||||
END_FINALLY
|
END_FINALLY
|
||||||
|
@@ -50,12 +50,24 @@ def customize_for_version38(self, version):
|
|||||||
"%|%c\n", 0
|
"%|%c\n", 0
|
||||||
),
|
),
|
||||||
|
|
||||||
|
"except_cond_as": (
|
||||||
|
"%|except %c as %c:\n",
|
||||||
|
(1, "expr"),
|
||||||
|
(-2, "STORE_FAST"),
|
||||||
|
),
|
||||||
|
|
||||||
'except_handler38': (
|
'except_handler38': (
|
||||||
'%c', (2, 'except_stmts') ),
|
'%c', (2, 'except_stmts') ),
|
||||||
|
|
||||||
'except_handler38a': (
|
'except_handler38a': (
|
||||||
'%c', (-2, 'stmts') ),
|
'%c', (-2, 'stmts') ),
|
||||||
|
|
||||||
|
"except_handler_as": (
|
||||||
|
"%c%+\n%+%c%-",
|
||||||
|
(1, "except_cond_as"),
|
||||||
|
(2, "tryfinallystmt"),
|
||||||
|
),
|
||||||
|
|
||||||
'except_ret38a': (
|
'except_ret38a': (
|
||||||
'return %c', (4, 'expr') ),
|
'return %c', (4, 'expr') ),
|
||||||
|
|
||||||
@@ -105,6 +117,13 @@ def customize_for_version38(self, version):
|
|||||||
'try_except38': (
|
'try_except38': (
|
||||||
'%|try:\n%+%c\n%-%|except:\n%|%-%c\n\n',
|
'%|try:\n%+%c\n%-%|except:\n%|%-%c\n\n',
|
||||||
(-2, 'suite_stmts_opt'), (-1, 'except_handler38a') ),
|
(-2, 'suite_stmts_opt'), (-1, 'except_handler38a') ),
|
||||||
|
|
||||||
|
"try_except_as": (
|
||||||
|
"%|try:\n%+%c%-\n%|%-%c\n\n",
|
||||||
|
(-4, "suite_stmts"), # Go from the end because of POP_BLOCK variation
|
||||||
|
(-3, "except_handler_as"),
|
||||||
|
),
|
||||||
|
|
||||||
"try_except_ret38": (
|
"try_except_ret38": (
|
||||||
"%|try:\n%+%c%-\n%|except:\n%+%|%c%-\n\n",
|
"%|try:\n%+%c%-\n%|except:\n%+%|%c%-\n\n",
|
||||||
(1, "returns"),
|
(1, "returns"),
|
||||||
|
Reference in New Issue
Block a user