Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
eb432144
Commit
eb432144
authored
Jul 10, 2014
by
Zachary Ware
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21942: Fixed source file viewing in pydoc's server mode on Windows.
parent
7cca28ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
Lib/pydoc.py
Lib/pydoc.py
+3
-5
Lib/test/test_pydoc.py
Lib/test/test_pydoc.py
+2
-5
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/pydoc.py
View file @
eb432144
...
...
@@ -64,6 +64,7 @@ import re
import
sys
import
time
import
tokenize
import
urllib.parse
import
warnings
from
collections
import
deque
from
reprlib
import
Repr
...
...
@@ -648,10 +649,7 @@ class HTMLDoc(Doc):
head
=
'<big><big><strong>%s</strong></big></big>'
%
linkedname
try
:
path
=
inspect
.
getabsfile
(
object
)
url
=
path
if
sys
.
platform
==
'win32'
:
import
nturl2path
url
=
nturl2path
.
pathname2url
(
path
)
url
=
urllib
.
parse
.
quote
(
path
)
filelink
=
self
.
filelink
(
url
,
path
)
except
TypeError
:
filelink
=
'(built-in)'
...
...
@@ -2353,7 +2351,7 @@ def _url_handler(url, content_type="text/html"):
def
html_getfile
(
path
):
"""Get and display a source file listing safely."""
path
=
path
.
replace
(
'%20'
,
' '
)
path
=
urllib
.
parse
.
unquote
(
path
)
with
tokenize
.
open
(
path
)
as
fp
:
lines
=
html
.
escape
(
fp
.
read
())
body
=
'<pre>%s</pre>'
%
lines
...
...
Lib/test/test_pydoc.py
View file @
eb432144
...
...
@@ -14,6 +14,7 @@ import test.support
import
time
import
types
import
unittest
import
urllib.parse
import
xml.etree
import
textwrap
from
io
import
StringIO
...
...
@@ -406,11 +407,7 @@ class PydocDocTest(unittest.TestCase):
def
test_html_doc
(
self
):
result
,
doc_loc
=
get_pydoc_html
(
pydoc_mod
)
mod_file
=
inspect
.
getabsfile
(
pydoc_mod
)
if
sys
.
platform
==
'win32'
:
import
nturl2path
mod_url
=
nturl2path
.
pathname2url
(
mod_file
)
else
:
mod_url
=
mod_file
mod_url
=
urllib
.
parse
.
quote
(
mod_file
)
expected_html
=
expected_html_pattern
%
(
(
mod_url
,
mod_file
,
doc_loc
)
+
expected_html_data_docstrings
)
...
...
Misc/NEWS
View file @
eb432144
...
...
@@ -27,6 +27,8 @@ Core and Builtins
Library
-------
- Issue #21942: Fixed source file viewing in pydoc'
s
server
mode
on
Windows
.
-
Issue
#
11259
:
asynchat
.
async_chat
().
set_terminator
()
now
raises
a
ValueError
if
the
number
of
received
bytes
is
negative
.
...
...
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