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
8a4eb298
Kaydet (Commit)
8a4eb298
authored
Agu 27, 2007
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix refleaks in test_unicode and test_string related to the new format code.
Stop polluting namespace.
üst
2bad9702
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
38 deletions
+27
-38
unicodeobject.h
Include/unicodeobject.h
+2
-4
string_format.h
Objects/stringlib/string_format.h
+1
-0
unicodeobject.c
Objects/unicodeobject.c
+20
-30
sysmodule.c
Python/sysmodule.c
+4
-4
No files found.
Include/unicodeobject.h
Dosyayı görüntüle @
8a4eb298
...
...
@@ -1437,10 +1437,8 @@ PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
const
Py_UNICODE
*
s
,
Py_UNICODE
c
);
PyObject
*
_unicodeformatter_iterator
(
PyObject
*
str
);
PyObject
*
_unicodeformatter_field_name_split
(
PyObject
*
field_name
);
PyObject
*
_PyUnicode_FormatterIterator
(
PyObject
*
str
);
PyObject
*
_PyUnicode_FormatterFieldNameSplit
(
PyObject
*
field_name
);
#ifdef __cplusplus
}
...
...
Objects/stringlib/string_format.h
Dosyayı görüntüle @
8a4eb298
...
...
@@ -416,6 +416,7 @@ get_field_object(SubString *input, PyObject *args, PyObject *kwargs)
Py_DECREF
(
key
);
goto
error
;
}
Py_DECREF
(
key
);
Py_INCREF
(
obj
);
}
else
{
/* look up in args */
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
8a4eb298
...
...
@@ -9206,11 +9206,11 @@ formatteriter_next(formatteriterobject *it)
PyObject
*
field_name_str
=
NULL
;
PyObject
*
format_spec_str
=
NULL
;
PyObject
*
conversion_str
=
NULL
;
PyObject
*
result
=
NULL
;
PyObject
*
tuple
=
NULL
;
is_markup_bool
=
PyBool_FromLong
(
is_markup
);
if
(
!
is_markup_bool
)
goto
error
;
return
NULL
;
if
(
is_markup
)
{
/* field_name, format_spec, and conversion are
...
...
@@ -9251,22 +9251,16 @@ formatteriter_next(formatteriterobject *it)
Py_INCREF
(
format_spec_str
);
Py_INCREF
(
conversion_str
);
}
/* return a tuple of values */
result
=
PyTuple_Pack
(
5
,
is_markup_bool
,
literal_str
,
field_name_str
,
format_spec_str
,
conversion_str
);
if
(
result
==
NULL
)
goto
error
;
return
result
;
tuple
=
PyTuple_Pack
(
5
,
is_markup_bool
,
literal_str
,
field_name_str
,
format_spec_str
,
conversion_str
);
error:
Py_XDECREF
(
is_markup_bool
);
Py_XDECREF
(
literal_str
);
Py_XDECREF
(
field_name_str
);
Py_XDECREF
(
format_spec_str
);
Py_XDECREF
(
conversion_str
);
Py_XDECREF
(
result
);
return
NULL
;
return
tuple
;
}
}
...
...
@@ -9308,10 +9302,11 @@ PyTypeObject PyFormatterIter_Type = {
};
PyObject
*
_
unicodeformatter_i
terator
(
PyObject
*
str
)
_
PyUnicode_FormatterI
terator
(
PyObject
*
str
)
{
formatteriterobject
*
it
;
assert
(
PyUnicode_Check
(
str
));
it
=
PyObject_New
(
formatteriterobject
,
&
PyFormatterIter_Type
);
if
(
it
==
NULL
)
return
NULL
;
...
...
@@ -9440,21 +9435,24 @@ static PyTypeObject PyFieldNameIter_Type = {
0
};
PyObject
*
_
unicodeformatter_field_name_s
plit
(
PyObject
*
field_name
)
_
PyUnicode_FormatterFieldNameS
plit
(
PyObject
*
field_name
)
{
SubString
first
;
Py_ssize_t
first_idx
;
fieldnameiterobject
*
it
;
PyObject
*
first_obj
=
NULL
;
PyObject
*
it_obj
=
NULL
;
PyObject
*
result
;
PyObject
*
result
=
NULL
;
assert
(
PyUnicode_Check
(
field_name
));
it
=
PyObject_New
(
fieldnameiterobject
,
&
PyFieldNameIter_Type
);
if
(
it
==
NULL
)
goto
error
;
it
->
str
=
NULL
;
it_obj
=
(
PyObject
*
)
it
;
return
NULL
;
/* take ownership, give the object to the iterator. this is
just to keep the field_name alive */
Py_INCREF
(
field_name
);
it
->
str
=
field_name
;
if
(
!
field_name_split
(
STRINGLIB_STR
(
field_name
),
STRINGLIB_LEN
(
field_name
),
...
...
@@ -9470,21 +9468,13 @@ _unicodeformatter_field_name_split(PyObject *field_name)
if
(
first_obj
==
NULL
)
goto
error
;
/* take ownership, give the object to the iterator. this is
just to keep the field_name alive */
Py_INCREF
(
field_name
);
it
->
str
=
field_name
;
/* return a tuple of values */
result
=
PyTuple_Pack
(
2
,
first_obj
,
it_obj
);
if
(
result
==
NULL
)
goto
error
;
result
=
PyTuple_Pack
(
2
,
first_obj
,
it
);
return
result
;
error:
Py_XDECREF
(
it
_obj
);
Py_XDECREF
(
it
);
Py_XDECREF
(
first_obj
);
return
NULL
;
return
result
;
}
/********************* Unicode Iterator **************************/
...
...
Python/sysmodule.c
Dosyayı görüntüle @
8a4eb298
...
...
@@ -663,7 +663,7 @@ sys_current_frames(PyObject *self, PyObject *noargs)
/* sys_formatter_iterator is used to implement
string.Formatter.vformat. it parses a string and returns tuples
describing the parsed elements. see unicodeobject.c's
_
unicodeformatter_i
terator for details */
_
PyUnicode_FormatterI
terator for details */
static
PyObject
*
sys_formatter_iterator
(
PyObject
*
self
,
PyObject
*
args
)
{
...
...
@@ -680,14 +680,14 @@ sys_formatter_iterator(PyObject *self, PyObject *args)
return
NULL
;
}
return
_
unicodeformatter_i
terator
(
str
);
return
_
PyUnicode_FormatterI
terator
(
str
);
}
/* sys_formatter_field_name_split is used to implement
string.Formatter.vformat. it takes an PEP 3101 "field name", and
returns a tuple of (first, rest): "first", the part before the
first '.' or '['; and "rest", an iterator for the rest of the field
name. see unicodeobjects' _
unicode_formatter_field_name_s
plit for
name. see unicodeobjects' _
PyUnicode_FormatterFieldNameS
plit for
details */
static
PyObject
*
sys_formatter_field_name_split
(
PyObject
*
self
,
PyObject
*
args
)
...
...
@@ -704,7 +704,7 @@ sys_formatter_field_name_split(PyObject *self, PyObject *args)
return
NULL
;
}
return
_
unicodeformatter_field_name_s
plit
(
field_name
);
return
_
PyUnicode_FormatterFieldNameS
plit
(
field_name
);
}
...
...
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