> Did you see the other message, that loading a module the old way stopped
> working?  We should support backwards compatibility, otherwise all
> existing plugins that load a Python module suddenly stop working. 

Was not intended. It appears that currently the only option is to have this 
special directory be the last one in sys.path or not have it at all in python 
2. In python 3 where authors have provided easy access to internals everything 
works fine.

I will investigate the issue further. Currently I can only say that if I try to 
use import with trailing directories in a living system bug does appear (for 
python-2* only), but the following tests work in both pythons which is rather 
strange:

diff -r 7fda29626053 src/testdir/python_before/after.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/python_before/after.py        Tue Jun 11 20:38:22 2013 +0400
@@ -0,0 +1,1 @@
+dir = "after"
diff -r 7fda29626053 src/testdir/python_before/before.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/python_before/before.py       Tue Jun 11 20:38:22 2013 +0400
@@ -0,0 +1,1 @@
+dir = "before"
diff -r 7fda29626053 src/testdir/test86.in
--- a/src/testdir/test86.in     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test86.in     Tue Jun 11 20:38:22 2013 +0400
@@ -1069,13 +1069,19 @@
 ee('vim.current.xxx = True')
 EOF
 :"
-:" Test import  TODO: BROKEN
-:"py << EOF
-:"vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
-:"from module import dir as d
-:"from modulex import ddir
-:"cb.append(d + ',' + ddir)
-:"EOF
+:" Test import
+py << EOF
+sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
+sys.path.append(os.path.join(os.getcwd(), 'python_after'))
+vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+from module import dir as d
+from modulex import ddir
+cb.append(d + ',' + ddir)
+import before
+cb.append(before.dir)
+import after
+cb.append(after.dir)
+EOF
 :"
 :" Test exceptions
 :fun Exe(e)
diff -r 7fda29626053 src/testdir/test86.ok
--- a/src/testdir/test86.ok     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test86.ok     Tue Jun 11 20:38:22 2013 +0400
@@ -1083,6 +1083,9 @@
 vim.current.window = True:(<type 'exceptions.TypeError'>, TypeError('expected 
vim.Window object',))
 vim.current.tabpage = True:(<type 'exceptions.TypeError'>, TypeError('expected 
vim.TabPage object',))
 vim.current.xxx = True:(<type 'exceptions.AttributeError'>, 
AttributeError('xxx',))
+2,xx
+before
+after
 vim.command("throw 'abc'"):(<class 'vim.error'>, error('abc',))
 Exe("throw 'def'"):(<class 'vim.error'>, error('def',))
 vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))
diff -r 7fda29626053 src/testdir/test87.in
--- a/src/testdir/test87.in     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test87.in     Tue Jun 11 20:38:22 2013 +0400
@@ -1036,13 +1036,19 @@
 ee('vim.current.xxx = True')
 EOF
 :"
-:" Test import  TODO: BROKEN
-:"py3 << EOF
-:"vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
-:"from module import dir as d
-:"from modulex import ddir
-:"cb.append(d + ',' + ddir)
-:"EOF
+:" Test import
+py3 << EOF
+sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
+sys.path.append(os.path.join(os.getcwd(), 'python_after'))
+vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+from module import dir as d
+from modulex import ddir
+cb.append(d + ',' + ddir)
+import before
+cb.append(before.dir)
+import after
+cb.append(after.dir)
+EOF
 :"
 :" Test exceptions
 :fun Exe(e)
diff -r 7fda29626053 src/testdir/test87.ok
--- a/src/testdir/test87.ok     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test87.ok     Tue Jun 11 20:38:22 2013 +0400
@@ -1092,6 +1092,9 @@
 vim.current.window = True:(<class 'TypeError'>, TypeError('expected vim.Window 
object',))
 vim.current.tabpage = True:(<class 'TypeError'>, TypeError('expected 
vim.TabPage object',))
 vim.current.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',))
+3,xx
+before
+after
 vim.command("throw 'abc'"):(<class 'vim.error'>, error('abc',))
 Exe("throw 'def'"):(<class 'vim.error'>, error('def',))
 vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui