Ezio Melotti <ezio.melo...@gmail.com> added the comment:

Right now posixpath returns the argument unchanged, ntpath performs a 
.replace(), and macpath a .lower(), so when non-string (or non-bytes) are 
passed to normcase the results are:
posixpath: arg returned as-is;
ntpath: AttributeError (object has no attribute 'replace');
macpath: AttributeError (object has no attribute 'lower');

In posixpath we could reject all the non-string (and non-bytes) args, raising a 
TypeError. For consistency, the other functions should raise a TypeError too, 
but I'm not sure it's worth changing it.

Attached a simple testcase that checks that normcase raises a TypeError for 
invalid values with all the three implementations.

----------
keywords: +patch
stage: unit test needed -> needs patch
Added file: http://bugs.python.org/file17700/issue9018.diff

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

Reply via email to