Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a312c3ad
Commit
a312c3ad
authored
Jun 06, 2002
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove uses of string module and stat.ST_MODE
parent
ec7cf138
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
11 deletions
+7
-11
Lib/compiler/pyassem.py
Lib/compiler/pyassem.py
+3
-4
Lib/compiler/pycodegen.py
Lib/compiler/pycodegen.py
+3
-5
Lib/compiler/transformer.py
Lib/compiler/transformer.py
+1
-2
No files found.
Lib/compiler/pyassem.py
View file @
a312c3ad
...
...
@@ -2,7 +2,6 @@
import
dis
import
new
import
string
import
sys
import
types
...
...
@@ -246,7 +245,7 @@ class Block:
def
__str__
(
self
):
insts
=
map
(
str
,
self
.
insts
)
return
"<block %s %d:
\
n
%s>"
%
(
self
.
label
,
self
.
bid
,
string
.
join
(
insts
,
'
\
n
'
))
'
\
n
'
.
join
(
insts
))
def
emit
(
self
,
inst
):
op
=
inst
[
0
]
...
...
@@ -713,10 +712,10 @@ class LineAddrTable:
self
.
lastoff
=
self
.
codeOffset
def
getCode
(
self
):
return
string
.
join
(
self
.
code
,
''
)
return
''
.
join
(
self
.
code
)
def
getTable
(
self
):
return
string
.
join
(
map
(
chr
,
self
.
lnotab
),
''
)
return
''
.
join
(
map
(
chr
,
self
.
lnotab
)
)
class
StackDepthTracker
:
# XXX 1. need to keep track of stack depth on jumps
...
...
Lib/compiler/pycodegen.py
View file @
a312c3ad
import
imp
import
os
import
marshal
import
stat
import
string
import
struct
import
sys
import
types
...
...
@@ -135,7 +133,7 @@ class Module(AbstractCompileMode):
# calling the interface that would also generate a 1-byte code
# to indicate the type of the value. simplest way to get the
# same effect is to call marshal and then skip the code.
mtime
=
os
.
stat
(
self
.
filename
)[
stat
.
ST_MTIME
]
mtime
=
os
.
path
.
getmtime
(
self
.
filename
)
mtime
=
struct
.
pack
(
'i'
,
mtime
)
return
self
.
MAGIC
+
mtime
...
...
@@ -764,7 +762,7 @@ class CodeGenerator:
if
VERSION
>
1
:
self
.
emit
(
'LOAD_CONST'
,
None
)
self
.
emit
(
'IMPORT_NAME'
,
name
)
mod
=
string
.
split
(
name
,
"."
)[
0
]
mod
=
name
.
split
(
"."
)[
0
]
self
.
storeName
(
alias
or
mod
)
def
visitFrom
(
self
,
node
):
...
...
@@ -790,7 +788,7 @@ class CodeGenerator:
self
.
emit
(
'POP_TOP'
)
def
_resolveDots
(
self
,
name
):
elts
=
string
.
split
(
name
,
"."
)
elts
=
name
.
split
(
"."
)
if
len
(
elts
)
==
1
:
return
for
elt
in
elts
[
1
:]:
...
...
Lib/compiler/transformer.py
View file @
a312c3ad
...
...
@@ -28,7 +28,6 @@ import parser
# 1.5.2 for code branches executed in 1.5.2
import
symbol
import
token
import
string
import
sys
error
=
'walker.error'
...
...
@@ -111,7 +110,7 @@ class Transformer:
def
parsesuite
(
self
,
text
):
"""Return a modified parse tree for the given suite text."""
# Hack for handling non-native line endings on non-DOS like OSs.
text
=
string
.
replace
(
text
,
'
\
x0d
'
,
''
)
text
=
text
.
replace
(
'
\
x0d
'
,
''
)
return
self
.
transform
(
parser
.
suite
(
text
))
def
parseexpr
(
self
,
text
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment