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
e6c910e9
Kaydet (Commit)
e6c910e9
authored
Haz 30, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12451: pydoc.synopsis() now reads the encoding cookie if available, to
read the Python script from the right encoding.
üst
dc9b1ea0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
pydoc.py
Lib/pydoc.py
+5
-4
test_pydoc.py
Lib/test/test_pydoc.py
+12
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
e6c910e9
...
@@ -57,16 +57,17 @@ Richard Chamberlain, for the first implementation of textdoc.
...
@@ -57,16 +57,17 @@ Richard Chamberlain, for the first implementation of textdoc.
# the current directory is changed with os.chdir(), an incorrect
# the current directory is changed with os.chdir(), an incorrect
# path will be displayed.
# path will be displayed.
import
os
import
sys
import
builtins
import
builtins
import
imp
import
imp
import
io
import
inspect
import
inspect
import
io
import
os
import
pkgutil
import
pkgutil
import
platform
import
platform
import
re
import
re
import
sys
import
time
import
time
import
tokenize
import
warnings
import
warnings
from
collections
import
deque
from
collections
import
deque
from
reprlib
import
Repr
from
reprlib
import
Repr
...
@@ -227,7 +228,7 @@ def synopsis(filename, cache={}):
...
@@ -227,7 +228,7 @@ def synopsis(filename, cache={}):
if
lastupdate
<
mtime
:
if
lastupdate
<
mtime
:
info
=
inspect
.
getmoduleinfo
(
filename
)
info
=
inspect
.
getmoduleinfo
(
filename
)
try
:
try
:
file
=
open
(
filename
)
file
=
tokenize
.
open
(
filename
)
except
IOError
:
except
IOError
:
# module can't be opened, so skip it
# module can't be opened, so skip it
return
None
return
None
...
...
Lib/test/test_pydoc.py
Dosyayı görüntüle @
e6c910e9
...
@@ -16,7 +16,7 @@ from io import StringIO
...
@@ -16,7 +16,7 @@ from io import StringIO
from
collections
import
namedtuple
from
collections
import
namedtuple
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
test.support
import
TESTFN
,
forget
,
rmtree
,
EnvironmentVarGuard
,
\
from
test.support
import
TESTFN
,
forget
,
rmtree
,
EnvironmentVarGuard
,
\
reap_children
,
captured_output
,
captured_stdout
reap_children
,
captured_output
,
captured_stdout
,
unlink
from
test
import
pydoc_mod
from
test
import
pydoc_mod
...
@@ -389,6 +389,17 @@ class PydocDocTest(unittest.TestCase):
...
@@ -389,6 +389,17 @@ class PydocDocTest(unittest.TestCase):
self
.
assertIn
(
'_replace'
,
helptext
)
self
.
assertIn
(
'_replace'
,
helptext
)
self
.
assertIn
(
'_asdict'
,
helptext
)
self
.
assertIn
(
'_asdict'
,
helptext
)
def
test_synopsis
(
self
):
self
.
addCleanup
(
unlink
,
TESTFN
)
for
encoding
in
(
'ISO-8859-1'
,
'UTF-8'
):
with
open
(
TESTFN
,
'w'
,
encoding
=
encoding
)
as
script
:
if
encoding
!=
'UTF-8'
:
print
(
'#coding: {}'
.
format
(
encoding
),
file
=
script
)
print
(
'"""line 1: h
\xe9
'
,
file
=
script
)
print
(
'line 2: hi"""'
,
file
=
script
)
synopsis
=
pydoc
.
synopsis
(
TESTFN
,
{})
self
.
assertEqual
(
synopsis
,
'line 1: h
\xe9
'
)
class
TestDescriptions
(
unittest
.
TestCase
):
class
TestDescriptions
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
e6c910e9
...
@@ -25,6 +25,9 @@ Core and Builtins
...
@@ -25,6 +25,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12451: pydoc.synopsis() now reads the encoding cookie if available,
to read the Python script from the right encoding.
- Issue #12451: distutils now opens the setup script in binary mode to read the
- Issue #12451: distutils now opens the setup script in binary mode to read the
encoding cookie, instead of opening it in UTF-8.
encoding cookie, instead of opening it in UTF-8.
...
...
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