[Python-Dev] os.access and Unicode

"Martin v. Löwis" martin at v.loewis.de
Fri Mar 11 10:49:35 CET 2005


Skip Montanaro wrote:
  > I say backport.  If people were trying to call os.access with unicode
> filenames it would have been failing and they were either avoiding unicode
> filenames as a result or working around it some other way.  I can't see how
> making os.access work with unicode filenames is going to break existing
> code.

The question is whether it would encourage conditional work-arounds. If
people will put into their code

if sys.version_info < (2,4,2):
    import os, sys
    def new_access(name, mode, old_access = os.access):
        try:
            return old_access(name, mode)
        except UnicodeError:
            return old_access(name.encode(
                 sys.getfilesystemencoding()), mode)
    os.access = new_access

then backporting does not improve anything. OTOH, if people are likely
to say "yes, this was a bug in 2.4.0 and 2.4.1, you need atleast 2.4.2",
backporting will help.

Regards,
Martin


More information about the Python-Dev mailing list