[issue9018] os.path.normcase(None) does not raise an error on linux and should

Ezio Melotti report at bugs.python.org
Mon Jun 21 23:32:17 CEST 2010


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

ntpath and macpath raise an AttributeError, so we could:
1) change them all to accept only bytes/str and raise a TypeError for other wrong types (correct, consistent, non-backward-compatible);
2) change only posixpath to raise a TypeError for wrong types (partially correct, inconsistent, backward-compatible);
3) change only posixpath to raise an AttributeError for wrong types (wrong, consistent, backward-compatible);

The option 2 is still an improvement over the current situation, but it would be better to find a backward-compatible way to also obtain option 1 (assuming that backward compatibility is a concern here -- and I think it is (even though people could just change the code to catch (AttributeError, TypeError) and eventually get rid of the AttributeError)).

----------

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


More information about the Python-bugs-list mailing list