Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a312c3ad
Kaydet (Commit)
a312c3ad
authored
Haz 06, 2002
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove uses of string module and stat.ST_MODE
üst
ec7cf138
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
11 deletions
+7
-11
pyassem.py
Lib/compiler/pyassem.py
+3
-4
pycodegen.py
Lib/compiler/pycodegen.py
+3
-5
transformer.py
Lib/compiler/transformer.py
+1
-2
No files found.
Lib/compiler/pyassem.py
Dosyayı görüntüle @
a312c3ad
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
import
dis
import
dis
import
new
import
new
import
string
import
sys
import
sys
import
types
import
types
...
@@ -246,7 +245,7 @@ class Block:
...
@@ -246,7 +245,7 @@ class Block:
def
__str__
(
self
):
def
__str__
(
self
):
insts
=
map
(
str
,
self
.
insts
)
insts
=
map
(
str
,
self
.
insts
)
return
"<block
%
s
%
d:
\n
%
s>"
%
(
self
.
label
,
self
.
bid
,
return
"<block
%
s
%
d:
\n
%
s>"
%
(
self
.
label
,
self
.
bid
,
string
.
join
(
insts
,
'
\n
'
))
'
\n
'
.
join
(
insts
))
def
emit
(
self
,
inst
):
def
emit
(
self
,
inst
):
op
=
inst
[
0
]
op
=
inst
[
0
]
...
@@ -713,10 +712,10 @@ class LineAddrTable:
...
@@ -713,10 +712,10 @@ class LineAddrTable:
self
.
lastoff
=
self
.
codeOffset
self
.
lastoff
=
self
.
codeOffset
def
getCode
(
self
):
def
getCode
(
self
):
return
string
.
join
(
self
.
code
,
''
)
return
''
.
join
(
self
.
code
)
def
getTable
(
self
):
def
getTable
(
self
):
return
string
.
join
(
map
(
chr
,
self
.
lnotab
),
''
)
return
''
.
join
(
map
(
chr
,
self
.
lnotab
)
)
class
StackDepthTracker
:
class
StackDepthTracker
:
# XXX 1. need to keep track of stack depth on jumps
# XXX 1. need to keep track of stack depth on jumps
...
...
Lib/compiler/pycodegen.py
Dosyayı görüntüle @
a312c3ad
import
imp
import
imp
import
os
import
os
import
marshal
import
marshal
import
stat
import
string
import
struct
import
struct
import
sys
import
sys
import
types
import
types
...
@@ -135,7 +133,7 @@ class Module(AbstractCompileMode):
...
@@ -135,7 +133,7 @@ class Module(AbstractCompileMode):
# calling the interface that would also generate a 1-byte code
# calling the interface that would also generate a 1-byte code
# to indicate the type of the value. simplest way to get the
# to indicate the type of the value. simplest way to get the
# same effect is to call marshal and then skip the code.
# 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
)
mtime
=
struct
.
pack
(
'i'
,
mtime
)
return
self
.
MAGIC
+
mtime
return
self
.
MAGIC
+
mtime
...
@@ -764,7 +762,7 @@ class CodeGenerator:
...
@@ -764,7 +762,7 @@ class CodeGenerator:
if
VERSION
>
1
:
if
VERSION
>
1
:
self
.
emit
(
'LOAD_CONST'
,
None
)
self
.
emit
(
'LOAD_CONST'
,
None
)
self
.
emit
(
'IMPORT_NAME'
,
name
)
self
.
emit
(
'IMPORT_NAME'
,
name
)
mod
=
string
.
split
(
name
,
"."
)[
0
]
mod
=
name
.
split
(
"."
)[
0
]
self
.
storeName
(
alias
or
mod
)
self
.
storeName
(
alias
or
mod
)
def
visitFrom
(
self
,
node
):
def
visitFrom
(
self
,
node
):
...
@@ -790,7 +788,7 @@ class CodeGenerator:
...
@@ -790,7 +788,7 @@ class CodeGenerator:
self
.
emit
(
'POP_TOP'
)
self
.
emit
(
'POP_TOP'
)
def
_resolveDots
(
self
,
name
):
def
_resolveDots
(
self
,
name
):
elts
=
string
.
split
(
name
,
"."
)
elts
=
name
.
split
(
"."
)
if
len
(
elts
)
==
1
:
if
len
(
elts
)
==
1
:
return
return
for
elt
in
elts
[
1
:]:
for
elt
in
elts
[
1
:]:
...
...
Lib/compiler/transformer.py
Dosyayı görüntüle @
a312c3ad
...
@@ -28,7 +28,6 @@ import parser
...
@@ -28,7 +28,6 @@ import parser
# 1.5.2 for code branches executed in 1.5.2
# 1.5.2 for code branches executed in 1.5.2
import
symbol
import
symbol
import
token
import
token
import
string
import
sys
import
sys
error
=
'walker.error'
error
=
'walker.error'
...
@@ -111,7 +110,7 @@ class Transformer:
...
@@ -111,7 +110,7 @@ class Transformer:
def
parsesuite
(
self
,
text
):
def
parsesuite
(
self
,
text
):
"""Return a modified parse tree for the given suite text."""
"""Return a modified parse tree for the given suite text."""
# Hack for handling non-native line endings on non-DOS like OSs.
# 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
))
return
self
.
transform
(
parser
.
suite
(
text
))
def
parseexpr
(
self
,
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