[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-10-20 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

I fixed this is r66707.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-28 Thread David Wolever

David Wolever [EMAIL PROTECTED] added the comment:

Can you write a test case proving this?

At the moment, the second thing that the transform function in  
fix_import.py does is return if the import doesn't look like a local  
import (see probably_a_local_import in fix_import).

At the moment, all (with an exception or two) of the import test  
cases test both cases -- the local import exists and the local import  
does not exist -- automatically.

On 28-Mar-08, at 3:04 PM, Collin Winter wrote:


 Collin Winter [EMAIL PROTECTED] added the comment:

 The problem with the fix in r61755 is that it doesn't distinguish
 between stdlib and non-stdlib imports: import os becomes from .
 import os, which is clearly wrong.

 __
 Tracker [EMAIL PROTECTED]
 http://bugs.python.org/issue2446
 __

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-28 Thread Collin Winter

Collin Winter [EMAIL PROTECTED] added the comment:

Looking at it, I was confused by a quirk introduced into test_fixers:
Test_import's check_both() helper method does the wrong thing in this case:

a = import os
self.check_both(a, a)  # Fails, tries to translate import os into
from . import os

self.unchanged(a) passes, though. What's going on with these methods?

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-28 Thread David Wolever

David Wolever [EMAIL PROTECTED] added the comment:

Ah, yes -- that may be the fault of the confusingly named  
'check_both'.  The both means both when the module in question  
exists and when it does not.  If you've got a better name, please  
change it!
Take a look at the method and you'll see how it works.

The problem is that testing this is a little tricky -- you've either  
got to give it files that you know exist, create files, or work some  
magic.
I took the work some magic route, and replaced the exists method  
which fix_import imports from os (that way the tests can check the  
list of files which are being checked).
See the test_files_checked method for that.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-22 Thread David Wolever

David Wolever [EMAIL PROTECTED] added the comment:

Ok, I've fixed this in r61755.

I _think_ it does the right thing, but it might be good if someone else 
checks out the test cases to make sure.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-21 Thread Bruce Frederiksen

New submission from Bruce Frederiksen [EMAIL PROTECTED]:

2to3 svn rev 61696 translates import local_module into import
.local_module which isn't legal syntax.

Should be from . import local_module.

--
assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
messages: 64247
nosy: collinwinter, dangyogi
severity: normal
status: open
title: 2to3 translates import foobar to import .foobar rather than from . 
import foobar
type: behavior
versions: Python 2.6

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-21 Thread Collin Winter

Changes by Collin Winter [EMAIL PROTECTED]:


--
assignee: collinwinter - David Wolever
nosy: +David Wolever

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2446] 2to3 translates import foobar to import .foobar rather than from . import foobar

2008-03-21 Thread Martin v. Löwis

Changes by Martin v. Löwis [EMAIL PROTECTED]:


--
nosy: +loewis

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2446
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com