[Python-Dev] os.access and Unicode

M.-A. Lemburg mal at egenix.com
Fri Mar 11 11:23:21 CET 2005


Martin v. Löwis wrote:
> 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. 

-1. That only makes the code more complicated.

> 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.

+1. Application writers can add tests for the correct version
of Python to their application and give a warning to the user
in case the version doesn't match.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Mar 11 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-Dev mailing list