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
2f07a66d
Kaydet (Commit)
2f07a66d
authored
Tem 23, 2015
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #24688: ast.get_docstring() for 'async def' functions.
üst
943ddac1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
ast.py
Lib/ast.py
+1
-1
test_ast.py
Lib/test/test_ast.py
+3
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/ast.py
Dosyayı görüntüle @
2f07a66d
...
@@ -194,7 +194,7 @@ def get_docstring(node, clean=True):
...
@@ -194,7 +194,7 @@ def get_docstring(node, clean=True):
be found. If the node provided does not have docstrings a TypeError
be found. If the node provided does not have docstrings a TypeError
will be raised.
will be raised.
"""
"""
if
not
isinstance
(
node
,
(
FunctionDef
,
ClassDef
,
Module
)):
if
not
isinstance
(
node
,
(
AsyncFunctionDef
,
FunctionDef
,
ClassDef
,
Module
)):
raise
TypeError
(
"
%
r can't have docstrings"
%
node
.
__class__
.
__name__
)
raise
TypeError
(
"
%
r can't have docstrings"
%
node
.
__class__
.
__name__
)
if
node
.
body
and
isinstance
(
node
.
body
[
0
],
Expr
)
and
\
if
node
.
body
and
isinstance
(
node
.
body
[
0
],
Expr
)
and
\
isinstance
(
node
.
body
[
0
]
.
value
,
Str
):
isinstance
(
node
.
body
[
0
]
.
value
,
Str
):
...
...
Lib/test/test_ast.py
Dosyayı görüntüle @
2f07a66d
...
@@ -511,6 +511,9 @@ class ASTHelpers_Test(unittest.TestCase):
...
@@ -511,6 +511,9 @@ class ASTHelpers_Test(unittest.TestCase):
self
.
assertEqual
(
ast
.
get_docstring
(
node
.
body
[
0
]),
self
.
assertEqual
(
ast
.
get_docstring
(
node
.
body
[
0
]),
'line one
\n
line two'
)
'line one
\n
line two'
)
node
=
ast
.
parse
(
'async def foo():
\n
"""spam
\n
ham"""'
)
self
.
assertEqual
(
ast
.
get_docstring
(
node
.
body
[
0
]),
'spam
\n
ham'
)
def
test_literal_eval
(
self
):
def
test_literal_eval
(
self
):
self
.
assertEqual
(
ast
.
literal_eval
(
'[1, 2, 3]'
),
[
1
,
2
,
3
])
self
.
assertEqual
(
ast
.
literal_eval
(
'[1, 2, 3]'
),
[
1
,
2
,
3
])
self
.
assertEqual
(
ast
.
literal_eval
(
'{"foo": 42}'
),
{
"foo"
:
42
})
self
.
assertEqual
(
ast
.
literal_eval
(
'{"foo": 42}'
),
{
"foo"
:
42
})
...
...
Misc/NEWS
Dosyayı görüntüle @
2f07a66d
...
@@ -53,6 +53,8 @@ Library
...
@@ -53,6 +53,8 @@ Library
-
Issue
#
24669
:
Fix
inspect
.
getsource
()
for
'async def'
functions
.
-
Issue
#
24669
:
Fix
inspect
.
getsource
()
for
'async def'
functions
.
Patch
by
Kai
Groner
.
Patch
by
Kai
Groner
.
-
Issue
#
24688
:
ast
.
get_docstring
()
for
'async def'
functions
.
Build
Build
-----
-----
...
...
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