Fix #5320: intersphinx: crashed if invalid url given

This commit is contained in:
Takeshi KOMIYA 2018-08-22 15:28:16 +09:00
parent 2371614227
commit bde53bf9fb
2 changed files with 15 additions and 8 deletions

View File

@ -16,6 +16,8 @@ Features added
Bugs fixed
----------
* #5320: intersphinx: crashed if invalid url given
Testing
--------

View File

@ -403,6 +403,7 @@ def inspect_main(argv):
def warn(self, msg):
print(msg, file=sys.stderr)
try:
filename = argv[0]
invdata = fetch_inventory(MockApp(), '', filename) # type: ignore
for key in sorted(invdata or {}):
@ -411,6 +412,10 @@ def inspect_main(argv):
print('\t%-40s %s%s' % (entry,
einfo[3] != '-' and '%-40s: ' % einfo[3] or '',
einfo[2]))
except ValueError as exc:
print(exc.args[0] % exc.args[1:])
except Exception as exc:
print('Unknown error: %r' % exc)
if __name__ == '__main__':