Skip to content

Commit 51a840a

Browse files
committedFeb 6, 2019
transformer, ast, syntax: Remove deprecated modules.
These modules were concerned with converting Python parse tree into AST in Python versions 1.5.x - early 2.x. Since then, the "ast" module, with elaborated API, was promoted to the top-level module in Python stdlib. Previous changes in this repository were concerned with porting other modules (symbols, pycodegen, etc.) from those historical modules to the modern "ast" module. Thus, these modules are unused and removed to clean up the package and ease maintenance. Note that the topic of parsing Python source code into AST using pure-Python module(s) is definitely interesting, but better be pursued via separate project(s). This project has well-defined scope - compile a standard Python AST into bytecode and code objects.
1 parent 1145ff3 commit 51a840a

File tree

5 files changed

+2
-2972
lines changed

5 files changed

+2
-2972
lines changed
 

‎compiler/__init__.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
"""Package for parsing and compiling Python source code
1+
"""Package for compiling Python source code
22
33
There are several functions defined at the top level that are imported
44
from modules contained in the package.
55
6-
parse(buf, mode="exec") -> AST
7-
Converts a string containing Python source code to an abstract
8-
syntax tree (AST). The AST is defined in compiler.ast.
9-
10-
parseFile(path) -> AST
11-
The same as parse(open(path))
12-
136
walk(ast, visitor, verbose=None)
147
Does a pre-order walk over the ast using the visitor instance.
158
See compiler.visitor for details.
@@ -21,11 +14,5 @@
2114
Generates a .pyc file by compiling filename.
2215
"""
2316

24-
import warnings
25-
26-
warnings.warn("The compiler package is deprecated and removed in Python 3.x.",
27-
DeprecationWarning, stacklevel=2)
28-
29-
from compiler.transformer import parse, parseFile
3017
from compiler.visitor import walk
3118
from compiler.pycodegen import compile, compileFile

‎compiler/ast.py

Lines changed: 0 additions & 1420 deletions
This file was deleted.

‎compiler/pycodegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from io import StringIO
88

99
import ast
10-
from compiler import parse, walk, syntax
10+
from compiler import walk
1111
from compiler import pyassem, misc, future, symbols
1212
from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \
1313
SC_FREE, SC_CELL

‎compiler/syntax.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

‎compiler/transformer.py

Lines changed: 0 additions & 1490 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.