[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-21 Thread Stefan Krah

Stefan Krah  added the comment:

It just happened again on the new FreeBSD-9.0 bot:

http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%208.2%203.x/builds/1845/steps/test/logs/stdio

==
FAIL: test_package___file__ (test.test_imp.PEP3147Tests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_imp.py", 
line 333, in test_package___file__
os.sep.join(('.', 'pep3147', '__init__.py')))
AssertionError: 'pep3147/__init__.py' != './pep3147/__init__.py'
- pep3147/__init__.py
+ ./pep3147/__init__.py
? ++

--
nosy: +skrah

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-20 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-20 Thread Brett Cannon

Brett Cannon  added the comment:

The test suite does use importlib for some imports as finders from importlib 
for some packages stick around. I brought this up a way back but people thought 
it was actually a good idea to let importlib handle imports to stress test it.

Anyway, if it can't be reproduced then I don't think this is worth worrying 
about. As Nick pointed out, everything should be absolute anyway.

--

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-20 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

[...]

And I can't reproduce, even when using --randseed.

--

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-20 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

There was the following sporadic buildbot failure:


==
FAIL: test_package___file__ (test.test_imp.PEP3147Tests)
--
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_imp.py", 
line 333, in test_package___file__
os.sep.join(('.', 'pep3147', '__init__.py')))
AssertionError: 'pep3147/__init__.py' != './pep3147/__init__.py'
- pep3147/__init__.py
+ ./pep3147/__init__.py
? ++


I wonder if the test suite is playing games and sometimes using importlib :-/

--

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-19 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-19 Thread Nick Coghlan

Nick Coghlan  added the comment:

Purging __file__ of relative references isn't a problem - they're *supposed* to 
always be absolute. The import.c version just stuffs it up sometimes (mainly 
due to the way it handles the empty string in the path).

IOW, while the importlib behaviour *is* different from the old behaviour, it's 
really a long overdue fix rather than a defect.
(You can still induce weirdness by adding paths involving '.' or '..' to 
sys.path, but that's more a case of "don't do that". We add the empty string 
ourselves, so we should handle it more cleanly than we do in import.c)

--

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-19 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-18 Thread Brett Cannon

Brett Cannon  added the comment:

It's surprisingly difficult to get right because tests will fail if you keep 
the path relative in other situations (such as test_cmd_line_script). It was an 
absolute pain to get it to where it is now. If you can make it keep the 
relative path and pass the test then that's great, but relative file paths suck 
for compatibility and I don't think they are that useful to begin with.

--

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-18 Thread Antoine Pitrou

New submission from Antoine Pitrou :

An empty sys.path string means the current directory in relative terms:

$ touch foo.py
$ python3 -c "import foo; print(foo.__file__)"
foo.py


But importlib uses os.getcwd() instead in PathFinder._path_importer_cache(). 
This impacts semantics of path searching, as well as the values of __file__ and 
__cached__ attributes.

--
assignee: brett.cannon
components: Library (Lib)
messages: 153656
nosy: brett.cannon, pitrou
priority: normal
severity: normal
status: open
title: importlib mixes up '.' and os.getcwd()
versions: Python 3.2, Python 3.3

___
Python tracker 

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