mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix `sphinx.ext.intersphinx
crashes if non-string value is used for key of
intersphinx_mapping`
This commit is contained in:
parent
20b3da5cf6
commit
9546fdaf5e
1
CHANGES
1
CHANGES
@ -58,6 +58,7 @@ Bugs fixed
|
||||
* #2517: wrong bookmark encoding in PDF if using LuaLaTeX
|
||||
* #2521: generated Makefile causes BSD make crashed if sphinx-build not found
|
||||
* #2470: ``typing`` backport package causes autodoc errors with python 2.7
|
||||
* ``sphinx.ext.intersphinx`` crashes if non-string value is used for key of `intersphinx_mapping`
|
||||
|
||||
|
||||
Release 1.4.1 (released Apr 12, 2016)
|
||||
|
@ -33,7 +33,7 @@ import posixpath
|
||||
from os import path
|
||||
import re
|
||||
|
||||
from six import iteritems
|
||||
from six import iteritems, string_types
|
||||
from six.moves.urllib import parse, request
|
||||
from docutils import nodes
|
||||
from docutils.utils import relative_path
|
||||
@ -271,7 +271,10 @@ def load_mappings(app):
|
||||
if isinstance(value, tuple):
|
||||
# new format
|
||||
name, (uri, inv) = key, value
|
||||
if not name.isalnum():
|
||||
if not isinstance(name, string_types):
|
||||
app.warn('intersphinx identifier %r is not string. Ignored' % name)
|
||||
continue
|
||||
elif not name.isalnum():
|
||||
app.warn('intersphinx identifier %r is not alphanumeric' % name)
|
||||
else:
|
||||
# old format, no name
|
||||
|
@ -170,13 +170,14 @@ def test_load_mappings_warnings(tempdir, app, status, warning):
|
||||
'py3k': ('https://docs.python.org/py3k/', inv_file),
|
||||
'repoze.workflow': ('http://docs.repoze.org/workflow/', inv_file),
|
||||
'django-taggit': ('http://django-taggit.readthedocs.org/en/latest/',
|
||||
inv_file)
|
||||
inv_file),
|
||||
12345: ('http://www.sphinx-doc.org/en/stable/', inv_file),
|
||||
}
|
||||
|
||||
app.config.intersphinx_cache_limit = 0
|
||||
# load the inventory and check if it's done correctly
|
||||
load_mappings(app)
|
||||
assert warning.getvalue().count('\n') == 2
|
||||
assert warning.getvalue().count('\n') == 3
|
||||
|
||||
|
||||
class TestStripBasicAuth(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user