[issue17624] Confusing TypeError in urllib.urlopen

R. David Murray report at bugs.python.org
Wed Apr 3 13:09:50 CEST 2013


R. David Murray added the comment:

In Python3 the equivalent urllib.request.urlopen call produces:

  ValueError: unknown url type:

So this is effectively already fixed (although that error message should be doing a repr on the value, so I fixed that).  

We don't in general document every exception that might be raised by a function.  Here the TypeError is coming from treating the url as a local filename.  I don't think it is appropriate to document all the errors that can arise from treating the URL as a filename in the urllib docs, so I don't believe any changes should be made here.  I've added the 'doc' componennt, so if someone from the doc team disagrees with me they can reopen the issue.

As for your specific concern, the application has more problems (as in, security problems) than crashing because of a TypeError if it is composing the URL from user input such that the URL gets treated as a local filename.  (This is arguably a bug in urllib, that it appears has been fixed in Python3.)

----------
assignee:  -> docs at python
components: +Documentation
nosy: +docs at python, r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17624>
_______________________________________


More information about the Python-bugs-list mailing list