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
b8903fbf
Kaydet (Commit)
b8903fbf
authored
Eki 17, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Test utility to look for bad stacksize calculations.
üst
138d90eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
stacktest.py
Tools/compiler/stacktest.py
+43
-0
No files found.
Tools/compiler/stacktest.py
0 → 100644
Dosyayı görüntüle @
b8903fbf
import
compiler
import
dis
import
types
def
extract_code_objects
(
co
):
l
=
[
co
]
for
const
in
co
.
co_consts
:
if
type
(
const
)
==
types
.
CodeType
:
l
.
append
(
const
)
return
l
def
compare
(
a
,
b
):
if
not
(
a
.
co_name
==
"?"
or
a
.
co_name
.
startswith
(
'<lambda'
)):
assert
a
.
co_name
==
b
.
co_name
,
(
a
,
b
)
if
a
.
co_stacksize
!=
b
.
co_stacksize
:
print
"stack mismatch
%
s:
%
d vs.
%
d"
%
(
a
.
co_name
,
a
.
co_stacksize
,
b
.
co_stacksize
)
if
a
.
co_stacksize
>
b
.
co_stacksize
:
print
"good code"
dis
.
dis
(
a
)
print
"bad code"
dis
.
dis
(
b
)
assert
0
def
main
(
files
):
for
file
in
files
:
print
file
buf
=
open
(
file
)
.
read
()
try
:
co1
=
compile
(
buf
,
file
,
"exec"
)
except
SyntaxError
:
print
"skipped"
continue
co2
=
compiler
.
compile
(
buf
,
file
,
"exec"
)
co1l
=
extract_code_objects
(
co1
)
co2l
=
extract_code_objects
(
co2
)
for
a
,
b
in
zip
(
co1l
,
co2l
):
compare
(
a
,
b
)
if
__name__
==
"__main__"
:
import
sys
main
(
sys
.
argv
[
1
:])
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