[Python-Dev] Are undocumented exceptions considered bugs?

Stefan Bucur stefan.bucur at gmail.com
Sat Mar 23 12:05:13 CET 2013


I'm not sure this is the right place to ask this question, but I thought
I'd give it a shot since it also concerns the Python standard library.

I'm writing an automated test case generation tool for Python programs that
explores all possible execution paths through a program. When applying this
tool on Python's 2.7.3 urllib package, it discovered input strings for
which the urllib.urlopen(url) call would raise a TypeError. For instance:


  File "/home/bucur/onion/python-bin/lib/python2.7/urllib.py", line 86, in
    return opener.open(url)
  File "/home/bucur/onion/python-bin/lib/python2.7/urllib.py", line 207, in
    return getattr(self, name)(url)
  File "/home/bucur/onion/python-bin/lib/python2.7/urllib.py", line 462, in
    return self.open_local_file(url)
  File "/home/bucur/onion/python-bin/lib/python2.7/urllib.py", line 474, in
    stats = os.stat(localname)
TypeError: must be encoded string without NULL bytes, not str

In the urllib documentation it is only mentioned that the IOError is raised
when the connection cannot be established. Since the input passed is a
string (and not some other type), is the TypeError considered a bug (either
in the documentation, or in the implementation)?

Thanks a lot,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130323/fcf304da/attachment.html>

More information about the Python-Dev mailing list