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
42407abe
Kaydet (Commit)
42407abe
authored
Haz 23, 2014
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
inspect: Validate that __signature__ is None or an instance of Signature.
Closes #21801.
üst
289cae4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
inspect.py
Lib/inspect.py
+4
-0
test_inspect.py
Lib/test/test_inspect.py
+7
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/inspect.py
Dosyayı görüntüle @
42407abe
...
@@ -1939,6 +1939,10 @@ def _signature_from_callable(obj, *,
...
@@ -1939,6 +1939,10 @@ def _signature_from_callable(obj, *,
pass
pass
else
:
else
:
if
sig
is
not
None
:
if
sig
is
not
None
:
if
not
isinstance
(
sig
,
Signature
):
raise
TypeError
(
'unexpected object {!r} in __signature__ '
'attribute'
.
format
(
sig
))
return
sig
return
sig
try
:
try
:
...
...
Lib/test/test_inspect.py
Dosyayı görüntüle @
42407abe
...
@@ -3136,6 +3136,13 @@ class TestMain(unittest.TestCase):
...
@@ -3136,6 +3136,13 @@ class TestMain(unittest.TestCase):
self
.
assertEqual
(
lines
[:
-
1
],
inspect
.
getsource
(
module
)
.
splitlines
())
self
.
assertEqual
(
lines
[:
-
1
],
inspect
.
getsource
(
module
)
.
splitlines
())
self
.
assertEqual
(
err
,
b
''
)
self
.
assertEqual
(
err
,
b
''
)
def
test_custom_getattr
(
self
):
def
foo
():
pass
foo
.
__signature__
=
42
with
self
.
assertRaises
(
TypeError
):
inspect
.
signature
(
foo
)
@unittest.skipIf
(
ThreadPoolExecutor
is
None
,
@unittest.skipIf
(
ThreadPoolExecutor
is
None
,
'threads required to test __qualname__ for source files'
)
'threads required to test __qualname__ for source files'
)
def
test_qualname_source
(
self
):
def
test_qualname_source
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
42407abe
...
@@ -498,6 +498,9 @@ Library
...
@@ -498,6 +498,9 @@ Library
-
Issue
#
11571
:
Ensure
that
the
turtle
window
becomes
the
topmost
window
-
Issue
#
11571
:
Ensure
that
the
turtle
window
becomes
the
topmost
window
when
launched
on
OS
X
.
when
launched
on
OS
X
.
-
Issue
#
21801
:
Validate
that
__signature__
is
None
or
an
instance
of
Signature
.
Extension
Modules
Extension
Modules
-----------------
-----------------
...
...
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