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
2876f5ad
Kaydet (Commit)
2876f5ad
authored
Agu 07, 2004
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF patch 836879.
Don't generate code for asserts in -O mode.
üst
4c989ddc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
+19
-21
pycodegen.py
Lib/compiler/pycodegen.py
+19
-21
No files found.
Lib/compiler/pycodegen.py
Dosyayı görüntüle @
2876f5ad
...
...
@@ -707,27 +707,25 @@ class CodeGenerator:
def
visitAssert
(
self
,
node
):
# XXX would be interesting to implement this via a
# transformation of the AST before this stage
end
=
self
.
newBlock
()
self
.
set_lineno
(
node
)
# XXX __debug__ and AssertionError appear to be special cases
# -- they are always loaded as globals even if there are local
# names. I guess this is a sort of renaming op.
self
.
emit
(
'LOAD_GLOBAL'
,
'__debug__'
)
self
.
emit
(
'JUMP_IF_FALSE'
,
end
)
self
.
nextBlock
()
self
.
emit
(
'POP_TOP'
)
self
.
visit
(
node
.
test
)
self
.
emit
(
'JUMP_IF_TRUE'
,
end
)
self
.
nextBlock
()
self
.
emit
(
'POP_TOP'
)
self
.
emit
(
'LOAD_GLOBAL'
,
'AssertionError'
)
if
node
.
fail
:
self
.
visit
(
node
.
fail
)
self
.
emit
(
'RAISE_VARARGS'
,
2
)
else
:
self
.
emit
(
'RAISE_VARARGS'
,
1
)
self
.
nextBlock
(
end
)
self
.
emit
(
'POP_TOP'
)
if
__debug__
:
end
=
self
.
newBlock
()
self
.
set_lineno
(
node
)
# XXX AssertionError appears to be special case -- it is always
# loaded as a global even if there is a local name. I guess this
# is a sort of renaming op.
self
.
nextBlock
()
self
.
visit
(
node
.
test
)
self
.
emit
(
'JUMP_IF_TRUE'
,
end
)
self
.
nextBlock
()
self
.
emit
(
'POP_TOP'
)
self
.
emit
(
'LOAD_GLOBAL'
,
'AssertionError'
)
if
node
.
fail
:
self
.
visit
(
node
.
fail
)
self
.
emit
(
'RAISE_VARARGS'
,
2
)
else
:
self
.
emit
(
'RAISE_VARARGS'
,
1
)
self
.
nextBlock
(
end
)
self
.
emit
(
'POP_TOP'
)
def
visitRaise
(
self
,
node
):
self
.
set_lineno
(
node
)
...
...
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