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
b72406b8
Kaydet (Commit)
b72406b8
authored
Mar 19, 2013
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor to fix refleaks
üst
6fba3dbc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
asdl_c.py
Parser/asdl_c.py
+15
-5
Python-ast.c
Python/Python-ast.c
+0
-0
No files found.
Parser/asdl_c.py
Dosyayı görüntüle @
b72406b8
...
...
@@ -499,12 +499,10 @@ class Obj2ModVisitor(PickleVisitor):
def
visitField
(
self
,
field
,
name
,
sum
=
None
,
prod
=
None
,
depth
=
0
):
ctype
=
get_c_type
(
field
.
type
)
if
field
.
opt
:
add_check
=
" && _PyObject_GetAttrId(obj, &PyId_
%
s) != Py_None"
\
%
(
field
.
name
)
check
=
"exists_not_none(obj, &PyId_
%
s)"
%
(
field
.
name
,)
else
:
add_check
=
str
()
self
.
emit
(
"if (_PyObject_HasAttrId(obj, &PyId_
%
s)
%
s) {"
%
(
field
.
name
,
add_check
),
depth
,
reflow
=
False
)
check
=
"_PyObject_HasAttrId(obj, &PyId_
%
s)"
%
(
field
.
name
,)
self
.
emit
(
"if (
%
s) {"
%
(
check
,),
depth
,
reflow
=
False
)
self
.
emit
(
"int res;"
,
depth
+
1
)
if
field
.
seq
:
self
.
emit
(
"Py_ssize_t len;"
,
depth
+
1
)
...
...
@@ -931,6 +929,18 @@ static int add_ast_fields(void)
return 0;
}
static int exists_not_none(PyObject *obj, _Py_Identifier *id)
{
PyObject *attr = _PyObject_GetAttrId(obj, id);
if (!attr) {
PyErr_Clear();
return 0;
}
int isnone = attr == Py_None;
Py_DECREF(attr);
return !isnone;
}
"""
,
0
,
reflow
=
False
)
self
.
emit
(
"static int init_types(void)"
,
0
)
...
...
Python/Python-ast.c
Dosyayı görüntüle @
b72406b8
This diff is collapsed.
Click to expand it.
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