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
445f1b35
Kaydet (Commit)
445f1b35
authored
Tem 10, 2018
tarafından
Dong-hee Na
Kaydeden (comit)
INADA Naoki
Tem 10, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-33967: Fix singledispatch raised IndexError when no args (GH-8184)
üst
7762e4d3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
functools.py
Lib/functools.py
+5
-0
test_functools.py
Lib/test/test_functools.py
+7
-0
2018-07-08-18-49-41.bpo-33967.lhaAez.rst
...S.d/next/Library/2018-07-08-18-49-41.bpo-33967.lhaAez.rst
+2
-0
No files found.
Lib/functools.py
Dosyayı görüntüle @
445f1b35
...
...
@@ -817,8 +817,13 @@ def singledispatch(func):
return
func
def
wrapper
(
*
args
,
**
kw
):
if
not
args
:
raise
TypeError
(
f
'{funcname} requires at least '
'1 positional argument'
)
return
dispatch
(
args
[
0
]
.
__class__
)(
*
args
,
**
kw
)
funcname
=
getattr
(
func
,
'__name__'
,
'singledispatch function'
)
registry
[
object
]
=
func
wrapper
.
register
=
register
wrapper
.
dispatch
=
dispatch
...
...
Lib/test/test_functools.py
Dosyayı görüntüle @
445f1b35
...
...
@@ -2305,6 +2305,13 @@ class TestSingleDispatch(unittest.TestCase):
))
self
.
assertTrue
(
str
(
exc
.
exception
)
.
endswith
(
msg_suffix
))
def
test_invalid_positional_argument
(
self
):
@functools.singledispatch
def
f
(
*
args
):
pass
msg
=
'f requires at least 1 positional argument'
with
self
.
assertRaisesRegexp
(
TypeError
,
msg
):
f
()
if
__name__
==
'__main__'
:
unittest
.
main
()
Misc/NEWS.d/next/Library/2018-07-08-18-49-41.bpo-33967.lhaAez.rst
0 → 100644
Dosyayı görüntüle @
445f1b35
functools.singledispatch now raises TypeError instead of IndexError when no
positional arguments are passed.
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