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
41eb7164
Kaydet (Commit)
41eb7164
authored
Eki 27, 2006
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[Bug #1576241] Let functools.wraps work with built-in functions
üst
d3aad019
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
functools.py
Lib/functools.py
+1
-1
test_functools.py
Lib/test/test_functools.py
+7
-0
No files found.
Lib/functools.py
Dosyayı görüntüle @
41eb7164
...
...
@@ -32,7 +32,7 @@ def update_wrapper(wrapper,
for
attr
in
assigned
:
setattr
(
wrapper
,
attr
,
getattr
(
wrapped
,
attr
))
for
attr
in
updated
:
getattr
(
wrapper
,
attr
)
.
update
(
getattr
(
wrapped
,
attr
))
getattr
(
wrapper
,
attr
)
.
update
(
getattr
(
wrapped
,
attr
,
{}
))
# Return the wrapper so this can be used as a decorator via partial()
return
wrapper
...
...
Lib/test/test_functools.py
Dosyayı görüntüle @
41eb7164
...
...
@@ -210,6 +210,13 @@ class TestUpdateWrapper(unittest.TestCase):
self
.
assertEqual
(
wrapper
.
attr
,
'This is a different test'
)
self
.
assertEqual
(
wrapper
.
dict_attr
,
f
.
dict_attr
)
def
test_builtin_update
(
self
):
# Test for bug #1576241
def
wrapper
():
pass
functools
.
update_wrapper
(
wrapper
,
max
)
self
.
assertEqual
(
wrapper
.
__name__
,
'max'
)
self
.
assert_
(
wrapper
.
__doc__
.
startswith
(
'max('
))
class
TestWraps
(
TestUpdateWrapper
):
...
...
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