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
20e1199f
Kaydet (Commit)
20e1199f
authored
Mar 02, 2007
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix embarrassing typo and fix constantification of None
üst
117a05ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
test_peepholer.py
Lib/test/test_peepholer.py
+5
-0
peephole.c
Python/peephole.c
+10
-6
No files found.
Lib/test/test_peepholer.py
Dosyayı görüntüle @
20e1199f
...
...
@@ -49,6 +49,11 @@ class TestTranforms(unittest.TestCase):
self
.
assert_
(
elem
not
in
asm
)
for
elem
in
(
'LOAD_CONST'
,
'(None)'
):
self
.
assert_
(
elem
in
asm
)
def
f
():
'Adding a docstring made this test fail in Py2.5.0'
return
None
self
.
assert_
(
'LOAD_CONST'
in
disassemble
(
f
))
self
.
assert_
(
'LOAD_GLOBAL'
not
in
disassemble
(
f
))
def
test_while_one
(
self
):
# Skip over: LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP
...
...
Python/peephole.c
Dosyayı görüntüle @
20e1199f
/* Peehole optimizations for bytecode compiler. */
/* Pee
p
hole optimizations for bytecode compiler. */
#include "Python.h"
...
...
@@ -386,13 +386,17 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
if
(
name
==
NULL
||
strcmp
(
name
,
"None"
)
!=
0
)
continue
;
for
(
j
=
0
;
j
<
PyList_GET_SIZE
(
consts
)
;
j
++
)
{
if
(
PyList_GET_ITEM
(
consts
,
j
)
==
Py_None
)
{
codestr
[
i
]
=
LOAD_CONST
;
SETARG
(
codestr
,
i
,
j
);
cumlc
=
lastlc
+
1
;
if
(
PyList_GET_ITEM
(
consts
,
j
)
==
Py_None
)
break
;
}
}
if
(
j
==
PyList_GET_SIZE
(
consts
))
{
if
(
PyList_Append
(
consts
,
Py_None
)
==
-
1
)
goto
exitUnchanged
;
}
assert
(
PyList_GET_ITEM
(
consts
,
j
)
==
Py_None
);
codestr
[
i
]
=
LOAD_CONST
;
SETARG
(
codestr
,
i
,
j
);
cumlc
=
lastlc
+
1
;
break
;
/* Skip over LOAD_CONST trueconst
...
...
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