[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-02-21 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed in r78247 (trunk) and r78248 (release26-maint) (plus a fix in r78272 and 
r78279 to avoid test failures when the filesystem encoding is ascii).
I didn't use the any_cwd decorator -- I might consider it in future if it turns 
out that there are more tests like these.

--
dependencies:  -Add a context manager to change cwd in test.test_support and 
run the test suite in a temp dir.
resolution:  -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-02-20 Thread Florent Xicluna

Florent Xicluna  added the comment:

The attached patch proposes a decorator which can be used to strengthen any 
test which is affected by the CWD. (and fixes for test_(mac|nt|posix)path too)

--
Added file: http://bugs.python.org/file16267/issue3426_any_cwd.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-02-01 Thread Brian Curtin

Brian Curtin  added the comment:

The patch intentionally doesn't use assertIsInstance because that method 
doesn't exist in 2.6.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-31 Thread Florent Xicluna

Florent Xicluna  added the comment:

Small note:
 - the unit tests could use assertIsInstance(..., str), assertIsInstance(..., 
unicode) instead of the custom methods.
 - some "assertTrue" may be replaced by "assertEqual"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-18 Thread Brian Curtin

Brian Curtin  added the comment:

Passes on Windows, Mac, and Linux.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-15 Thread Ezio Melotti

Changes by Ezio Melotti :


--
dependencies: +Add a context manager to change cwd in test.test_support

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-15 Thread Ezio Melotti

Ezio Melotti  added the comment:

For consistency I updated all 4 the modules. If the tests pass on both Windows 
and Mac the patch should be ready to go in.

--
Added file: http://bugs.python.org/file15902/issue3426-3.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-15 Thread Florent Xicluna

Changes by Florent Xicluna :


--
keywords: +buildbot

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-15 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

abspath is basically dead code in macpath, the module is used to manipulate 
classic MacOS9-style paths and is no longer used as os.path on any supported 
platform (it used to be os.path on MacOS9).

BTW. the module itself is not dead, OSX still uses OS9-style paths in a number 
of older APIs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-14 Thread Ezio Melotti

Ezio Melotti  added the comment:

I'll fix the patch. I added Ronald and Andrew to see if they have any opinion 
about macpath and os2emxpath. The main idea is that abspath should always 
return unicode if its arg is unicode or str otherwise.

--
nosy: +aimacintyre, ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-14 Thread Brian Curtin

Brian Curtin  added the comment:

assertStr and assertUnicode don't exist in test_ntpath so the tests fail on 
Windows. I copied/pasted the functions over from test_posixpath just to see and 
test_ntpath passes. Other than that, it looks good to me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-13 Thread Ezio Melotti

Ezio Melotti  added the comment:

I added the fix on ntpath and more tests. I also refactored the tests I added 
for posixpath.
I don't know what is the situation of os2emxpath and macpath and if they should 
be fixed too. The code for abspath is currently the same on all 4 the modules 
but I don't see any easy way to avoid the duplication and move it to 
genericpath because they call the module-dependent join and normpath.

--
Added file: http://bugs.python.org/file15867/issue3426-2.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-12 Thread Brian Curtin

Brian Curtin  added the comment:

You could use assertIsInstance(s, unicode, '%r is not unicode' % s) in the 
tests instead of your assertTrue.

I think the rest of it looks good. Works for me.

--
nosy: +brian.curtin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-12 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +flox

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

Here is a patch that uses os.getcwdu() instead of os.getcwd() when the arg of 
abspath is unicode (with tests).

It also include an helper context manager in test_support used to create temp 
dirs and set them as cwd (this will be committed separately) and two helper 
methods (assertUnicode and assertStr) that will probably be useful when I (or 
someone else) will add more tests with unicode strings for the other functions.

--
keywords: +needs review, patch
nosy:  -flox
stage: test needed -> patch review
Added file: http://bugs.python.org/file15847/issue3426.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-12 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +flox

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-01-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

This also caused the failure in #7669.
I think that the functions in os.path are supposed to return unicode when they 
get unicode, so I agree that os.getcwdu should be used instead.
I'm not sure about os.path.supports_unicode_filenames though.

--
assignee:  -> ezio.melotti
stage:  -> test needed
superseder:  -> test_unicode_file fails with non-ascii path

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2009-07-03 Thread Ezio Melotti

Ezio Melotti  added the comment:

This seems to work fine with Py 3.0 and 3.1 on Linux, it still fails
with Py 2.6 and 2.7.

--
nosy: +ezio.melotti
priority:  -> normal
versions: +Python 2.6, Python 2.7 -Python 2.4, Python 2.5, Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2008-07-22 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

Well, os.path.supports_unicode_filenames is False on posix platforms.
So os.path.abspath is not supposed to work with unicode values.

I was about to close the issue, but python 3.0 also defines
supports_unicode_filenames to False! In addition, os.getcwd() fails when
the current dir has non-ascii characters. Should we drop its
implementation, and use os.getcwdu instead?

--
nosy: +amaury.forgeotdarc
versions: +Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2008-07-22 Thread Christian Häggström

New submission from Christian Häggström <[EMAIL PROTECTED]>:

If current working directory contains non-ascii characters, calling
os.path.abspath(u".") will result in an error. I expect it to call the
underlying os.getcwdu() in this case.

>>> import os
>>> os.path.abspath(u".")
Traceback (most recent call last):
  File "", line 1, in 
  File
"/home/packages/python-2.5.1/x86-linux/lib/python2.5/posixpath.py", line
403, in abspath
path = join(os.getcwd(), path)
  File
"/home/packages/python-2.5.1/x86-linux/lib/python2.5/posixpath.py", line
65, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 29:
ordinal not in range(128)

It works if I do it manually, using os.getcwdu():

>>> os.path.join(os.getcwdu(), u".")
u'/disk1/chn_local/work/test/sk\xe4rg\xe5rds\xf6-latin1/.'

--
components: Unicode
messages: 70148
nosy: saturn_mimas
severity: normal
status: open
title: os.path.abspath with unicode argument should call os.getcwdu
type: behavior
versions: Python 2.4, Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com