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
58641def
Kaydet (Commit)
58641def
authored
Haz 12, 2009
tarafından
R. David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6195: fix doctest to no longer try to read 'source' data from
binary files.
üst
554290d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
12 deletions
+34
-12
doctest.py
Lib/doctest.py
+20
-12
test_doctest.py
Lib/test/test_doctest.py
+11
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/doctest.py
Dosyayı görüntüle @
58641def
...
@@ -812,20 +812,28 @@ class DocTestFinder:
...
@@ -812,20 +812,28 @@ class DocTestFinder:
# DocTestFinder._find_lineno to find the line number for a
# DocTestFinder._find_lineno to find the line number for a
# given object's docstring.
# given object's docstring.
try
:
try
:
file
=
inspect
.
getsourcefile
(
obj
)
or
inspect
.
getfile
(
obj
)
file
=
inspect
.
getsourcefile
(
obj
)
if
module
is
not
None
:
# Supply the module globals in case the module was
# originally loaded via a PEP 302 loader and
# file is not a valid filesystem path
source_lines
=
linecache
.
getlines
(
file
,
module
.
__dict__
)
else
:
# No access to a loader, so assume it's a normal
# filesystem path
source_lines
=
linecache
.
getlines
(
file
)
if
not
source_lines
:
source_lines
=
None
except
TypeError
:
except
TypeError
:
source_lines
=
None
source_lines
=
None
else
:
if
not
file
:
# Check to see if it's one of our special internal "files"
# (see __patched_linecache_getlines).
file
=
inspect
.
getfile
(
obj
)
if
not
file
[
0
]
+
file
[
-
2
:]
==
'<]>'
:
file
=
None
if
file
is
None
:
source_lines
=
None
else
:
if
module
is
not
None
:
# Supply the module globals in case the module was
# originally loaded via a PEP 302 loader and
# file is not a valid filesystem path
source_lines
=
linecache
.
getlines
(
file
,
module
.
__dict__
)
else
:
# No access to a loader, so assume it's a normal
# filesystem path
source_lines
=
linecache
.
getlines
(
file
)
if
not
source_lines
:
source_lines
=
None
# Initialize globals, and merge in extraglobs.
# Initialize globals, and merge in extraglobs.
if
globs
is
None
:
if
globs
is
None
:
...
...
Lib/test/test_doctest.py
Dosyayı görüntüle @
58641def
...
@@ -2288,6 +2288,17 @@ using the optional keyword argument `encoding`:
...
@@ -2288,6 +2288,17 @@ using the optional keyword argument `encoding`:
>>> doctest.master = None # Reset master.
>>> doctest.master = None # Reset master.
"""
"""
def
test_testmod
():
r"""
Tests for the testmod function. More might be useful, but for now we're just
testing the case raised by Issue 6195, where trying to doctest a C module would
fail with a UnicodeDecodeError because doctest tried to read the "source" lines
out of the binary module.
>>> import unicodedata
>>> doctest.testmod(unicodedata)
TestResults(failed=0, attempted=0)
"""
######################################################################
######################################################################
## Main
## Main
######################################################################
######################################################################
...
...
Misc/NEWS
Dosyayı görüntüle @
58641def
...
@@ -24,6 +24,9 @@ Core and Builtins
...
@@ -24,6 +24,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #6195: fixed doctest to no longer try to read 'source' data from
binary files.
- Issue #5262: Fixed bug in next rollover time computation in
- Issue #5262: Fixed bug in next rollover time computation in
TimedRotatingFileHandler.
TimedRotatingFileHandler.
...
...
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