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
492f3fc2
Kaydet (Commit)
492f3fc2
authored
Tem 11, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allow set literals in literal_eval().
üst
e40ee509
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
ast.rst
Doc/library/ast.rst
+5
-2
ast.py
Lib/ast.py
+2
-0
NEWS
Misc/NEWS
+3
-1
No files found.
Doc/library/ast.rst
Dosyayı görüntüle @
492f3fc2
...
...
@@ -119,12 +119,15 @@ and classes for traversing abstract syntax trees:
Safely evaluate an expression node or a string containing a Python
expression. The string or node provided may only consist of the following
Python literal structures: strings, numbers, tuples, lists, dicts,
boolean
s,
and ``None``.
Python literal structures: strings, numbers, tuples, lists, dicts,
set
s,
booleans,
and ``None``.
This can be used for safely evaluating strings containing Python expressions
from untrusted sources without the need to parse the values oneself.
.. versionchanged:: 3.2
Now allows set literals.
.. function:: get_docstring(node, clean=True)
...
...
Lib/ast.py
Dosyayı görüntüle @
492f3fc2
...
...
@@ -58,6 +58,8 @@ def literal_eval(node_or_string):
return
tuple
(
map
(
_convert
,
node
.
elts
))
elif
isinstance
(
node
,
List
):
return
list
(
map
(
_convert
,
node
.
elts
))
elif
isinstance
(
node
,
Set
):
return
set
(
map
(
_convert
,
node
.
elts
))
elif
isinstance
(
node
,
Dict
):
return
dict
((
_convert
(
k
),
_convert
(
v
))
for
k
,
v
in
zip
(
node
.
keys
,
node
.
values
))
...
...
Misc/NEWS
Dosyayı görüntüle @
492f3fc2
...
...
@@ -470,7 +470,9 @@ C-API
Library
-------
- Issue #9164: Ensure that sysconfig handles duplicate -arch flags in CFLAGS
- ``ast.literal_eval()`` now allows set literals.
- Issue #9164: Ensure that sysconfig handles duplicate -arch flags in CFLAGS.
- Issue #7646: The fnmatch pattern cache no longer grows without bound.
...
...
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