Ronald Oussoren added the comment:

On 28 May, 2013, at 10:28, Elazar Gershuni <rep...@bugs.python.org> wrote:

> 
> Elazar Gershuni added the comment:
> 
> Is it standard procedure to raise an unrelated exception in when an invalid 
> parameter is passed? I did not encounter any other library function that 
> behaves like this. Especially taking the fact that this is the normal usage 
> in python3. 

This is not the normal usage in python3, but one of the usecases supported in 
python3.  In python3 compiled code is a byte string and source code is a 
regular (unicode) string, which means the two can easily be recognized, while 
in python2 both are 'str' strings.

> 
> How do I supposed to *know* this is not a bug?

By reading the documentation? 

> I can't find similar behavior in other library functions. An IndexError and a 
> traceback *inside the library* does not help.

Other library functions can also raise fairly obscure exceptions when you pass 
in bad data, as an example of this "os.path.join(None, 'a')" raises 
AttributeError.

----------
title: dis.dis raises IndexError -> dis.dis throws IndexError

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to