Re: [Python-Dev] os.access and Unicode

2005-03-11 Thread Martin v. Löwis
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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] os.access and Unicode

2005-03-11 Thread M.-A. Lemburg
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 ! 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] os.access and Unicode

2005-03-11 Thread M.-A. Lemburg
Martin v. Löwis wrote:
M.-A. Lemburg wrote:
The question is whether it would encourage conditional work-arounds. 

-1. That only makes the code more complicated.

You misunderstand. I'm not proposing that the work-around is added
to Python. I'm saying that Python *users* might introduce such
work-arounds to their code.
Ah, ok.
Either way, the code get's more complicated :-)
+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.

Application writers typically don't do that if they can find
a work-around, because that means less hassle for their users.
They accept that the code will get more complicated because
of the work-around, and blame Python for having this bug in the
first place.
Hmm, eGenix always suggests to people to use the latest
patch level release, esp. for production systems, not only
for Python itself, but also for the products. Zope Corp.
does the same, as do many other application writers.
The only time where we do add work-arounds is for changes
between minor Python versions in order to make the same
code base work for multiple Python versions, but that's
rare.
In any case, I can't backport the os.access change without explicit
permission from Anthony.
Agreed.
--
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 ! 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] os.access and Unicode

2005-03-09 Thread Martin v. Löwis
Brett C. wrote:
If there was no other way to get os.access-like functionality, I would 
say it should be backported.  But since there are other ways to figure 
out everything that os.access can tell you
I believe this is not really true, atleast not on Windows, and perhaps
not in certain NFS cases, either. If there are ACLs on the file, access
will consider them (or atleast it should), but no other method will.
Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] os.access and Unicode

2005-03-08 Thread Martin v. Löwis
Apparently, os.access was forgotten when the file system encoding
was introduced in Python 2.2, and then it was again forgotten in
PEP 277.
I've now fixed it in the trunk (posixmodule.c:2.334), and I wonder
whether this is a backport candidate. People who try to invoke
os.access with a non-ASCII filename on non-NT+ systems will get
a UnicodeError; with the patch, the operation will succeed
(assuming the characters are all supported in the file system
encoding).
Should this be backported?
Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] os.access and Unicode

2005-03-08 Thread Brett C.
Martin v. Löwis wrote:
Apparently, os.access was forgotten when the file system encoding
was introduced in Python 2.2, and then it was again forgotten in
PEP 277.
I've now fixed it in the trunk (posixmodule.c:2.334), and I wonder
whether this is a backport candidate. People who try to invoke
os.access with a non-ASCII filename on non-NT+ systems will get
a UnicodeError; with the patch, the operation will succeed
(assuming the characters are all supported in the file system
encoding).
Should this be backported?
If there was no other way to get os.access-like functionality, I would say it 
should be backported.  But since there are other ways to figure out everything 
that os.access can tell you I say don't backport and amend the docs to state it 
is not Unicode-aware.  If one was adventurous enough the docs could even 
include other ways to get the same info when Unicode had to be used.

-Brett
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] os.access and Unicode

2005-03-08 Thread M.-A. Lemburg
Brett C. wrote:
Martin v. Löwis wrote:
Apparently, os.access was forgotten when the file system encoding
was introduced in Python 2.2, and then it was again forgotten in
PEP 277.
I've now fixed it in the trunk (posixmodule.c:2.334), and I wonder
whether this is a backport candidate. People who try to invoke
os.access with a non-ASCII filename on non-NT+ systems will get
a UnicodeError; with the patch, the operation will succeed
(assuming the characters are all supported in the file system
encoding).
Should this be backported?
+1; it's a bug, not a new feature.
If there was no other way to get os.access-like functionality, I would 
say it should be backported.  But since there are other ways to figure 
out everything that os.access can tell you I say don't backport and 
amend the docs to state it is not Unicode-aware.  If one was adventurous 
enough the docs could even include other ways to get the same info when 
Unicode had to be used.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source  (#1, Mar 08 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 ! 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com