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
e968bc73
Kaydet (Commit)
e968bc73
authored
Eki 24, 2017
tarafından
Thomas Kluyver
Kaydeden (comit)
Yury Selivanov
Eki 24, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30639: Lazily compute repr for error (#2132)
üst
8e482bea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
inspect.py
Lib/inspect.py
+3
-2
test_inspect.py
Lib/test/test_inspect.py
+8
-0
2017-10-24-12-24-56.bpo-30639.ptNM9a.rst
...S.d/next/Library/2017-10-24-12-24-56.bpo-30639.ptNM9a.rst
+2
-0
No files found.
Lib/inspect.py
Dosyayı görüntüle @
e968bc73
...
...
@@ -662,8 +662,9 @@ def getfile(object):
object
=
object
.
f_code
if
iscode
(
object
):
return
object
.
co_filename
raise
TypeError
(
'{!r} is not a module, class, method, '
'function, traceback, frame, or code object'
.
format
(
object
))
raise
TypeError
(
'module, class, method, function, traceback, frame, or '
'code object was expected, got {}'
.
format
(
type
(
object
)
.
__name__
))
def
getmodulename
(
path
):
"""Return the module name for a given file, or None."""
...
...
Lib/test/test_inspect.py
Dosyayı görüntüle @
e968bc73
...
...
@@ -463,6 +463,14 @@ class TestRetrievingSourceCode(GetSourceBase):
with
self
.
assertRaises
(
TypeError
):
inspect
.
getfile
(
C
)
def
test_getfile_broken_repr
(
self
):
class
ErrorRepr
:
def
__repr__
(
self
):
raise
Exception
(
'xyz'
)
er
=
ErrorRepr
()
with
self
.
assertRaises
(
TypeError
):
inspect
.
getfile
(
er
)
def
test_getmodule_recursion
(
self
):
from
types
import
ModuleType
name
=
'__inspect_dummy'
...
...
Misc/NEWS.d/next/Library/2017-10-24-12-24-56.bpo-30639.ptNM9a.rst
0 → 100644
Dosyayı görüntüle @
e968bc73
:func:`inspect.getfile` no longer computes the repr of unknown objects to
display in an error message, to protect against badly behaved custom reprs.
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