Loading ...
Sorry, an error occurred while loading the content.

[PATCH] (0/3) _vim_runtimepath_ special directory and some small stuff

Expand Messages
  • ZyX
    -- -- 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
    Message 1 of 26 , Jun 9, 2013
    View Source
    • 0 Attachment
      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • ZyX
      # HG changeset patch # User ZyX # Date 1370677291 -14400 # Sat Jun 08 11:41:31 2013 +0400 # Branch python-path # Node ID
      Message 2 of 26 , Jun 9, 2013
      View Source
      • 0 Attachment
        # HG changeset patch
        # User ZyX <kp-pav@...>
        # Date 1370677291 -14400
        # Sat Jun 08 11:41:31 2013 +0400
        # Branch python-path
        # Node ID 5af09dbe636d979f376b6bebc3c043d7cc89aed4
        # Parent 99c9dd23883f4503603cd45db133d9e3306eb8f3
        Use macro PyList_SET_ITEM in place of PyList_SetItem:

        1. It is faster.
        2. It is what it was designed for: populating a newly allocated empty list.

        diff -r 99c9dd23883f -r 5af09dbe636d src/if_py_both.h
        --- a/src/if_py_both.h Sat Jun 08 23:30:04 2013 +0200
        +++ b/src/if_py_both.h Sat Jun 08 11:41:31 2013 +0400
        @@ -375,8 +375,10 @@
        static int
        PythonIO_Init_io(void)
        {
        - PySys_SetObject("stdout", (PyObject *)(void *)&Output);
        - PySys_SetObject("stderr", (PyObject *)(void *)&Error);
        + if (PySys_SetObject("stdout", (PyObject *)(void *)&Output))
        + return -1;
        + if (PySys_SetObject("stderr", (PyObject *)(void *)&Error))
        + return -1;

        if (PyErr_Occurred())
        {
        @@ -1319,12 +1321,7 @@
        Py_DECREF(r);
        return NULL;
        }
        - if (PyList_SetItem(r, i, newObj))
        - {
        - Py_DECREF(r);
        - Py_DECREF(newObj);
        - return NULL;
        - }
        + PyList_SET_ITEM(r, i, newObj);
        --todo;
        ++i;
        }
        @@ -1808,12 +1805,7 @@
        return NULL;
        }

        - if ((PyList_SetItem(list, ((reversed)?(n-i-1):(i)), item)))
        - {
        - Py_DECREF(item);
        - Py_DECREF(list);
        - return NULL;
        - }
        + PyList_SET_ITEM(list, ((reversed)?(n-i-1):(i)), item);
        }

        return list;
        @@ -3164,13 +3156,7 @@
        return NULL;
        }

        - /* Set the list item */
        - if (PyList_SetItem(list, i, str))
        - {
        - Py_DECREF(str);
        - Py_DECREF(list);
        - return NULL;
        - }
        + PyList_SET_ITEM(list, i, str);
        }

        /* The ownership of the Python list is passed to the caller (ie,
        @@ -5366,8 +5352,12 @@
        static int
        populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
        {
        - int i;
        - PyObject *os;
        + int i;
        + PyObject *other_module;
        + PyObject *path_hooks;
        + PyObject *path;
        + PyObject *pathObject;
        + PyObject *path_hook;

        for (i = 0; i < (int)(sizeof(numeric_constants)
        / sizeof(struct numeric_constant));
        @@ -5395,24 +5385,24 @@
        ADD_CHECKED_OBJECT(m, "options",
        OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL));

        - if (!(os = PyImport_ImportModule("os")))
        + if (!(other_module = PyImport_ImportModule("os")))
        return -1;
        - ADD_OBJECT(m, "os", os);
        -
        - if (!(py_getcwd = PyObject_GetAttrString(os, "getcwd")))
        + ADD_OBJECT(m, "os", other_module);
        +
        + if (!(py_getcwd = PyObject_GetAttrString(other_module, "getcwd")))
        return -1;
        ADD_OBJECT(m, "_getcwd", py_getcwd)

        - if (!(py_chdir = PyObject_GetAttrString(os, "chdir")))
        + if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir")))
        return -1;
        ADD_OBJECT(m, "_chdir", py_chdir);
        - if (PyObject_SetAttrString(os, "chdir", get_attr(m, "chdir")))
        + if (PyObject_SetAttrString(other_module, "chdir", get_attr(m, "chdir")))
        return -1;

        - if ((py_fchdir = PyObject_GetAttrString(os, "fchdir")))
        + if ((py_fchdir = PyObject_GetAttrString(other_module, "fchdir")))
        {
        ADD_OBJECT(m, "_fchdir", py_fchdir);
        - if (PyObject_SetAttrString(os, "fchdir", get_attr(m, "fchdir")))
        + if (PyObject_SetAttrString(other_module,"fchdir",get_attr(m,"fchdir")))
        return -1;
        }
        else

        --
        --
        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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • ZyX
        # HG changeset patch # User ZyX # Date 1370688053 -14400 # Sat Jun 08 14:40:53 2013 +0400 # Branch python-path # Node ID
        Message 3 of 26 , Jun 9, 2013
        View Source
        • 0 Attachment
          # HG changeset patch
          # User ZyX <kp-pav@...>
          # Date 1370688053 -14400
          # Sat Jun 08 14:40:53 2013 +0400
          # Branch python-path
          # Node ID a40ac5f7feca2a9af9c6d1eb0f746b7e01da7d10
          # Parent 5af09dbe636d979f376b6bebc3c043d7cc89aed4
          Fix memory leaks

          diff -r 5af09dbe636d -r a40ac5f7feca src/if_py_both.h
          --- a/src/if_py_both.h Sat Jun 08 11:41:31 2013 +0400
          +++ b/src/if_py_both.h Sat Jun 08 14:40:53 2013 +0400
          @@ -5358,6 +5358,7 @@
          PyObject *path;
          PyObject *pathObject;
          PyObject *path_hook;
          + PyObject *attr;

          for (i = 0; i < (int)(sizeof(numeric_constants)
          / sizeof(struct numeric_constant));
          @@ -5396,14 +5397,26 @@
          if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir")))
          return -1;
          ADD_OBJECT(m, "_chdir", py_chdir);
          - if (PyObject_SetAttrString(other_module, "chdir", get_attr(m, "chdir")))
          + if (!(attr = get_attr(m, "chdir")))
          return -1;
          + if (PyObject_SetAttrString(other_module, "chdir", attr))
          + {
          + Py_DECREF(attr);
          + return -1;
          + }
          + Py_DECREF(attr);

          if ((py_fchdir = PyObject_GetAttrString(other_module, "fchdir")))
          {
          ADD_OBJECT(m, "_fchdir", py_fchdir);
          - if (PyObject_SetAttrString(other_module,"fchdir",get_attr(m,"fchdir")))
          + if (!(attr = get_attr(m, "fchdir")))
          return -1;
          + if (PyObject_SetAttrString(other_module, "fchdir", attr))
          + {
          + Py_DECREF(attr);
          + return -1;
          + }
          + Py_DECREF(attr);
          }
          else
          PyErr_Clear();
          diff -r 5af09dbe636d -r a40ac5f7feca src/if_python.c
          --- a/src/if_python.c Sat Jun 08 11:41:31 2013 +0400
          +++ b/src/if_python.c Sat Jun 08 14:40:53 2013 +0400
          @@ -207,6 +207,7 @@
          # define PyMapping_Check dll_PyMapping_Check
          # define PyIter_Next dll_PyIter_Next
          # define PyModule_GetDict dll_PyModule_GetDict
          +# define PyModule_AddObject dll_PyModule_AddObject
          # define PyRun_SimpleString dll_PyRun_SimpleString
          # define PyRun_String dll_PyRun_String
          # define PyObject_GetAttrString dll_PyObject_GetAttrString
          @@ -341,6 +342,7 @@
          static int (*dll_PyMapping_Check)(PyObject *);
          static PyObject* (*dll_PyIter_Next)(PyObject *);
          static PyObject*(*dll_PyModule_GetDict)(PyObject *);
          +static int(*dll_PyModule_AddObject)(PyObject *, const char *, PyObject *);
          static int(*dll_PyRun_SimpleString)(char *);
          static PyObject *(*dll_PyRun_String)(char *, int, PyObject *, PyObject *);
          static PyObject* (*dll_PyObject_GetAttrString)(PyObject *, const char *);
          @@ -506,6 +508,7 @@
          {"PyMapping_Check", (PYTHON_PROC*)&dll_PyMapping_Check},
          {"PyIter_Next", (PYTHON_PROC*)&dll_PyIter_Next},
          {"PyModule_GetDict", (PYTHON_PROC*)&dll_PyModule_GetDict},
          + {"PyModule_AddObject", (PYTHON_PROC*)&dll_PyModule_AddObject},
          {"PyRun_SimpleString", (PYTHON_PROC*)&dll_PyRun_SimpleString},
          {"PyRun_String", (PYTHON_PROC*)&dll_PyRun_String},
          {"PyObject_GetAttrString", (PYTHON_PROC*)&dll_PyObject_GetAttrString},
          @@ -1354,15 +1357,6 @@
          #endif

          static int
          -add_object(PyObject *dict, const char *name, PyObject *object)
          -{
          - if (PyDict_SetItemString(dict, (char *) name, object))
          - return -1;
          - Py_DECREF(object);
          - return 0;
          -}
          -
          - static int
          PythonMod_Init(void)
          {
          PyObject *mod;
          @@ -1379,9 +1373,8 @@

          mod = Py_InitModule4("vim", VimMethods, (char *)NULL, (PyObject *)NULL,
          PYTHON_API_VERSION);
          - dict = PyModule_GetDict(mod);

          - return populate_module(dict, add_object, PyDict_GetItemString);
          + return populate_module(mod, PyModule_AddObject, PyObject_GetAttrString);
          }

          /*************************************************************************

          --
          --
          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 vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • ZyX
          # HG changeset patch # User ZyX # Date 1370769215 -14400 # Sun Jun 09 13:13:35 2013 +0400 # Branch python-path # Node ID
          Message 4 of 26 , Jun 9, 2013
          View Source
          • 0 Attachment
            # HG changeset patch
            # User ZyX <kp-pav@...>
            # Date 1370769215 -14400
            # Sun Jun 09 13:13:35 2013 +0400
            # Branch python-path
            # Node ID b40bfa1c4ff1b7b272bc2394a2ca44fa940c75de
            # Parent a40ac5f7feca2a9af9c6d1eb0f746b7e01da7d10
            Implement _vim_runtimepath_, as discussed in the mailing list

            See documentation for detailed description

            diff -r a40ac5f7feca -r b40bfa1c4ff1 runtime/doc/if_pyth.txt
            --- a/runtime/doc/if_pyth.txt Sat Jun 08 14:40:53 2013 +0400
            +++ b/runtime/doc/if_pyth.txt Sun Jun 09 13:13:35 2013 +0400
            @@ -180,6 +180,12 @@
            Like |strwidth()|: returns number of display cells str occupies, tab
            is counted as one cell.

            +vim.foreach_rtp(callable) *python-foreach_rtp*
            + Call the given callable for each path in 'runtimepath' until either
            + callable returns something but None, the exception is raised or there
            + are no longer paths. If stopped in case callable returned non-None,
            + vim.foreach_rtp function returns the value returned by callable.
            +
            vim.chdir(*args, **kwargs) *python-chdir*
            vim.fchdir(*args, **kwargs) *python-fchdir*
            Run os.chdir or os.fchdir, then all appropriate vim stuff.
            @@ -300,6 +306,113 @@
            supported, and may cause the program to crash. This should probably be
            fixed.

            + *python2-directory* *python3-directory* *pythonx-directory*
            +Python 'runtimepath' handling *python-special-path*
            +
            +In python vim.VIM_SPECIAL_PATH special directory is used as a replacement for
            +the list of paths found in 'runtimepath': with this directory in sys.path and
            +vim.path_hooks in sys.path_hooks python will try to load module from
            +{rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
            +each {rtp} found in 'runtimepath'.
            +
            +Implementation for python 2 is the following: usual importing code with empty
            +lists in place of sys.path_hooks and sys.meta_path. Code is similar to the
            +below, but written in C: >
            +
            + # Assuming vim variable is already accessible and is set to the current
            + # module
            + import sys
            +
            + def find_module(fullname):
            + return vim
            +
            + def load_module(fullname):
            + # see vim._get_paths below
            + new_path = _get_paths()
            +
            + try: old_path = sys.path
            + except: pass
            + try: old_meta_path = sys.meta_path
            + except: pass
            + try: old_path_hooks = sys.path_hooks
            + except: pass
            +
            + sys.meta_path = []
            + sys.path_hooks = sys.meta_path
            + sys.path = new_path
            +
            + try:
            + exec ('import ' + fullname + ' as m') # No actual exec in C code
            + return m
            + finally:
            + e = None
            + try: sys.path = old_path
            + except Exception as e: pass
            + try: sys.meta_path = old_meta_path
            + except Exception as e: pass
            + try: sys.path_hooks = old_path_hooks
            + except Exception as e: pass
            + if e:
            + raise e
            +
            + def path_hook(d):
            + if d == VIM_SPECIAL_PATH:
            + return vim
            + raise ImportError
            +
            + sys.path_hooks.append(path_hook)
            +
            +Implementation for python 3 is cleaner: code is similar to the following, but,
            +again, written in C: >
            +
            + from importlib.machinery import PathFinder
            + import sys
            +
            + class Finder(PathFinder):
            + @classmethod
            + def find_module(cls, fullname):
            + # see vim._get_paths below
            + new_path = _get_paths()
            +
            + # super().find_module is also a class method
            + # super() is not used because this variant is easier to implement
            + # in C
            + return PathFinder.find_module(fullname, new_path)
            +
            + def path_hook(path):
            + if path == VIM_SPECIAL_PATH:
            + return Finder
            + raise ImportError
            +
            + sys.path_hooks.append(path_hook)
            +
            +vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH*
            + String constant used in conjunction with vim path hook. If path hook
            + installed by vim is requested to handle anything but path equal to
            + vim.VIM_SPECIAL_PATH constant it raises ImportError. In the only other
            + case it uses special loader.
            +
            + Note: you must not use value of this constant directly, always use
            + vim.VIM_SPECIAL_PATH object.
            +
            +vim.load_module(name) *python-load_module*
            +vim.find_module(...) *python-find_module*
            +vim.path_hook(path) *python-path_hook*
            + Methods or objects used to implement path loading as described above.
            + You should not be using any of these directly except for vim.path_hook
            + in case you need to do something with sys.meta_path. It is not
            + guaranteed that any of the objects will exist in the future vim
            + versions. In fact, load_module and find_module methods do not exists
            + in python3.
            +
            +vim._get_paths *python-_get_paths*
            + Methods returning a list of paths which will be searched for by path
            + hook. You should not rely on this method being present in future
            + versions, but can use it for debugging.
            +
            + It returns a list of {rtp}/python2 (or {rtp}/python3) and
            + {rtp}/pythonx directories for each {rtp} in 'runtimepath'.
            +
            ==============================================================================
            3. Buffer objects *python-buffer*

            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/configure.in
            --- a/src/configure.in Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/configure.in Sun Jun 09 13:13:35 2013 +0400
            @@ -863,10 +863,10 @@
            ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
            ]])

            - dnl -- it must be at least version 2.2
            - AC_MSG_CHECKING(Python is 2.2 or better)
            + dnl -- it must be at least version 2.3
            + AC_MSG_CHECKING(Python is 2.3 or better)
            if ${vi_cv_path_python} -c \
            - "import sys; sys.exit(${vi_cv_var_python_version} < 2.2)"
            + "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
            then
            AC_MSG_RESULT(yep)

            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/ex_cmds2.c
            --- a/src/ex_cmds2.c Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/ex_cmds2.c Sun Jun 09 13:13:35 2013 +0400
            @@ -2737,6 +2737,10 @@
            * When "all" is TRUE repeat for all matches, otherwise only the first one is
            * used.
            * Returns OK when at least one match found, FAIL otherwise.
            + *
            + * If "name" is NULL calls callback for each entry in runtimepath. Cookie is
            + * passed by reference in this case, setting it to NULL indicates that callback
            + * has done its job.
            */
            int
            do_in_runtimepath(name, all, callback, cookie)
            @@ -2768,7 +2772,7 @@
            buf = alloc(MAXPATHL);
            if (buf != NULL && rtp_copy != NULL)
            {
            - if (p_verbose > 1)
            + if (p_verbose > 1 && name != NULL)
            {
            verbose_enter();
            smsg((char_u *)_("Searching for \"%s\" in \"%s\""),
            @@ -2782,7 +2786,13 @@
            {
            /* Copy the path from 'runtimepath' to buf[]. */
            copy_option_part(&rtp, buf, MAXPATHL, ",");
            - if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL)
            + if (name == NULL)
            + {
            + (*callback)(buf, (void *) &cookie);
            + if (!did_one)
            + did_one = (cookie == NULL);
            + }
            + else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL)
            {
            add_pathsep(buf);
            tail = buf + STRLEN(buf);
            @@ -2821,7 +2831,7 @@
            }
            vim_free(buf);
            vim_free(rtp_copy);
            - if (p_verbose > 0 && !did_one)
            + if (p_verbose > 0 && !did_one && name != NULL)
            {
            verbose_enter();
            smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/if_py_both.h
            --- a/src/if_py_both.h Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/if_py_both.h Sun Jun 09 13:13:35 2013 +0400
            @@ -24,6 +24,8 @@
            #endif
            #define DOPY_FUNC "_vim_pydo"

            +static const char *vim_special_path = "_vim_path_";
            +
            #define PyErr_SetVim(str) PyErr_SetString(VimError, str)

            #define RAISE_NO_EMPTY_KEYS PyErr_SetString(PyExc_ValueError, \
            @@ -55,6 +57,8 @@
            static PyObject *py_chdir;
            static PyObject *py_fchdir;
            static PyObject *py_getcwd;
            +static PyObject *vim_module;
            +static PyObject *vim_special_path_object;

            /*
            * obtain a lock on the Vim data structures
            @@ -779,19 +783,168 @@
            return _VimChdir(py_fchdir, args, kwargs);
            }

            +typedef struct {
            + PyObject *callable;
            + PyObject *result;
            +} map_rtp_data;
            +
            + static void
            +map_rtp_callback(char_u *path, void *_data)
            +{
            + void **data = (void **) _data;
            + PyObject *pathObject;
            + map_rtp_data *mr_data = *((map_rtp_data **) data);
            +
            + if (!(pathObject = PyString_FromString((char *) path)))
            + {
            + *data = NULL;
            + return;
            + }
            +
            + mr_data->result = PyObject_CallFunctionObjArgs(mr_data->callable,
            + pathObject, NULL);
            +
            + Py_DECREF(pathObject);
            +
            + if (!mr_data->result || mr_data->result != Py_None)
            + *data = NULL;
            + else
            + {
            + Py_DECREF(mr_data->result);
            + mr_data->result = NULL;
            + }
            +}
            +
            + static PyObject *
            +VimForeachRTP(PyObject *self UNUSED, PyObject *args)
            +{
            + map_rtp_data data;
            +
            + if (!PyArg_ParseTuple(args, "O", &data.callable))
            + return NULL;
            +
            + data.result = NULL;
            +
            + do_in_runtimepath(NULL, FALSE, &map_rtp_callback, &data);
            +
            + if (data.result == NULL)
            + {
            + if (PyErr_Occurred())
            + return NULL;
            + else
            + {
            + Py_INCREF(Py_None);
            + return Py_None;
            + }
            + }
            + return data.result;
            +}
            +
            +/*
            + * _vim_runtimepath_ special path implementation.
            + */
            +
            + static void
            +map_finder_callback(char_u *path, void *_data)
            +{
            + void **data = (void **) _data;
            + PyObject *list = *((PyObject **) data);
            + PyObject *pathObject1, *pathObject2;
            + char *pathbuf;
            + size_t pathlen;
            +
            + pathlen = STRLEN(path);
            +
            +#if PY_MAJOR_VERSION < 3
            +# define PY_MAIN_DIR_STRING "python2"
            +#else
            +# define PY_MAIN_DIR_STRING "python3"
            +#endif
            +#define PY_ALTERNATE_DIR_STRING "pythonx"
            +
            +#define PYTHONX_STRING_LENGTH 7 /* STRLEN("pythonx") */
            + if (!(pathbuf = PyMem_New(char,
            + pathlen + STRLEN(PATHSEPSTR) + PYTHONX_STRING_LENGTH + 1)))
            + {
            + PyErr_NoMemory();
            + *data = NULL;
            + return;
            + }
            +
            + mch_memmove(pathbuf, path, pathlen + 1);
            + add_pathsep((char_u *) pathbuf);
            +
            + pathlen = STRLEN(pathbuf);
            + mch_memmove(pathbuf + pathlen, PY_MAIN_DIR_STRING,
            + PYTHONX_STRING_LENGTH + 1);
            +
            + if (!(pathObject1 = PyString_FromString(pathbuf)))
            + {
            + *data = NULL;
            + PyMem_Free(pathbuf);
            + return;
            + }
            +
            + mch_memmove(pathbuf + pathlen, PY_ALTERNATE_DIR_STRING,
            + PYTHONX_STRING_LENGTH + 1);
            +
            + if (!(pathObject2 = PyString_FromString(pathbuf)))
            + {
            + Py_DECREF(pathObject1);
            + PyMem_Free(pathbuf);
            + *data = NULL;
            + return;
            + }
            +
            + PyMem_Free(pathbuf);
            +
            + if (PyList_Append(list, pathObject1)
            + || PyList_Append(list, pathObject2))
            + *data = NULL;
            +
            + Py_DECREF(pathObject1);
            + Py_DECREF(pathObject2);
            +}
            +
            + static PyObject *
            +Vim_GetPaths(PyObject *self UNUSED)
            +{
            + PyObject *r;
            +
            + if (!(r = PyList_New(0)))
            + return NULL;
            +
            + do_in_runtimepath(NULL, FALSE, &map_finder_callback, r);
            +
            + if (PyErr_Occurred())
            + {
            + Py_DECREF(r);
            + return NULL;
            + }
            +
            + return r;
            +}
            +
            /*
            * Vim module - Definitions
            */

            static struct PyMethodDef VimMethods[] = {
            - /* name, function, calling, documentation */
            - {"command", VimCommand, METH_VARARGS, "Execute a Vim ex-mode command" },
            - {"eval", VimEval, METH_VARARGS, "Evaluate an expression using Vim evaluator" },
            - {"bindeval", VimEvalPy, METH_VARARGS, "Like eval(), but returns objects attached to vim ones"},
            - {"strwidth", VimStrwidth, METH_VARARGS, "Screen string width, counts <Tab> as having width 1"},
            - {"chdir", (PyCFunction)VimChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
            - {"fchdir", (PyCFunction)VimFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
            - { NULL, NULL, 0, NULL }
            + /* name, function, calling, documentation */
            + {"command", VimCommand, METH_VARARGS, "Execute a Vim ex-mode command" },
            + {"eval", VimEval, METH_VARARGS, "Evaluate an expression using Vim evaluator" },
            + {"bindeval", VimEvalPy, METH_VARARGS, "Like eval(), but returns objects attached to vim ones"},
            + {"strwidth", VimStrwidth, METH_VARARGS, "Screen string width, counts <Tab> as having width 1"},
            + {"chdir", (PyCFunction)VimChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
            + {"fchdir", (PyCFunction)VimFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
            + {"foreach_rtp", VimForeachRTP, METH_VARARGS, "Call given callable for each path in &rtp"},
            +#if PY_MAJOR_VERSION < 3
            + {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"},
            + {"load_module", LoaderLoadModule, METH_VARARGS, "Internal use only, tries importing the given module from &rtp by temporary mocking sys.path (to an rtp-based one) and unsetting sys.meta_path and sys.path_hooks"},
            +#endif
            + {"path_hook", VimPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"},
            + {"_get_paths", (PyCFunction)Vim_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"},
            + { NULL, NULL, 0, NULL}
            };

            /*
            @@ -5036,6 +5189,14 @@
            } CurrentObject;
            static PyTypeObject CurrentType;

            +#if PY_MAJOR_VERSION >= 3
            +typedef struct
            +{
            + PyObject_HEAD
            +} FinderObject;
            +static PyTypeObject FinderType;
            +#endif
            +
            static void
            init_structs(void)
            {
            @@ -5281,6 +5442,81 @@
            PYTYPE_READY(FunctionType);
            PYTYPE_READY(OptionsType);
            PYTYPE_READY(OutputType);
            +#if PY_MAJOR_VERSION >= 3
            + PYTYPE_READY(FinderType);
            +#endif
            + return 0;
            +}
            +
            + static int
            +init_sys_path()
            +{
            + PyObject *path;
            + PyObject *path_hook;
            + PyObject *path_hooks;
            +
            + if (!(path_hook = PyObject_GetAttrString(vim_module, "path_hook")))
            + return -1;
            +
            + if (!(path_hooks = PySys_GetObject("path_hooks")))
            + {
            + PyErr_Clear();
            + path_hooks = PyList_New(1);
            + PyList_SET_ITEM(path_hooks, 0, path_hook);
            + if (PySys_SetObject("path_hooks", path_hooks))
            + {
            + Py_DECREF(path_hooks);
            + return -1;
            + }
            + Py_DECREF(path_hooks);
            + }
            + else if (PyList_Check(path_hooks))
            + {
            + if (PyList_Append(path_hooks, path_hook))
            + {
            + Py_DECREF(path_hook);
            + return -1;
            + }
            + Py_DECREF(path_hook);
            + }
            + else
            + {
            + VimTryStart();
            + EMSG(_("Failed to set path hook: sys.path_hooks is not a list\n"
            + "You should now do the following:\n"
            + "- append vim.path_hook to sys.path_hooks\n"
            + "- append vim.VIM_SPECIAL_PATH to sys.path\n"));
            + VimTryEnd(); /* Discard the error */
            + Py_DECREF(path_hook);
            + return 0;
            + }
            +
            + if (!(path = PySys_GetObject("path")))
            + {
            + PyErr_Clear();
            + path = PyList_New(1);
            + Py_INCREF(vim_special_path_object);
            + PyList_SET_ITEM(path, 0, vim_special_path_object);
            + if (PySys_SetObject("path", path))
            + {
            + Py_DECREF(path);
            + return -1;
            + }
            + Py_DECREF(path);
            + }
            + else if (PyList_Check(path))
            + {
            + if (PyList_Append(path, vim_special_path_object))
            + return -1;
            + }
            + else
            + {
            + VimTryStart();
            + EMSG(_("Failed to set path: sys.path is not a list\n"
            + "You should now append vim.VIM_SPECIAL_PATH to sys.path"));
            + VimTryEnd(); /* Discard the error */
            + }
            +
            return 0;
            }

            @@ -5332,6 +5568,9 @@
            {"List", (PyObject *)&ListType},
            {"Function", (PyObject *)&FunctionType},
            {"Options", (PyObject *)&OptionsType},
            +#if PY_MAJOR_VERSION >= 3
            + {"Finder", (PyObject *)&FinderType},
            +#endif
            };

            typedef int (*object_adder)(PyObject *, const char *, PyObject *);
            @@ -5354,10 +5593,6 @@
            {
            int i;
            PyObject *other_module;
            - PyObject *path_hooks;
            - PyObject *path;
            - PyObject *pathObject;
            - PyObject *path_hook;
            PyObject *attr;

            for (i = 0; i < (int)(sizeof(numeric_constants)
            @@ -5421,5 +5656,17 @@
            else
            PyErr_Clear();

            + if (!(vim_special_path_object = PyString_FromString(vim_special_path)))
            + return -1;
            +
            + ADD_OBJECT(m, "VIM_SPECIAL_PATH", vim_special_path_object);
            +
            +#if PY_MAJOR_VERSION >= 3
            + ADD_OBJECT(m, "_PathFinder", path_finder);
            + ADD_CHECKED_OBJECT(m, "_find_module",
            + (py_find_module = PyObject_GetAttrString(path_finder,
            + "find_module")));
            +#endif
            +
            return 0;
            }
            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/if_python.c
            --- a/src/if_python.c Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/if_python.c Sun Jun 09 13:13:35 2013 +0400
            @@ -165,6 +165,7 @@
            # define PyErr_SetNone dll_PyErr_SetNone
            # define PyErr_SetString dll_PyErr_SetString
            # define PyErr_SetObject dll_PyErr_SetObject
            +# define PyErr_ExceptionMatches dll_PyErr_ExceptionMatches
            # define PyEval_InitThreads dll_PyEval_InitThreads
            # define PyEval_RestoreThread dll_PyEval_RestoreThread
            # define PyEval_SaveThread dll_PyEval_SaveThread
            @@ -181,6 +182,7 @@
            # define PyLong_Type (*dll_PyLong_Type)
            # define PyList_GetItem dll_PyList_GetItem
            # define PyList_Append dll_PyList_Append
            +# define PyList_Insert dll_PyList_Insert
            # define PyList_New dll_PyList_New
            # define PyList_SetItem dll_PyList_SetItem
            # define PyList_Size dll_PyList_Size
            @@ -230,6 +232,7 @@
            # define PyFloat_Type (*dll_PyFloat_Type)
            # define PyImport_AddModule (*dll_PyImport_AddModule)
            # define PySys_SetObject dll_PySys_SetObject
            +# define PySys_GetObject dll_PySys_GetObject
            # define PySys_SetArgv dll_PySys_SetArgv
            # define PyType_Type (*dll_PyType_Type)
            # define PyType_Ready (*dll_PyType_Ready)
            @@ -302,6 +305,7 @@
            static void(*dll_PyErr_SetNone)(PyObject *);
            static void(*dll_PyErr_SetString)(PyObject *, const char *);
            static void(*dll_PyErr_SetObject)(PyObject *, PyObject *);
            +static int(*dll_PyErr_ExceptionMatches)(PyObject *);
            static void(*dll_PyEval_InitThreads)(void);
            static void(*dll_PyEval_RestoreThread)(PyThreadState *);
            static PyThreadState*(*dll_PyEval_SaveThread)(void);
            @@ -317,7 +321,8 @@
            static PyTypeObject* dll_PyInt_Type;
            static PyTypeObject* dll_PyLong_Type;
            static PyObject*(*dll_PyList_GetItem)(PyObject *, PyInt);
            -static PyObject*(*dll_PyList_Append)(PyObject *, PyObject *);
            +static int(*dll_PyList_Append)(PyObject *, PyObject *);
            +static int(*dll_PyList_Insert)(PyObject *, int, PyObject *);
            static PyObject*(*dll_PyList_New)(PyInt size);
            static int(*dll_PyList_SetItem)(PyObject *, PyInt, PyObject *);
            static PyInt(*dll_PyList_Size)(PyObject *);
            @@ -363,6 +368,7 @@
            static PyObject*(*dll_PyFloat_FromDouble)(double);
            static PyTypeObject* dll_PyFloat_Type;
            static int(*dll_PySys_SetObject)(char *, PyObject *);
            +static PyObject *(*dll_PySys_GetObject)(char *);
            static int(*dll_PySys_SetArgv)(int, char **);
            static PyTypeObject* dll_PyType_Type;
            static int (*dll_PyType_Ready)(PyTypeObject *type);
            @@ -428,6 +434,7 @@
            static PyObject *imp_PyExc_TypeError;
            static PyObject *imp_PyExc_ValueError;
            static PyObject *imp_PyExc_RuntimeError;
            +static PyObject *imp_PyExc_ImportError;

            # define PyExc_AttributeError imp_PyExc_AttributeError
            # define PyExc_IndexError imp_PyExc_IndexError
            @@ -436,6 +443,7 @@
            # define PyExc_TypeError imp_PyExc_TypeError
            # define PyExc_ValueError imp_PyExc_ValueError
            # define PyExc_RuntimeError imp_PyExc_RuntimeError
            +# define PyExc_ImportError imp_PyExc_ImportError

            /*
            * Table of name to function pointer of python.
            @@ -468,6 +476,7 @@
            {"PyErr_SetNone", (PYTHON_PROC*)&dll_PyErr_SetNone},
            {"PyErr_SetString", (PYTHON_PROC*)&dll_PyErr_SetString},
            {"PyErr_SetObject", (PYTHON_PROC*)&dll_PyErr_SetObject},
            + {"PyErr_ExceptionMatches", (PYTHON_PROC*)&dll_PyErr_ExceptionMatches},
            {"PyEval_InitThreads", (PYTHON_PROC*)&dll_PyEval_InitThreads},
            {"PyEval_RestoreThread", (PYTHON_PROC*)&dll_PyEval_RestoreThread},
            {"PyEval_SaveThread", (PYTHON_PROC*)&dll_PyEval_SaveThread},
            @@ -484,6 +493,7 @@
            {"PyLong_Type", (PYTHON_PROC*)&dll_PyLong_Type},
            {"PyList_GetItem", (PYTHON_PROC*)&dll_PyList_GetItem},
            {"PyList_Append", (PYTHON_PROC*)&dll_PyList_Append},
            + {"PyList_Insert", (PYTHON_PROC*)&dll_PyList_Insert},
            {"PyList_New", (PYTHON_PROC*)&dll_PyList_New},
            {"PyList_SetItem", (PYTHON_PROC*)&dll_PyList_SetItem},
            {"PyList_Size", (PYTHON_PROC*)&dll_PyList_Size},
            @@ -529,6 +539,7 @@
            {"PyFloat_FromDouble", (PYTHON_PROC*)&dll_PyFloat_FromDouble},
            {"PyImport_AddModule", (PYTHON_PROC*)&dll_PyImport_AddModule},
            {"PySys_SetObject", (PYTHON_PROC*)&dll_PySys_SetObject},
            + {"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject},
            {"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
            {"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
            {"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
            @@ -703,6 +714,7 @@
            imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
            imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
            imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
            + imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError");
            Py_XINCREF(imp_PyExc_AttributeError);
            Py_XINCREF(imp_PyExc_IndexError);
            Py_XINCREF(imp_PyExc_KeyError);
            @@ -710,6 +722,7 @@
            Py_XINCREF(imp_PyExc_TypeError);
            Py_XINCREF(imp_PyExc_ValueError);
            Py_XINCREF(imp_PyExc_RuntimeError);
            + Py_XINCREF(imp_PyExc_ImportError);
            Py_XDECREF(exmod);
            }
            #endif /* DYNAMIC_PYTHON */
            @@ -732,6 +745,10 @@
            static PyObject *ListGetattr(PyObject *, char *);
            static PyObject *FunctionGetattr(PyObject *, char *);

            +static PyObject *LoaderLoadModule(PyObject *, PyObject *);
            +static PyObject *FinderFindModule(PyObject *, PyObject *);
            +static PyObject *VimPathHook(PyObject *, PyObject *);
            +
            #ifndef Py_VISIT
            # define Py_VISIT(obj) visit(obj, arg)
            #endif
            @@ -1356,11 +1373,117 @@
            }
            #endif

            + static PyObject *
            +LoaderLoadModule(PyObject *self, PyObject *args)
            +{
            + char *fullname;
            + PyObject *path;
            + PyObject *meta_path;
            + PyObject *path_hooks;
            + PyObject *new_path;
            + PyObject *r;
            + PyObject *new_list;
            +
            + if (!PyArg_ParseTuple(args, "s", &fullname))
            + return NULL;
            +
            + if (!(new_path = Vim_GetPaths(self)))
            + return NULL;
            +
            + if (!(new_list = PyList_New(0)))
            + return NULL;
            +
            +#define GET_SYS_OBJECT(objstr, obj) \
            + obj = PySys_GetObject(objstr); \
            + PyErr_Clear(); \
            + Py_XINCREF(obj);
            +
            + GET_SYS_OBJECT("meta_path", meta_path);
            + if (PySys_SetObject("meta_path", new_list))
            + {
            + Py_XDECREF(meta_path);
            + Py_DECREF(new_list);
            + return NULL;
            + }
            + Py_DECREF(new_list); /* Now it becomes a reference borrowed from
            + sys.meta_path */
            +
            +#define RESTORE_SYS_OBJECT(objstr, obj) \
            + if (obj) \
            + { \
            + PySys_SetObject(objstr, obj); \
            + Py_DECREF(obj); \
            + }
            +
            + GET_SYS_OBJECT("path_hooks", path_hooks);
            + if (PySys_SetObject("path_hooks", new_list))
            + {
            + RESTORE_SYS_OBJECT("meta_path", meta_path);
            + Py_XDECREF(path_hooks);
            + return NULL;
            + }
            +
            + GET_SYS_OBJECT("path", path);
            + if (PySys_SetObject("path", new_path))
            + {
            + RESTORE_SYS_OBJECT("meta_path", meta_path);
            + RESTORE_SYS_OBJECT("path_hooks", path_hooks);
            + Py_XDECREF(path);
            + return NULL;
            + }
            + Py_DECREF(new_path);
            +
            + r = PyImport_ImportModule(fullname);
            +
            + RESTORE_SYS_OBJECT("meta_path", meta_path);
            + RESTORE_SYS_OBJECT("path_hooks", path_hooks);
            + RESTORE_SYS_OBJECT("path", path);
            +
            + if (PyErr_Occurred())
            + {
            + Py_XDECREF(r);
            + return NULL;
            + }
            +
            + return r;
            +}
            +
            + static PyObject *
            +FinderFindModule(PyObject *self UNUSED, PyObject *args UNUSED)
            +{
            + /*
            + * Don't bother actually finding the module, it is delegated to the "loader"
            + * object (which is basically the same object: vim module).
            + */
            + Py_INCREF(vim_module);
            + return vim_module;
            +}
            +
            + static PyObject *
            +VimPathHook(PyObject *self UNUSED, PyObject *args)
            +{
            + char *path;
            +
            + if (PyArg_ParseTuple(args, "s", &path)
            + && STRCMP(path, vim_special_path) == 0)
            + {
            + Py_INCREF(vim_module);
            + return vim_module;
            + }
            +
            + PyErr_Clear();
            + PyErr_SetNone(PyExc_ImportError);
            + return NULL;
            +}
            +
            static int
            PythonMod_Init(void)
            {
            - PyObject *mod;
            - PyObject *dict;
            + PyObject *mod;
            + PyObject *dict;
            + PyObject *path_hooks;
            + PyObject *path;
            + PyObject *path_hook;

            /* The special value is removed from sys.path in Python_Init(). */
            static char *(argv[2]) = {"/must>not&exist/foo", NULL};
            @@ -1371,10 +1494,17 @@
            /* Set sys.argv[] to avoid a crash in warn(). */
            PySys_SetArgv(1, argv);

            - mod = Py_InitModule4("vim", VimMethods, (char *)NULL, (PyObject *)NULL,
            - PYTHON_API_VERSION);
            + vim_module = Py_InitModule4("vim", VimMethods, (char *)NULL,
            + (PyObject *)NULL, PYTHON_API_VERSION);

            - return populate_module(mod, PyModule_AddObject, PyObject_GetAttrString);
            + if (populate_module(vim_module, PyModule_AddObject,
            + PyObject_GetAttrString))
            + return -1;
            +
            + if (init_sys_path())
            + return -1;
            +
            + return 0;
            }

            /*************************************************************************
            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/if_python3.c
            --- a/src/if_python3.c Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/if_python3.c Sun Jun 09 13:13:35 2013 +0400
            @@ -135,6 +135,7 @@
            # define PyErr_SetNone py3_PyErr_SetNone
            # define PyErr_SetString py3_PyErr_SetString
            # define PyErr_SetObject py3_PyErr_SetObject
            +# define PyErr_ExceptionMatches py3_PyErr_ExceptionMatches
            # define PyEval_InitThreads py3_PyEval_InitThreads
            # define PyEval_RestoreThread py3_PyEval_RestoreThread
            # define PyEval_SaveThread py3_PyEval_SaveThread
            @@ -144,6 +145,7 @@
            # define PyLong_FromLong py3_PyLong_FromLong
            # define PyList_GetItem py3_PyList_GetItem
            # define PyList_Append py3_PyList_Append
            +# define PyList_Insert py3_PyList_Insert
            # define PyList_New py3_PyList_New
            # define PyList_SetItem py3_PyList_SetItem
            # define PyList_Size py3_PyList_Size
            @@ -178,6 +180,7 @@
            # define PyEval_GetLocals py3_PyEval_GetLocals
            # define PyEval_GetGlobals py3_PyEval_GetGlobals
            # define PySys_SetObject py3_PySys_SetObject
            +# define PySys_GetObject py3_PySys_GetObject
            # define PySys_SetArgv py3_PySys_SetArgv
            # define PyType_Ready py3_PyType_Ready
            #undef Py_BuildValue
            @@ -269,7 +272,9 @@
            static PyGILState_STATE (*py3_PyGILState_Ensure)(void);
            static void (*py3_PyGILState_Release)(PyGILState_STATE);
            static int (*py3_PySys_SetObject)(char *, PyObject *);
            -static PyObject* (*py3_PyList_Append)(PyObject *, PyObject *);
            +static PyObject* (*py3_PySys_GetObject)(char *);
            +static int (*py3_PyList_Append)(PyObject *, PyObject *);
            +static int (*py3_PyList_Insert)(PyObject *, int, PyObject *);
            static Py_ssize_t (*py3_PyList_Size)(PyObject *);
            static int (*py3_PySequence_Check)(PyObject *);
            static Py_ssize_t (*py3_PySequence_Size)(PyObject *);
            @@ -285,6 +290,7 @@
            static void (*py3_Py_Finalize)(void);
            static void (*py3_PyErr_SetString)(PyObject *, const char *);
            static void (*py3_PyErr_SetObject)(PyObject *, PyObject *);
            +static int (*py3_PyErr_ExceptionMatches)(PyObject *);
            static int (*py3_PyRun_SimpleString)(char *);
            static PyObject* (*py3_PyRun_String)(char *, int, PyObject *, PyObject *);
            static PyObject* (*py3_PyObject_GetAttrString)(PyObject *, const char *);
            @@ -394,6 +400,7 @@
            static PyObject *p3imp_PyExc_TypeError;
            static PyObject *p3imp_PyExc_ValueError;
            static PyObject *p3imp_PyExc_RuntimeError;
            +static PyObject *p3imp_PyExc_ImportError;

            # define PyExc_AttributeError p3imp_PyExc_AttributeError
            # define PyExc_IndexError p3imp_PyExc_IndexError
            @@ -402,6 +409,7 @@
            # define PyExc_TypeError p3imp_PyExc_TypeError
            # define PyExc_ValueError p3imp_PyExc_ValueError
            # define PyExc_RuntimeError p3imp_PyExc_RuntimeError
            +# define PyExc_ImportError p3imp_PyExc_ImportError

            /*
            * Table of name to function pointer of python.
            @@ -429,7 +437,9 @@
            {"PyGILState_Ensure", (PYTHON_PROC*)&py3_PyGILState_Ensure},
            {"PyGILState_Release", (PYTHON_PROC*)&py3_PyGILState_Release},
            {"PySys_SetObject", (PYTHON_PROC*)&py3_PySys_SetObject},
            + {"PySys_GetObject", (PYTHON_PROC*)&py3_PySys_GetObject},
            {"PyList_Append", (PYTHON_PROC*)&py3_PyList_Append},
            + {"PyList_Insert", (PYTHON_PROC*)&py3_PyList_Insert},
            {"PyList_Size", (PYTHON_PROC*)&py3_PyList_Size},
            {"PySequence_Check", (PYTHON_PROC*)&py3_PySequence_Check},
            {"PySequence_Size", (PYTHON_PROC*)&py3_PySequence_Size},
            @@ -442,6 +452,7 @@
            {"Py_Finalize", (PYTHON_PROC*)&py3_Py_Finalize},
            {"PyErr_SetString", (PYTHON_PROC*)&py3_PyErr_SetString},
            {"PyErr_SetObject", (PYTHON_PROC*)&py3_PyErr_SetObject},
            + {"PyErr_ExceptionMatches", (PYTHON_PROC*)&py3_PyErr_ExceptionMatches},
            {"PyRun_SimpleString", (PYTHON_PROC*)&py3_PyRun_SimpleString},
            {"PyRun_String", (PYTHON_PROC*)&py3_PyRun_String},
            {"PyObject_GetAttrString", (PYTHON_PROC*)&py3_PyObject_GetAttrString},
            @@ -665,6 +676,7 @@
            p3imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
            p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
            p3imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
            + p3imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError");
            Py_XINCREF(p3imp_PyExc_AttributeError);
            Py_XINCREF(p3imp_PyExc_IndexError);
            Py_XINCREF(p3imp_PyExc_KeyError);
            @@ -672,6 +684,7 @@
            Py_XINCREF(p3imp_PyExc_TypeError);
            Py_XINCREF(p3imp_PyExc_ValueError);
            Py_XINCREF(p3imp_PyExc_RuntimeError);
            + Py_XINCREF(p3imp_PyExc_ImportError);
            Py_XDECREF(exmod);
            }
            #endif /* DYNAMIC_PYTHON3 */
            @@ -724,8 +737,13 @@
            static int ListSetattro(PyObject *, PyObject *, PyObject *);
            static PyObject *FunctionGetattro(PyObject *, PyObject *);

            +static PyObject *VimPathHook(PyObject *, PyObject *);
            +
            static struct PyModuleDef vimmodule;

            +static PyObject *path_finder;
            +static PyObject *py_find_module = NULL;
            +
            #define PY_CAN_RECURSE

            /*
            @@ -1586,12 +1604,71 @@
            #endif

            static PyObject *
            +VimPathHook(PyObject *self UNUSED, PyObject *args)
            +{
            + char *path;
            +
            + if (PyArg_ParseTuple(args, "s", &path)
            + && STRCMP(path, vim_special_path) == 0)
            + {
            + Py_INCREF(&FinderType);
            + return (PyObject *) &FinderType;
            + }
            +
            + PyErr_Clear();
            + PyErr_SetNone(PyExc_ImportError);
            + return NULL;
            +}
            +
            + static PyObject *
            +FinderFindModule(PyObject *cls, PyObject *fullname)
            +{
            + PyObject *new_path;
            + PyObject *r;
            +
            + if (!(new_path = Vim_GetPaths(NULL)))
            + return NULL;
            +
            + /* call find_module of the super() class */
            + r = PyObject_CallFunctionObjArgs(py_find_module, fullname, new_path, NULL);
            +
            + Py_DECREF(new_path);
            +
            + return r;
            +}
            +
            +static struct PyMethodDef FinderMethods[] = {
            + {"find_module", FinderFindModule, METH_CLASS|METH_O, ""},
            + {NULL, NULL, 0, NULL}
            +};
            +
            + static PyObject *
            Py3Init_vim(void)
            {
            - PyObject *mod;
            -
            /* The special value is removed from sys.path in Python3_Init(). */
            static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL};
            + PyObject *importlib_machinery;
            + PyObject *path;
            +
            + if (!(importlib_machinery = PyImport_ImportModule("importlib.machinery")))
            + return NULL;
            +
            + if (!(path_finder = PyObject_GetAttrString(importlib_machinery,
            + "PathFinder")))
            + {
            + Py_DECREF(importlib_machinery);
            + return NULL;
            + }
            +
            + Py_DECREF(importlib_machinery);
            +
            + vim_memset(&FinderType, 0, sizeof(FinderObject));
            + FinderType.tp_name = "vim.Finder";
            + FinderType.tp_basicsize = sizeof(FinderObject);
            + FinderType.tp_base = (PyTypeObject *) path_finder;
            + FinderType.tp_flags = Py_TPFLAGS_DEFAULT;
            + FinderType.tp_doc = "Vim finder class, for use with path hook";
            + FinderType.tp_methods = FinderMethods;

            if (init_types())
            return NULL;
            @@ -1599,14 +1676,16 @@
            /* Set sys.argv[] to avoid a crash in warn(). */
            PySys_SetArgv(1, argv);

            - mod = PyModule_Create(&vimmodule);
            - if (mod == NULL)
            + if ((vim_module = PyModule_Create(&vimmodule)) == NULL)
            return NULL;

            - if (populate_module(mod, PyModule_AddObject, PyObject_GetAttrString))
            + if (populate_module(vim_module, PyModule_AddObject, PyObject_GetAttrString))
            return NULL;

            - return mod;
            + if (init_sys_path())
            + return NULL;
            +
            + return vim_module;
            }

            /*************************************************************************
            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/testdir/test86.in
            --- a/src/testdir/test86.in Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/testdir/test86.in Sun Jun 09 13:13:35 2013 +0400
            @@ -1069,6 +1069,14 @@
            ee('vim.current.xxx = True')
            EOF
            :"
            +:" Test import
            +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 exceptions
            :fun Exe(e)
            : execute a:e
            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/testdir/test86.ok
            --- a/src/testdir/test86.ok Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/testdir/test86.ok Sun Jun 09 13:13:35 2013 +0400
            @@ -1083,6 +1083,7 @@
            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
            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 a40ac5f7feca -r b40bfa1c4ff1 src/testdir/test87.in
            --- a/src/testdir/test87.in Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/testdir/test87.in Sun Jun 09 13:13:35 2013 +0400
            @@ -1036,6 +1036,14 @@
            ee('vim.current.xxx = True')
            EOF
            :"
            +:" Test import
            +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 exceptions
            :fun Exe(e)
            : execute a:e
            diff -r a40ac5f7feca -r b40bfa1c4ff1 src/testdir/test87.ok
            --- a/src/testdir/test87.ok Sat Jun 08 14:40:53 2013 +0400
            +++ b/src/testdir/test87.ok Sun Jun 09 13:13:35 2013 +0400
            @@ -1092,6 +1092,7 @@
            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
            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 vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Bram Moolenaar
            ... I have included this patch. However, the newly added test lines fail. I get no output. For both Python 2.7.3 and Python 3.2.3 -- Amazing but true: If all
            Message 5 of 26 , Jun 10, 2013
            View Source
            • 0 Attachment
              ZyX wrote:

              > # HG changeset patch
              > # User ZyX <kp-pav@...>
              > # Date 1370769215 -14400
              > # Sun Jun 09 13:13:35 2013 +0400
              > # Branch python-path
              > # Node ID b40bfa1c4ff1b7b272bc2394a2ca44fa940c75de
              > # Parent a40ac5f7feca2a9af9c6d1eb0f746b7e01da7d10
              > Implement _vim_runtimepath_, as discussed in the mailing list
              >
              > See documentation for detailed description

              I have included this patch. However, the newly added test lines fail.
              I get no output. For both Python 2.7.3 and Python 3.2.3

              --
              Amazing but true: If all the salmon caught in Canada in one year were laid
              end to end across the Sahara Desert, the smell would be absolutely awful.

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --
              --
              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 vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • ZyX
              Sorry, forgot to hg add new files: # HG changeset patch # User ZyX # Date 1370895106 -14400 # Tue Jun 11 00:11:46 2013 +0400 # Branch
              Message 6 of 26 , Jun 10, 2013
              View Source
              • 0 Attachment
                Sorry, forgot to hg add new files:

                # HG changeset patch
                # User ZyX <kp-pav@...>
                # Date 1370895106 -14400
                # Tue Jun 11 00:11:46 2013 +0400
                # Branch python-path
                # Node ID 7fda29626053270e0a60b7ec57168b74081c5472
                # Parent 88b44813388439835b147bdccba707b3bf696c72
                Add missing modules for tests; also ignore python cache

                diff -r 88b448133884 -r 7fda29626053 .hgignore
                --- a/.hgignore Mon Jun 10 21:27:29 2013 +0200
                +++ b/.hgignore Tue Jun 11 00:11:46 2013 +0400
                @@ -45,6 +45,7 @@
                *.swp
                *~
                src/po/vim.pot
                +*.pyc

                # Generated by "make test"
                src/po/*.ck
                diff -r 88b448133884 -r 7fda29626053 src/testdir/python2/module.py
                --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                +++ b/src/testdir/python2/module.py Tue Jun 11 00:11:46 2013 +0400
                @@ -0,0 +1,1 @@
                +dir = '2'
                diff -r 88b448133884 -r 7fda29626053 src/testdir/python3/module.py
                --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                +++ b/src/testdir/python3/module.py Tue Jun 11 00:11:46 2013 +0400
                @@ -0,0 +1,1 @@
                +dir = '3'
                diff -r 88b448133884 -r 7fda29626053 src/testdir/pythonx/module.py
                --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                +++ b/src/testdir/pythonx/module.py Tue Jun 11 00:11:46 2013 +0400
                @@ -0,0 +1,1 @@
                +dir = 'x'
                diff -r 88b448133884 -r 7fda29626053 src/testdir/pythonx/modulex.py
                --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                +++ b/src/testdir/pythonx/modulex.py Tue Jun 11 00:11:46 2013 +0400
                @@ -0,0 +1,1 @@
                +ddir = 'xx'

                --
                --
                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 vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Bram Moolenaar
                ... Thanks, that works. Did you see the other message, that loading a module the old way stopped working? We should support backwards compatibility, otherwise
                Message 7 of 26 , Jun 11, 2013
                View Source
                • 0 Attachment
                  ZyX wrote:

                  > Sorry, forgot to hg add new files:

                  Thanks, that works.

                  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.


                  --
                  hundred-and-one symptoms of being an internet addict:
                  144. You eagerly await the update of the "Cool Site of the Day."

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                  \\\ an exciting new programming language -- http://www.Zimbu.org ///
                  \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                  --
                  --
                  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 vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • ZyX
                  ... 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
                  Message 8 of 26 , Jun 11, 2013
                  View Source
                  • 0 Attachment
                    > 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 vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  • ZyX
                    ... Problem is not with importing packages, but with second-level import in imported packages: with mocked sys.path import does not work as it does not know
                    Message 9 of 26 , Jun 11, 2013
                    View Source
                    • 0 Attachment
                      > 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:

                      Problem is not with importing packages, but with second-level import in imported packages: with mocked sys.path import does not work as it does not know where to import from.

                      --
                      --
                      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 vim_dev+unsubscribe@....
                      For more options, visit https://groups.google.com/groups/opt_out.
                    • ZyX
                      ... And also problem with me forgetting to change two before to after in place of one. -- -- You received this message from the vim_dev maillist. Do not
                      Message 10 of 26 , Jun 11, 2013
                      View Source
                      • 0 Attachment
                        On Tuesday, June 11, 2013 8:45:04 PM UTC+4, ZyX wrote:
                        > > 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:
                        >
                        > Problem is not with importing packages, but with second-level import in imported packages: with mocked sys.path import does not work as it does not know where to import from.

                        And also problem with me forgetting to change two "before" to "after" in place of one.

                        --
                        --
                        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 vim_dev+unsubscribe@....
                        For more options, visit https://groups.google.com/groups/opt_out.
                      • ZyX
                        ... This variant of tests *fails* as expected with test86.in (not with test87.in), though it should not: diff -r 7fda29626053 src/testdir/python_after/after.py
                        Message 11 of 26 , Jun 11, 2013
                        View Source
                        • 0 Attachment
                          On Tuesday, June 11, 2013 8:49:11 PM UTC+4, ZyX wrote:
                          > On Tuesday, June 11, 2013 8:45:04 PM UTC+4, ZyX wrote:
                          > > > 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:
                          > >
                          > > Problem is not with importing packages, but with second-level import in imported packages: with mocked sys.path import does not work as it does not know where to import from.
                          >
                          > And also problem with me forgetting to change two "before" to "after" in place of one.

                          This variant of tests *fails* as expected with test86.in (not with test87.in), though it should not:

                          diff -r 7fda29626053 src/testdir/python_after/after.py
                          --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                          +++ b/src/testdir/python_after/after.py Tue Jun 11 20:51:50 2013 +0400
                          @@ -0,0 +1,2 @@
                          +import before
                          +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:51:50 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:51:50 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:51:50 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:51:50 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:51:50 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 vim_dev+unsubscribe@....
                          For more options, visit https://groups.google.com/groups/opt_out.
                        • Bram Moolenaar
                          ... This should probably have been python_after. Anyway, in the other message you mention that the problem is with package initialization, not with directly
                          Message 12 of 26 , Jun 11, 2013
                          View Source
                          • 0 Attachment
                            ZyX wrote:

                            > > 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

                            This should probably have been python_after.

                            Anyway, in the other message you mention that the problem is with
                            package initialization, not with directly loaded files as in this test.
                            Right?


                            --
                            We are the Borg of GNU GPL. We will assimilate your source code.
                            Resistance is futile.

                            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                            \\\ an exciting new programming language -- http://www.Zimbu.org ///
                            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                            --
                            --
                            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 vim_dev+unsubscribe@....
                            For more options, visit https://groups.google.com/groups/opt_out.
                          • Nikolay Pavlov
                            ... stopped ... Should be so. Though further investigation shows that python stops loading modules after vim.VIM_SPECIAL_DIRECTORY *after* that problem is
                            Message 13 of 26 , Jun 11, 2013
                            View Source
                            • 0 Attachment


                              On Jun 11, 2013 9:53 PM, "Bram Moolenaar" <Bram@...> wrote:
                              >
                              >
                              > ZyX wrote:
                              >
                              > > > 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
                              >
                              > This should probably have been python_after.
                              >
                              > Anyway, in the other message you mention that the problem is with
                              > package initialization, not with directly loaded files as in this test.
                              > Right?

                              Should be so. Though further investigation shows that python stops loading modules after vim.VIM_SPECIAL_DIRECTORY *after* that problem is solved, thus there must be two problems. I already have solution for the first, but not for the second.

                              > --
                              > We are the Borg of GNU GPL.  We will assimilate your source code.
                              > Resistance is futile.
                              >
                              >  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
                              > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                              > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
                              >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

                              --
                              --
                              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 vim_dev+unsubscribe@....
                              For more options, visit https://groups.google.com/groups/opt_out.
                               
                               
                            • Bram Moolenaar
                              ... Unfortunately test87 now fails for me. I thought I verified it passed before I sent out patch 7.3.1166. ... Traceback (most recent call last): File
                              Message 14 of 26 , Jun 11, 2013
                              View Source
                              • 0 Attachment
                                ZyX wrote:

                                > On Jun 11, 2013 9:53 PM, "Bram Moolenaar" <Bram@...> wrote:
                                > >
                                > >
                                > > ZyX wrote:
                                > >
                                > > > > 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
                                > >
                                > > This should probably have been python_after.
                                > >
                                > > Anyway, in the other message you mention that the problem is with
                                > > package initialization, not with directly loaded files as in this test.
                                > > Right?
                                >
                                > Should be so. Though further investigation shows that python stops loading
                                > modules after vim.VIM_SPECIAL_DIRECTORY *after* that problem is solved,
                                > thus there must be two problems. I already have solution for the first, but
                                > not for the second.

                                Unfortunately test87 now fails for me. I thought I verified it passed
                                before I sent out patch 7.3.1166.

                                Trying the commands by hand I get:

                                :py3 from module import dir as d
                                Traceback (most recent call last):
                                File "<string>", line 1, in <module>
                                ImportError: No module named module

                                'runtimepath' appears to be set correctly.

                                Test 86 does pass.

                                --
                                hundred-and-one symptoms of being an internet addict:
                                153. You find yourself staring at your "inbox" waiting for new e-mail
                                to arrive.

                                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                --
                                --
                                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 vim_dev+unsubscribe@....
                                For more options, visit https://groups.google.com/groups/opt_out.
                              • ZyX
                                # HG changeset patch # User ZyX # Date 1371034574 -14400 # Wed Jun 12 14:56:14 2013 +0400 # Branch python-path # Node ID
                                Message 15 of 26 , Jun 12, 2013
                                View Source
                                • 0 Attachment
                                  # HG changeset patch
                                  # User ZyX <kp-pav@...>
                                  # Date 1371034574 -14400
                                  # Wed Jun 12 14:56:14 2013 +0400
                                  # Branch python-path
                                  # Node ID a1b8a5ddecec70085e7e62f8ea9bc6c46ecea530
                                  # Parent c37e77761d00748eec028883e5a6f999d50c3479
                                  Fix for python2

                                  Python-3 now fails like it failed previously: on python-3.2.
                                  Python-3.3 is fine.

                                  diff -r c37e77761d00 -r a1b8a5ddecec runtime/doc/if_pyth.txt
                                  --- a/runtime/doc/if_pyth.txt Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/runtime/doc/if_pyth.txt Wed Jun 12 14:56:14 2013 +0400
                                  @@ -315,52 +315,53 @@
                                  {rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
                                  each {rtp} found in 'runtimepath'.

                                  -Implementation for python 2 is the following: usual importing code with empty
                                  -lists in place of sys.path_hooks and sys.meta_path. Code is similar to the
                                  -below, but written in C: >
                                  +Implementation for python 2 is similar to the following, but written in C: >

                                  - # Assuming vim variable is already accessible and is set to the current
                                  - # module
                                  + from imp import find_module, load_module
                                  + import vim
                                  import sys

                                  - def find_module(fullname):
                                  - return vim
                                  + class VimModuleLoader(object):
                                  + def __init__(self, module):
                                  + self.module = module

                                  - def load_module(fullname):
                                  - # see vim._get_paths below
                                  - new_path = _get_paths()
                                  + def load_module(self, fullname, path=None):
                                  + return self.module

                                  - try: old_path = sys.path
                                  - except: pass
                                  - try: old_meta_path = sys.meta_path
                                  - except: pass
                                  - try: old_path_hooks = sys.path_hooks
                                  - except: pass
                                  + def _find_module(fullname, oldtail, path):
                                  + idx = oldtail.find('.')
                                  + if idx > 0:
                                  + name = oldtail[:idx]
                                  + tail = oldtail[idx+1:]
                                  + fmr = find_module(name, path)
                                  + module = load_module(fullname[:-len(oldtail)] + name, *fmr)
                                  + return _find_module(fullname, tail, module.__path__)
                                  + else:
                                  + fmr = find_module(fullname, path)
                                  + return load_module(fullname, *fmr)

                                  - sys.meta_path = []
                                  - sys.path_hooks = sys.meta_path
                                  - sys.path = new_path
                                  + # It uses vim module itself in place of VimPathFinder class: it does not
                                  + # matter for python which object has find_module function attached to as
                                  + # an attribute.
                                  + class VimPathFinder(object):
                                  + def find_module(cls, fullname, path=None):
                                  + try:
                                  + return VimModuleLoader(_find_module(fullname, fullname, path or vim._get_paths()))
                                  + except ImportError:
                                  + return None
                                  + find_module = classmethod(find_module)

                                  - try:
                                  - exec ('import ' + fullname + ' as m') # No actual exec in C code
                                  - return m
                                  - finally:
                                  - e = None
                                  - try: sys.path = old_path
                                  - except Exception as e: pass
                                  - try: sys.meta_path = old_meta_path
                                  - except Exception as e: pass
                                  - try: sys.path_hooks = old_path_hooks
                                  - except Exception as e: pass
                                  - if e:
                                  - raise e
                                  + def load_module(cls, fullname, path=None):
                                  + return _find_module(fullname, fullname, path or vim._get_paths())
                                  + load_module = classmethod(load_module)

                                  - def path_hook(d):
                                  - if d == VIM_SPECIAL_PATH:
                                  - return vim
                                  - raise ImportError
                                  + def hook(path):
                                  + if path == vim.VIM_SPECIAL_PATH:
                                  + return VimPathFinder
                                  + else:
                                  + raise ImportError

                                  - sys.path_hooks.append(path_hook)
                                  + sys.path_hooks.append(hook)

                                  Implementation for python 3 is cleaner: code is similar to the following, but,
                                  again, written in C: >
                                  @@ -395,14 +396,13 @@
                                  Note: you must not use value of this constant directly, always use
                                  vim.VIM_SPECIAL_PATH object.

                                  -vim.load_module(name) *python-load_module*
                                  vim.find_module(...) *python-find_module*
                                  vim.path_hook(path) *python-path_hook*
                                  Methods or objects used to implement path loading as described above.
                                  You should not be using any of these directly except for vim.path_hook
                                  in case you need to do something with sys.meta_path. It is not
                                  guaranteed that any of the objects will exist in the future vim
                                  - versions. In fact, load_module and find_module methods do not exists
                                  + versions. In fact, find_module methods do not exists
                                  in python3.

                                  vim._get_paths *python-_get_paths*
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/if_py_both.h
                                  --- a/src/if_py_both.h Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/if_py_both.h Wed Jun 12 14:56:14 2013 +0400
                                  @@ -940,7 +940,6 @@
                                  {"foreach_rtp", VimForeachRTP, METH_VARARGS, "Call given callable for each path in &rtp"},
                                  #if PY_MAJOR_VERSION < 3
                                  {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"},
                                  - {"load_module", LoaderLoadModule, METH_VARARGS, "Internal use only, tries importing the given module from &rtp by temporary mocking sys.path (to an rtp-based one) and unsetting sys.meta_path and sys.path_hooks"},
                                  #endif
                                  {"path_hook", VimPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"},
                                  {"_get_paths", (PyCFunction)Vim_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"},
                                  @@ -5195,6 +5194,13 @@
                                  PyObject_HEAD
                                  } FinderObject;
                                  static PyTypeObject FinderType;
                                  +#else
                                  +typedef struct
                                  +{
                                  + PyObject_HEAD
                                  + PyObject *module;
                                  +} LoaderObject;
                                  +static PyTypeObject LoaderType;
                                  #endif

                                  static void
                                  @@ -5444,6 +5450,8 @@
                                  PYTYPE_READY(OutputType);
                                  #if PY_MAJOR_VERSION >= 3
                                  PYTYPE_READY(FinderType);
                                  +#else
                                  + PYTYPE_READY(LoaderType);
                                  #endif
                                  return 0;
                                  }
                                  @@ -5570,6 +5578,8 @@
                                  {"Options", (PyObject *)&OptionsType},
                                  #if PY_MAJOR_VERSION >= 3
                                  {"Finder", (PyObject *)&FinderType},
                                  +#else
                                  + {"Loader", (PyObject *)&LoaderType},
                                  #endif
                                  };

                                  @@ -5666,6 +5676,9 @@
                                  ADD_CHECKED_OBJECT(m, "_find_module",
                                  (py_find_module = PyObject_GetAttrString(path_finder,
                                  "find_module")));
                                  +#else
                                  + ADD_OBJECT(m, "_find_module", py_find_module);
                                  + ADD_OBJECT(m, "_load_module", py_load_module);
                                  #endif

                                  return 0;
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/if_python.c
                                  --- a/src/if_python.c Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/if_python.c Wed Jun 12 14:56:14 2013 +0400
                                  @@ -150,6 +150,7 @@
                                  # undef Py_InitModule4
                                  # undef Py_InitModule4_64
                                  # undef PyObject_CallMethod
                                  +# undef PyObject_CallFunction

                                  /*
                                  * Wrapper defines
                                  @@ -219,6 +220,7 @@
                                  # define PyObject_HasAttrString dll_PyObject_HasAttrString
                                  # define PyObject_SetAttrString dll_PyObject_SetAttrString
                                  # define PyObject_CallFunctionObjArgs dll_PyObject_CallFunctionObjArgs
                                  +# define PyObject_CallFunction dll_PyObject_CallFunction
                                  # define PyObject_Call dll_PyObject_Call
                                  # define PyString_AsString dll_PyString_AsString
                                  # define PyString_AsStringAndSize dll_PyString_AsStringAndSize
                                  @@ -357,6 +359,7 @@
                                  static int (*dll_PyObject_HasAttrString)(PyObject *, const char *);
                                  static PyObject* (*dll_PyObject_SetAttrString)(PyObject *, const char *, PyObject *);
                                  static PyObject* (*dll_PyObject_CallFunctionObjArgs)(PyObject *, ...);
                                  +static PyObject* (*dll_PyObject_CallFunction)(PyObject *, char *, ...);
                                  static PyObject* (*dll_PyObject_Call)(PyObject *, PyObject *, PyObject *);
                                  static char*(*dll_PyString_AsString)(PyObject *);
                                  static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *);
                                  @@ -528,6 +531,7 @@
                                  {"PyObject_HasAttrString", (PYTHON_PROC*)&dll_PyObject_HasAttrString},
                                  {"PyObject_SetAttrString", (PYTHON_PROC*)&dll_PyObject_SetAttrString},
                                  {"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&dll_PyObject_CallFunctionObjArgs},
                                  + {"PyObject_CallFunction", (PYTHON_PROC*)&dll_PyObject_CallFunction},
                                  {"PyObject_Call", (PYTHON_PROC*)&dll_PyObject_Call},
                                  {"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString},
                                  {"PyString_AsStringAndSize", (PYTHON_PROC*)&dll_PyString_AsStringAndSize},
                                  @@ -748,10 +752,12 @@
                                  static PyObject *ListGetattr(PyObject *, char *);
                                  static PyObject *FunctionGetattr(PyObject *, char *);

                                  -static PyObject *LoaderLoadModule(PyObject *, PyObject *);
                                  static PyObject *FinderFindModule(PyObject *, PyObject *);
                                  static PyObject *VimPathHook(PyObject *, PyObject *);

                                  +static PyObject *py_find_module;
                                  +static PyObject *py_load_module;
                                  +
                                  #ifndef Py_VISIT
                                  # define Py_VISIT(obj) visit(obj, arg)
                                  #endif
                                  @@ -1376,16 +1382,128 @@
                                  }
                                  #endif

                                  + static void
                                  +LoaderDestructor(LoaderObject *self)
                                  +{
                                  + Py_DECREF(self->module);
                                  + DESTRUCTOR_FINISH(self);
                                  +}
                                  +
                                  static PyObject *
                                  -LoaderLoadModule(PyObject *self, PyObject *args)
                                  +LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED)
                                  +{
                                  + PyObject *r = self->module;
                                  +
                                  + Py_INCREF(r);
                                  + return r;
                                  +}
                                  +
                                  +static struct PyMethodDef LoaderMethods[] = {
                                  + /* name, function, calling, doc */
                                  + {"load_module", (PyCFunction)LoaderLoadModule, METH_VARARGS, ""},
                                  + { NULL, NULL, 0, NULL}
                                  +};
                                  +
                                  + static PyObject *
                                  +call_load_module(char *name, int len, PyObject *find_module_result)
                                  +{
                                  + PyObject *r;
                                  + PyObject *fd, *pathname, *description;
                                  +
                                  + if (!PyTuple_Check(find_module_result)
                                  + || PyTuple_GET_SIZE(find_module_result) != 3)
                                  + {
                                  + PyErr_SetString(PyExc_TypeError,
                                  + _("expected 3-tuple as imp.find_module() result"));
                                  + return NULL;
                                  + }
                                  +
                                  + if (!(fd = PyTuple_GET_ITEM(find_module_result, 0))
                                  + || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
                                  + || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
                                  + {
                                  + PyErr_SetString(PyExc_RuntimeError,
                                  + _("internal error: imp.find_module returned tuple with NULL"));
                                  + return NULL;
                                  + }
                                  +
                                  + return PyObject_CallFunction(py_load_module,
                                  + "s#OOO", name, len, fd, pathname, description);
                                  +}
                                  +
                                  + static PyObject *
                                  +find_module(char *fullname, char *tail, PyObject *new_path)
                                  +{
                                  + PyObject *find_module_result;
                                  + PyObject *module;
                                  + char *dot;
                                  +
                                  + if ((dot = (char *) vim_strchr((char_u *) tail, '.')))
                                  + {
                                  + /*
                                  + * There is a dot in the name: call find_module recursively without the
                                  + * first component
                                  + */
                                  + PyObject *newest_path;
                                  + int partlen = (int) (dot - 1 - tail);
                                  +
                                  + if (!(find_module_result = PyObject_CallFunction(py_find_module,
                                  + "s#O", tail, partlen, new_path)))
                                  + return NULL;
                                  +
                                  + if (!(module = call_load_module(
                                  + fullname,
                                  + ((int) (tail - fullname)) + partlen,
                                  + find_module_result)))
                                  + {
                                  + Py_DECREF(find_module_result);
                                  + return NULL;
                                  + }
                                  +
                                  + Py_DECREF(find_module_result);
                                  +
                                  + if (!(newest_path = PyObject_GetAttrString(module, "__path__")))
                                  + {
                                  + Py_DECREF(module);
                                  + return NULL;
                                  + }
                                  +
                                  + Py_DECREF(module);
                                  +
                                  + module = find_module(fullname, dot + 1, newest_path);
                                  +
                                  + Py_DECREF(newest_path);
                                  +
                                  + return module;
                                  + }
                                  + else
                                  + {
                                  + if (!(find_module_result = PyObject_CallFunction(py_find_module,
                                  + "sO", tail, new_path)))
                                  + return NULL;
                                  +
                                  + if (!(module = call_load_module(
                                  + fullname,
                                  + STRLEN(fullname),
                                  + find_module_result)))
                                  + {
                                  + Py_DECREF(find_module_result);
                                  + return NULL;
                                  + }
                                  +
                                  + Py_DECREF(find_module_result);
                                  +
                                  + return module;
                                  + }
                                  +}
                                  +
                                  + static PyObject *
                                  +FinderFindModule(PyObject *self, PyObject *args)
                                  {
                                  char *fullname;
                                  - PyObject *path;
                                  - PyObject *meta_path;
                                  - PyObject *path_hooks;
                                  + PyObject *module;
                                  PyObject *new_path;
                                  - PyObject *r;
                                  - PyObject *new_list;
                                  + LoaderObject *loader;

                                  if (!PyArg_ParseTuple(args, "s", &fullname))
                                  return NULL;
                                  @@ -1393,73 +1511,25 @@
                                  if (!(new_path = Vim_GetPaths(self)))
                                  return NULL;

                                  - if (!(new_list = PyList_New(0)))
                                  - return NULL;
                                  + module = find_module(fullname, fullname, new_path);

                                  -#define GET_SYS_OBJECT(objstr, obj) \
                                  - obj = PySys_GetObject(objstr); \
                                  - PyErr_Clear(); \
                                  - Py_XINCREF(obj);
                                  + Py_DECREF(new_path);

                                  - GET_SYS_OBJECT("meta_path", meta_path);
                                  - if (PySys_SetObject("meta_path", new_list))
                                  + if (!module)
                                  {
                                  - Py_XDECREF(meta_path);
                                  - Py_DECREF(new_list);
                                  - return NULL;
                                  - }
                                  - Py_DECREF(new_list); /* Now it becomes a reference borrowed from
                                  - sys.meta_path */
                                  -
                                  -#define RESTORE_SYS_OBJECT(objstr, obj) \
                                  - if (obj) \
                                  - { \
                                  - PySys_SetObject(objstr, obj); \
                                  - Py_DECREF(obj); \
                                  + Py_INCREF(Py_None);
                                  + return Py_None;
                                  }

                                  - GET_SYS_OBJECT("path_hooks", path_hooks);
                                  - if (PySys_SetObject("path_hooks", new_list))
                                  + if (!(loader = PyObject_NEW(LoaderObject, &LoaderType)))
                                  {
                                  - RESTORE_SYS_OBJECT("meta_path", meta_path);
                                  - Py_XDECREF(path_hooks);
                                  + Py_DECREF(module);
                                  return NULL;
                                  }

                                  - GET_SYS_OBJECT("path", path);
                                  - if (PySys_SetObject("path", new_path))
                                  - {
                                  - RESTORE_SYS_OBJECT("meta_path", meta_path);
                                  - RESTORE_SYS_OBJECT("path_hooks", path_hooks);
                                  - Py_XDECREF(path);
                                  - return NULL;
                                  - }
                                  - Py_DECREF(new_path);
                                  + loader->module = module;

                                  - r = PyImport_ImportModule(fullname);
                                  -
                                  - RESTORE_SYS_OBJECT("meta_path", meta_path);
                                  - RESTORE_SYS_OBJECT("path_hooks", path_hooks);
                                  - RESTORE_SYS_OBJECT("path", path);
                                  -
                                  - if (PyErr_Occurred())
                                  - {
                                  - Py_XDECREF(r);
                                  - return NULL;
                                  - }
                                  -
                                  - return r;
                                  -}
                                  -
                                  - static PyObject *
                                  -FinderFindModule(PyObject *self UNUSED, PyObject *args UNUSED)
                                  -{
                                  - /*
                                  - * Don't bother actually finding the module, it is delegated to the "loader"
                                  - * object (which is basically the same object: vim module).
                                  - */
                                  - Py_INCREF(vim_module);
                                  - return vim_module;
                                  + return (PyObject *) loader;
                                  }

                                  static PyObject *
                                  @@ -1483,7 +1553,34 @@
                                  PythonMod_Init(void)
                                  {
                                  /* The special value is removed from sys.path in Python_Init(). */
                                  - static char *(argv[2]) = {"/must>not&exist/foo", NULL};
                                  + static char *(argv[2]) = {"/must>not&exist/foo", NULL};
                                  + PyObject *imp;
                                  +
                                  + if (!(imp = PyImport_ImportModule("imp")))
                                  + return -1;
                                  +
                                  + if (!(py_find_module = PyObject_GetAttrString(imp, "find_module")))
                                  + {
                                  + Py_DECREF(imp);
                                  + return -1;
                                  + }
                                  +
                                  + if (!(py_load_module = PyObject_GetAttrString(imp, "load_module")))
                                  + {
                                  + Py_DECREF(py_find_module);
                                  + Py_DECREF(imp);
                                  + return -1;
                                  + }
                                  +
                                  + Py_DECREF(imp);
                                  +
                                  + vim_memset(&LoaderType, 0, sizeof(LoaderType));
                                  + LoaderType.tp_name = "vim.Loader";
                                  + LoaderType.tp_basicsize = sizeof(LoaderObject);
                                  + LoaderType.tp_flags = Py_TPFLAGS_DEFAULT;
                                  + LoaderType.tp_doc = "vim message object";
                                  + LoaderType.tp_methods = LoaderMethods;
                                  + LoaderType.tp_dealloc = (destructor)LoaderDestructor;

                                  if (init_types())
                                  return -1;
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/python2/module.py
                                  --- a/src/testdir/python2/module.py Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/testdir/python2/module.py Wed Jun 12 14:56:14 2013 +0400
                                  @@ -1,1 +1,2 @@
                                  +import before_1
                                  dir = '2'
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/python3/module.py
                                  --- a/src/testdir/python3/module.py Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/testdir/python3/module.py Wed Jun 12 14:56:14 2013 +0400
                                  @@ -1,1 +1,2 @@
                                  +import before_1
                                  dir = '3'
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/python_after/after.py
                                  --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                                  +++ b/src/testdir/python_after/after.py Wed Jun 12 14:56:14 2013 +0400
                                  @@ -0,0 +1,2 @@
                                  +import before_2
                                  +dir = "after"
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/python_before/before.py
                                  --- /dev/null Thu Jan 01 00:00:00 1970 +0000
                                  +++ b/src/testdir/python_before/before.py Wed Jun 12 14:56:14 2013 +0400
                                  @@ -0,0 +1,1 @@
                                  +dir = "before"
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/test86.in
                                  --- a/src/testdir/test86.in Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/testdir/test86.in Wed Jun 12 14:56:14 2013 +0400
                                  @@ -8,6 +8,7 @@
                                  STARTTEST
                                  :so small.vim
                                  :set encoding=latin1
                                  +:set noswapfile
                                  :if !has('python') | e! test.ok | wq! test.out | endif
                                  :lang C
                                  :py import vim
                                  @@ -1071,10 +1072,16 @@
                                  :"
                                  :" 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
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/test86.ok
                                  --- a/src/testdir/test86.ok Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/testdir/test86.ok Wed Jun 12 14:56:14 2013 +0400
                                  @@ -1084,6 +1084,8 @@
                                  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 c37e77761d00 -r a1b8a5ddecec src/testdir/test87.in
                                  --- a/src/testdir/test87.in Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/testdir/test87.in Wed Jun 12 14:56:14 2013 +0400
                                  @@ -2,6 +2,7 @@

                                  STARTTEST
                                  :so small.vim
                                  +:set noswapfile
                                  :if !has('python3') | e! test.ok | wq! test.out | endif
                                  :lang C
                                  :py3 import vim
                                  @@ -1038,10 +1039,16 @@
                                  :"
                                  :" 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
                                  diff -r c37e77761d00 -r a1b8a5ddecec src/testdir/test87.ok
                                  --- a/src/testdir/test87.ok Tue Jun 11 22:44:09 2013 +0200
                                  +++ b/src/testdir/test87.ok Wed Jun 12 14:56:14 2013 +0400
                                  @@ -1093,6 +1093,8 @@
                                  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 vim_dev+unsubscribe@....
                                  For more options, visit https://groups.google.com/groups/opt_out.
                                • ZyX
                                  # HG changeset patch # User ZyX # Date 1371032653 -14400 # Wed Jun 12 14:24:13 2013 +0400 # Branch python-path # Node ID
                                  Message 16 of 26 , Jun 12, 2013
                                  View Source
                                  • 0 Attachment
                                    # HG changeset patch
                                    # User ZyX <kp-pav@...>
                                    # Date 1371032653 -14400
                                    # Wed Jun 12 14:24:13 2013 +0400
                                    # Branch python-path
                                    # Node ID 643f64bbd9386d746313a7678cfa08826b4a5122
                                    # Parent a1b8a5ddecec70085e7e62f8ea9bc6c46ecea530
                                    Make tests pass also on python-2.3

                                    diff -r a1b8a5ddecec -r 643f64bbd938 src/testdir/test86.in
                                    --- a/src/testdir/test86.in Wed Jun 12 14:56:14 2013 +0400
                                    +++ b/src/testdir/test86.in Wed Jun 12 14:24:13 2013 +0400
                                    @@ -45,9 +45,10 @@
                                    dk = d.keys()
                                    dv = d.values()
                                    di = d.items()
                                    -dk.sort(key=repr)
                                    -dv.sort(key=repr)
                                    -di.sort(key=repr)
                                    +cmpfun = lambda a, b: cmp(repr(a), repr(b))
                                    +dk.sort(cmpfun)
                                    +dv.sort(cmpfun)
                                    +di.sort(cmpfun)
                                    EOF
                                    :$put =pyeval('d[''f''](self={})')
                                    :$put =pyeval('repr(dk)')
                                    @@ -813,7 +814,17 @@
                                    try:
                                    exec(expr, g, l)
                                    except:
                                    - cb.append(expr + ':' + repr(sys.exc_info()[:2]))
                                    + ei = sys.exc_info()
                                    + msg = sys.exc_info()[0].__name__ + ':' + repr(sys.exc_info()[1].args)
                                    + msg = msg.replace('TypeError:(\'argument 1 ', 'TypeError:(\'')
                                    + if expr.find('None') > -1:
                                    + msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
                                    + 'TypeError:("\'NoneType\' object is not iterable",)')
                                    + if expr == 'fd(self=[])':
                                    + # HACK: PyMapping_Check changed meaning
                                    + msg = msg.replace('AttributeError:(\'keys\',)',
                                    + 'TypeError:(\'unable to convert object to vim dictionary\',)')
                                    + cb.append(expr + ':' + msg)
                                    else:
                                    cb.append(expr + ':NOT FAILED')
                                    d = vim.Dictionary()
                                    diff -r a1b8a5ddecec -r 643f64bbd938 src/testdir/test86.ok
                                    --- a/src/testdir/test86.ok Wed Jun 12 14:56:14 2013 +0400
                                    +++ b/src/testdir/test86.ok Wed Jun 12 14:24:13 2013 +0400
                                    @@ -437,658 +437,658 @@
                                    test86.in
                                    > Output
                                    >> OutputSetattr
                                    -del sys.stdout.softspace:(<type 'exceptions.AttributeError'>, AttributeError("can't delete OutputObject attributes",))
                                    -sys.stdout.softspace = []:(<type 'exceptions.TypeError'>, TypeError('softspace must be an integer',))
                                    -sys.stdout.attr = None:(<type 'exceptions.AttributeError'>, AttributeError('invalid attribute',))
                                    +del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",)
                                    +sys.stdout.softspace = []:TypeError:('softspace must be an integer',)
                                    +sys.stdout.attr = None:AttributeError:('invalid attribute',)
                                    >> OutputWrite
                                    -sys.stdout.write(None):(<type 'exceptions.TypeError'>, TypeError('coercing to Unicode: need string or buffer, NoneType found',))
                                    +sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',)
                                    >> OutputWriteLines
                                    -sys.stdout.writelines(None):(<type 'exceptions.TypeError'>, TypeError("'NoneType' object is not iterable",))
                                    -sys.stdout.writelines([1]):(<type 'exceptions.TypeError'>, TypeError('writelines() requires list of strings',))
                                    +sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",)
                                    +sys.stdout.writelines([1]):TypeError:('writelines() requires list of strings',)
                                    > VimCommand
                                    -vim.command(1):(<type 'exceptions.TypeError'>, TypeError('must be string, not int',))
                                    +vim.command(1):TypeError:('must be string, not int',)
                                    > VimToPython
                                    > VimEval
                                    -vim.eval(1):(<type 'exceptions.TypeError'>, TypeError('must be string, not int',))
                                    +vim.eval(1):TypeError:('must be string, not int',)
                                    > VimEvalPy
                                    -vim.bindeval(1):(<type 'exceptions.TypeError'>, TypeError('must be string, not int',))
                                    +vim.bindeval(1):TypeError:('must be string, not int',)
                                    > VimStrwidth
                                    -vim.strwidth(1):(<type 'exceptions.TypeError'>, TypeError('must be string, not int',))
                                    +vim.strwidth(1):TypeError:('must be string, not int',)
                                    > Dictionary
                                    >> DictionaryConstructor
                                    -vim.Dictionary("abc"):(<type 'exceptions.ValueError'>, ValueError('expected sequence element of size 2',))
                                    +vim.Dictionary("abc"):ValueError:('expected sequence element of size 2',)
                                    >> DictionarySetattr
                                    -del d.locked:(<type 'exceptions.AttributeError'>, AttributeError('cannot delete vim.Dictionary attributes',))
                                    -d.locked = FailingTrue():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -vim.vvars.locked = False:(<type 'exceptions.TypeError'>, TypeError('cannot modify fixed dictionary',))
                                    -d.scope = True:(<type 'exceptions.AttributeError'>, AttributeError('cannot set this attribute',))
                                    -d.xxx = True:(<type 'exceptions.AttributeError'>, AttributeError('cannot set this attribute',))
                                    +del d.locked:AttributeError:('cannot delete vim.Dictionary attributes',)
                                    +d.locked = FailingTrue():NotImplementedError:()
                                    +vim.vvars.locked = False:TypeError:('cannot modify fixed dictionary',)
                                    +d.scope = True:AttributeError:('cannot set this attribute',)
                                    +d.xxx = True:AttributeError:('cannot set this attribute',)
                                    >> _DictionaryItem
                                    -d.get("a", 2, 3):(<type 'exceptions.TypeError'>, TypeError('function takes at most 2 arguments (3 given)',))
                                    +d.get("a", 2, 3):TypeError:('function takes at most 2 arguments (3 given)',)
                                    >>> Testing StringToChars using d.get(%s)
                                    -d.get(1):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.get(u"\0"):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.get("\0"):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.get(1):TypeError:('object must be string',)
                                    +d.get(u"\0"):TypeError:('expected string without null bytes',)
                                    +d.get("\0"):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    -d.pop("a"):(<type 'exceptions.KeyError'>, KeyError('a',))
                                    -dl.pop("a"):(<class 'vim.error'>, error('dict is locked',))
                                    +d.pop("a"):KeyError:('a',)
                                    +dl.pop("a"):error:('dict is locked',)
                                    >> DictionaryIterNext
                                    -for i in ned: ned["a"] = 1:(<type 'exceptions.RuntimeError'>, RuntimeError('hashtab changed during iteration',))
                                    +for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',)
                                    >> DictionaryAssItem
                                    -dl["b"] = 1:(<class 'vim.error'>, error('dict is locked',))
                                    +dl["b"] = 1:error:('dict is locked',)
                                    >>> Testing StringToChars using d[%s] = 1
                                    -d[1] = 1:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d[u"\0"] = 1:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["\0"] = 1:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d[1] = 1:TypeError:('object must be string',)
                                    +d[u"\0"] = 1:TypeError:('expected string without null bytes',)
                                    +d["\0"] = 1:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d["a"] = {%s : 1}
                                    -d["a"] = {1 : 1}:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d["a"] = {u"\0" : 1}:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["a"] = {"\0" : 1}:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d["a"] = {1 : 1}:TypeError:('object must be string',)
                                    +d["a"] = {u"\0" : 1}:TypeError:('expected string without null bytes',)
                                    +d["a"] = {"\0" : 1}:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}}
                                    -d["a"] = {"abc" : {1 : 1}}:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d["a"] = {"abc" : {u"\0" : 1}}:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["a"] = {"abc" : {"\0" : 1}}:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d["a"] = {"abc" : {1 : 1}}:TypeError:('object must be string',)
                                    +d["a"] = {"abc" : {u"\0" : 1}}:TypeError:('expected string without null bytes',)
                                    +d["a"] = {"abc" : {"\0" : 1}}:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})}
                                    -d["a"] = {"abc" : Mapping({1 : 1})}:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d["a"] = {"abc" : Mapping({u"\0" : 1})}:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["a"] = {"abc" : Mapping({"\0" : 1})}:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d["a"] = {"abc" : Mapping({1 : 1})}:TypeError:('object must be string',)
                                    +d["a"] = {"abc" : Mapping({u"\0" : 1})}:TypeError:('expected string without null bytes',)
                                    +d["a"] = {"abc" : Mapping({"\0" : 1})}:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using d["a"] = {"abc" : %s}
                                    -d["a"] = {"abc" : FailingIter()}:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d["a"] = {"abc" : FailingIterNext()}:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d["a"] = {"abc" : FailingIter()}:TypeError:('unable to convert to vim structure',)
                                    +d["a"] = {"abc" : FailingIterNext()}:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d["a"] = {"abc" : %s}
                                    -d["a"] = {"abc" : None}:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d["a"] = {"abc" : {"": 1}}:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d["a"] = {"abc" : {u"": 1}}:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d["a"] = {"abc" : FailingMapping()}:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d["a"] = {"abc" : FailingMappingKey()}:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d["a"] = {"abc" : None}:TypeError:('unable to convert to vim structure',)
                                    +d["a"] = {"abc" : {"": 1}}:ValueError:('empty keys are not allowed',)
                                    +d["a"] = {"abc" : {u"": 1}}:ValueError:('empty keys are not allowed',)
                                    +d["a"] = {"abc" : FailingMapping()}:NotImplementedError:()
                                    +d["a"] = {"abc" : FailingMappingKey()}:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
                                    -d["a"] = Mapping({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d["a"] = Mapping({u"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["a"] = Mapping({"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d["a"] = Mapping({1 : 1}):TypeError:('object must be string',)
                                    +d["a"] = Mapping({u"\0" : 1}):TypeError:('expected string without null bytes',)
                                    +d["a"] = Mapping({"\0" : 1}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}})
                                    -d["a"] = Mapping({"abc" : {1 : 1}}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d["a"] = Mapping({"abc" : {u"\0" : 1}}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["a"] = Mapping({"abc" : {"\0" : 1}}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d["a"] = Mapping({"abc" : {1 : 1}}):TypeError:('object must be string',)
                                    +d["a"] = Mapping({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
                                    +d["a"] = Mapping({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})})
                                    -d["a"] = Mapping({"abc" : Mapping({1 : 1})}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d["a"] = Mapping({"abc" : Mapping({u"\0" : 1})}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d["a"] = Mapping({"abc" : Mapping({1 : 1})}):TypeError:('object must be string',)
                                    +d["a"] = Mapping({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
                                    +d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using d["a"] = Mapping({"abc" : %s})
                                    -d["a"] = Mapping({"abc" : FailingIter()}):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d["a"] = Mapping({"abc" : FailingIterNext()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d["a"] = Mapping({"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',)
                                    +d["a"] = Mapping({"abc" : FailingIterNext()}):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abc" : %s})
                                    -d["a"] = Mapping({"abc" : None}):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d["a"] = Mapping({"abc" : {"": 1}}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d["a"] = Mapping({"abc" : {u"": 1}}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d["a"] = Mapping({"abc" : FailingMapping()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d["a"] = Mapping({"abc" : FailingMappingKey()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d["a"] = Mapping({"abc" : None}):TypeError:('unable to convert to vim structure',)
                                    +d["a"] = Mapping({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',)
                                    +d["a"] = Mapping({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',)
                                    +d["a"] = Mapping({"abc" : FailingMapping()}):NotImplementedError:()
                                    +d["a"] = Mapping({"abc" : FailingMappingKey()}):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing *Iter* using d["a"] = %s
                                    -d["a"] = FailingIter():(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d["a"] = FailingIterNext():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d["a"] = FailingIter():TypeError:('unable to convert to vim structure',)
                                    +d["a"] = FailingIterNext():NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d["a"] = %s
                                    -d["a"] = None:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d["a"] = {"": 1}:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d["a"] = {u"": 1}:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d["a"] = FailingMapping():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d["a"] = FailingMappingKey():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d["a"] = None:TypeError:('unable to convert to vim structure',)
                                    +d["a"] = {"": 1}:ValueError:('empty keys are not allowed',)
                                    +d["a"] = {u"": 1}:ValueError:('empty keys are not allowed',)
                                    +d["a"] = FailingMapping():NotImplementedError:()
                                    +d["a"] = FailingMappingKey():NotImplementedError:()
                                    <<< Finished
                                    >> DictionaryUpdate
                                    >>> kwargs
                                    >>> iter
                                    -d.update(FailingMapping()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update([FailingIterNext()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update(FailingMapping()):NotImplementedError:()
                                    +d.update([FailingIterNext()]):NotImplementedError:()
                                    >>> Testing StringToChars using d.update({%s : 1})
                                    -d.update({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update({u"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update({"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update({1 : 1}):TypeError:('object must be string',)
                                    +d.update({u"\0" : 1}):TypeError:('expected string without null bytes',)
                                    +d.update({"\0" : 1}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update({"abc" : {%s : 1}})
                                    -d.update({"abc" : {1 : 1}}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update({"abc" : {u"\0" : 1}}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update({"abc" : {"\0" : 1}}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update({"abc" : {1 : 1}}):TypeError:('object must be string',)
                                    +d.update({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
                                    +d.update({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})})
                                    -d.update({"abc" : Mapping({1 : 1})}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update({"abc" : Mapping({u"\0" : 1})}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update({"abc" : Mapping({"\0" : 1})}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update({"abc" : Mapping({1 : 1})}):TypeError:('object must be string',)
                                    +d.update({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
                                    +d.update({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using d.update({"abc" : %s})
                                    -d.update({"abc" : FailingIter()}):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update({"abc" : FailingIterNext()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update({"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',)
                                    +d.update({"abc" : FailingIterNext()}):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d.update({"abc" : %s})
                                    -d.update({"abc" : None}):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update({"abc" : {"": 1}}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update({"abc" : {u"": 1}}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update({"abc" : FailingMapping()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update({"abc" : FailingMappingKey()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update({"abc" : None}):TypeError:('unable to convert to vim structure',)
                                    +d.update({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',)
                                    +d.update({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',)
                                    +d.update({"abc" : FailingMapping()}):NotImplementedError:()
                                    +d.update({"abc" : FailingMappingKey()}):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using d.update(Mapping({%s : 1}))
                                    -d.update(Mapping({1 : 1})):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update(Mapping({u"\0" : 1})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update(Mapping({"\0" : 1})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update(Mapping({1 : 1})):TypeError:('object must be string',)
                                    +d.update(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',)
                                    +d.update(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}}))
                                    -d.update(Mapping({"abc" : {1 : 1}})):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update(Mapping({"abc" : {u"\0" : 1}})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update(Mapping({"abc" : {"\0" : 1}})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update(Mapping({"abc" : {1 : 1}})):TypeError:('object must be string',)
                                    +d.update(Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',)
                                    +d.update(Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})}))
                                    -d.update(Mapping({"abc" : Mapping({1 : 1})})):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update(Mapping({"abc" : Mapping({u"\0" : 1})})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update(Mapping({"abc" : Mapping({"\0" : 1})})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('object must be string',)
                                    +d.update(Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',)
                                    +d.update(Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using d.update(Mapping({"abc" : %s}))
                                    -d.update(Mapping({"abc" : FailingIter()})):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update(Mapping({"abc" : FailingIterNext()})):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert to vim structure',)
                                    +d.update(Mapping({"abc" : FailingIterNext()})):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d.update(Mapping({"abc" : %s}))
                                    -d.update(Mapping({"abc" : None})):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update(Mapping({"abc" : {"": 1}})):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update(Mapping({"abc" : {u"": 1}})):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update(Mapping({"abc" : FailingMapping()})):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update(Mapping({"abc" : FailingMappingKey()})):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update(Mapping({"abc" : None})):TypeError:('unable to convert to vim structure',)
                                    +d.update(Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',)
                                    +d.update(Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',)
                                    +d.update(Mapping({"abc" : FailingMapping()})):NotImplementedError:()
                                    +d.update(Mapping({"abc" : FailingMappingKey()})):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing *Iter* using d.update(%s)
                                    -d.update(FailingIter()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update(FailingIterNext()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update(FailingIter()):NotImplementedError:()
                                    +d.update(FailingIterNext()):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d.update(%s)
                                    -d.update(None):(<type 'exceptions.TypeError'>, TypeError("'NoneType' object is not iterable",))
                                    -d.update({"": 1}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update({u"": 1}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update(FailingMapping()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update(FailingMappingKey()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update(None):TypeError:("'NoneType' object is not iterable",)
                                    +d.update({"": 1}):ValueError:('empty keys are not allowed',)
                                    +d.update({u"": 1}):ValueError:('empty keys are not allowed',)
                                    +d.update(FailingMapping()):NotImplementedError:()
                                    +d.update(FailingMappingKey()):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using d.update(((%s, 0),))
                                    -d.update(((1, 0),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update(((u"\0", 0),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("\0", 0),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update(((1, 0),)):TypeError:('object must be string',)
                                    +d.update(((u"\0", 0),)):TypeError:('expected string without null bytes',)
                                    +d.update((("\0", 0),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update((("a", {%s : 1}),))
                                    -d.update((("a", {1 : 1}),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update((("a", {u"\0" : 1}),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("a", {"\0" : 1}),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update((("a", {1 : 1}),)):TypeError:('object must be string',)
                                    +d.update((("a", {u"\0" : 1}),)):TypeError:('expected string without null bytes',)
                                    +d.update((("a", {"\0" : 1}),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),))
                                    -d.update((("a", {"abc" : {1 : 1}}),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update((("a", {"abc" : {u"\0" : 1}}),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("a", {"abc" : {"\0" : 1}}),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update((("a", {"abc" : {1 : 1}}),)):TypeError:('object must be string',)
                                    +d.update((("a", {"abc" : {u"\0" : 1}}),)):TypeError:('expected string without null bytes',)
                                    +d.update((("a", {"abc" : {"\0" : 1}}),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),))
                                    -d.update((("a", {"abc" : Mapping({1 : 1})}),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update((("a", {"abc" : Mapping({u"\0" : 1})}),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update((("a", {"abc" : Mapping({1 : 1})}),)):TypeError:('object must be string',)
                                    +d.update((("a", {"abc" : Mapping({u"\0" : 1})}),)):TypeError:('expected string without null bytes',)
                                    +d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using d.update((("a", {"abc" : %s}),))
                                    -d.update((("a", {"abc" : FailingIter()}),)):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update((("a", {"abc" : FailingIterNext()}),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update((("a", {"abc" : FailingIter()}),)):TypeError:('unable to convert to vim structure',)
                                    +d.update((("a", {"abc" : FailingIterNext()}),)):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d.update((("a", {"abc" : %s}),))
                                    -d.update((("a", {"abc" : None}),)):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update((("a", {"abc" : {"": 1}}),)):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update((("a", {"abc" : {u"": 1}}),)):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update((("a", {"abc" : FailingMapping()}),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update((("a", {"abc" : FailingMappingKey()}),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update((("a", {"abc" : None}),)):TypeError:('unable to convert to vim structure',)
                                    +d.update((("a", {"abc" : {"": 1}}),)):ValueError:('empty keys are not allowed',)
                                    +d.update((("a", {"abc" : {u"": 1}}),)):ValueError:('empty keys are not allowed',)
                                    +d.update((("a", {"abc" : FailingMapping()}),)):NotImplementedError:()
                                    +d.update((("a", {"abc" : FailingMappingKey()}),)):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
                                    -d.update((("a", Mapping({1 : 1})),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update((("a", Mapping({u"\0" : 1})),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("a", Mapping({"\0" : 1})),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update((("a", Mapping({1 : 1})),)):TypeError:('object must be string',)
                                    +d.update((("a", Mapping({u"\0" : 1})),)):TypeError:('expected string without null bytes',)
                                    +d.update((("a", Mapping({"\0" : 1})),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),))
                                    -d.update((("a", Mapping({"abc" : {1 : 1}})),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update((("a", Mapping({"abc" : {u"\0" : 1}})),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update((("a", Mapping({"abc" : {1 : 1}})),)):TypeError:('object must be string',)
                                    +d.update((("a", Mapping({"abc" : {u"\0" : 1}})),)):TypeError:('expected string without null bytes',)
                                    +d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),))
                                    -d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -d.update((("a", Mapping({"abc" : Mapping({u"\0" : 1})})),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):TypeError:('object must be string',)
                                    +d.update((("a", Mapping({"abc" : Mapping({u"\0" : 1})})),)):TypeError:('expected string without null bytes',)
                                    +d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),))
                                    -d.update((("a", Mapping({"abc" : FailingIter()})),)):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update((("a", Mapping({"abc" : FailingIterNext()})),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update((("a", Mapping({"abc" : FailingIter()})),)):TypeError:('unable to convert to vim structure',)
                                    +d.update((("a", Mapping({"abc" : FailingIterNext()})),)):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abc" : %s})),))
                                    -d.update((("a", Mapping({"abc" : None})),)):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update((("a", Mapping({"abc" : {"": 1}})),)):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update((("a", Mapping({"abc" : {u"": 1}})),)):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update((("a", Mapping({"abc" : FailingMapping()})),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update((("a", Mapping({"abc" : FailingMappingKey()})),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update((("a", Mapping({"abc" : None})),)):TypeError:('unable to convert to vim structure',)
                                    +d.update((("a", Mapping({"abc" : {"": 1}})),)):ValueError:('empty keys are not allowed',)
                                    +d.update((("a", Mapping({"abc" : {u"": 1}})),)):ValueError:('empty keys are not allowed',)
                                    +d.update((("a", Mapping({"abc" : FailingMapping()})),)):NotImplementedError:()
                                    +d.update((("a", Mapping({"abc" : FailingMappingKey()})),)):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing *Iter* using d.update((("a", %s),))
                                    -d.update((("a", FailingIter()),)):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update((("a", FailingIterNext()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update((("a", FailingIter()),)):TypeError:('unable to convert to vim structure',)
                                    +d.update((("a", FailingIterNext()),)):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using d.update((("a", %s),))
                                    -d.update((("a", None),)):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -d.update((("a", {"": 1}),)):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update((("a", {u"": 1}),)):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -d.update((("a", FailingMapping()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +d.update((("a", None),)):TypeError:('unable to convert to vim structure',)
                                    +d.update((("a", {"": 1}),)):ValueError:('empty keys are not allowed',)
                                    +d.update((("a", {u"": 1}),)):ValueError:('empty keys are not allowed',)
                                    +d.update((("a", FailingMapping()),)):NotImplementedError:()
                                    +d.update((("a", FailingMappingKey()),)):NotImplementedError:()
                                    <<< Finished
                                    >> DictionaryPopItem
                                    -d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
                                    +d.popitem(1, 2):TypeError:('popitem() takes no arguments (2 given)',)
                                    >> DictionaryHasKey
                                    -d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
                                    +d.has_key():TypeError:('function takes exactly 1 argument (0 given)',)
                                    > List
                                    >> ListConstructor
                                    -vim.List(1, 2):(<type 'exceptions.TypeError'>, TypeError('function takes at most 1 argument (2 given)',))
                                    -vim.List(a=1):(<type 'exceptions.TypeError'>, TypeError('list constructor does not accept keyword arguments',))
                                    +vim.List(1, 2):TypeError:('function takes at most 1 argument (2 given)',)
                                    +vim.List(a=1):TypeError:('list constructor does not accept keyword arguments',)
                                    >>> Testing StringToChars using vim.List([{%s : 1}])
                                    -vim.List([{1 : 1}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -vim.List([{u"\0" : 1}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -vim.List([{"\0" : 1}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +vim.List([{1 : 1}]):TypeError:('object must be string',)
                                    +vim.List([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
                                    +vim.List([{"\0" : 1}]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}])
                                    -vim.List([{"abc" : {1 : 1}}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -vim.List([{"abc" : {u"\0" : 1}}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -vim.List([{"abc" : {"\0" : 1}}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +vim.List([{"abc" : {1 : 1}}]):TypeError:('object must be string',)
                                    +vim.List([{"abc" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',)
                                    +vim.List([{"abc" : {"\0" : 1}}]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}])
                                    -vim.List([{"abc" : Mapping({1 : 1})}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -vim.List([{"abc" : Mapping({u"\0" : 1})}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -vim.List([{"abc" : Mapping({"\0" : 1})}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +vim.List([{"abc" : Mapping({1 : 1})}]):TypeError:('object must be string',)
                                    +vim.List([{"abc" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',)
                                    +vim.List([{"abc" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using vim.List([{"abc" : %s}])
                                    -vim.List([{"abc" : FailingIter()}]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -vim.List([{"abc" : FailingIterNext()}]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +vim.List([{"abc" : FailingIter()}]):TypeError:('unable to convert to vim structure',)
                                    +vim.List([{"abc" : FailingIterNext()}]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using vim.List([{"abc" : %s}])
                                    -vim.List([{"abc" : None}]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -vim.List([{"abc" : {"": 1}}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -vim.List([{"abc" : {u"": 1}}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -vim.List([{"abc" : FailingMapping()}]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -vim.List([{"abc" : FailingMappingKey()}]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +vim.List([{"abc" : None}]):TypeError:('unable to convert to vim structure',)
                                    +vim.List([{"abc" : {"": 1}}]):ValueError:('empty keys are not allowed',)
                                    +vim.List([{"abc" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
                                    +vim.List([{"abc" : FailingMapping()}]):NotImplementedError:()
                                    +vim.List([{"abc" : FailingMappingKey()}]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
                                    -vim.List([Mapping({1 : 1})]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -vim.List([Mapping({u"\0" : 1})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -vim.List([Mapping({"\0" : 1})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +vim.List([Mapping({1 : 1})]):TypeError:('object must be string',)
                                    +vim.List([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',)
                                    +vim.List([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})])
                                    -vim.List([Mapping({"abc" : {1 : 1}})]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -vim.List([Mapping({"abc" : {u"\0" : 1}})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -vim.List([Mapping({"abc" : {"\0" : 1}})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +vim.List([Mapping({"abc" : {1 : 1}})]):TypeError:('object must be string',)
                                    +vim.List([Mapping({"abc" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',)
                                    +vim.List([Mapping({"abc" : {"\0" : 1}})]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})])
                                    -vim.List([Mapping({"abc" : Mapping({1 : 1})})]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -vim.List([Mapping({"abc" : Mapping({u"\0" : 1})})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +vim.List([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('object must be string',)
                                    +vim.List([Mapping({"abc" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',)
                                    +vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using vim.List([Mapping({"abc" : %s})])
                                    -vim.List([Mapping({"abc" : FailingIter()})]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -vim.List([Mapping({"abc" : FailingIterNext()})]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +vim.List([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert to vim structure',)
                                    +vim.List([Mapping({"abc" : FailingIterNext()})]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using vim.List([Mapping({"abc" : %s})])
                                    -vim.List([Mapping({"abc" : None})]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -vim.List([Mapping({"abc" : {"": 1}})]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -vim.List([Mapping({"abc" : {u"": 1}})]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -vim.List([Mapping({"abc" : FailingMapping()})]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -vim.List([Mapping({"abc" : FailingMappingKey()})]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +vim.List([Mapping({"abc" : None})]):TypeError:('unable to convert to vim structure',)
                                    +vim.List([Mapping({"abc" : {"": 1}})]):ValueError:('empty keys are not allowed',)
                                    +vim.List([Mapping({"abc" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
                                    +vim.List([Mapping({"abc" : FailingMapping()})]):NotImplementedError:()
                                    +vim.List([Mapping({"abc" : FailingMappingKey()})]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing *Iter* using vim.List([%s])
                                    -vim.List([FailingIter()]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -vim.List([FailingIterNext()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +vim.List([FailingIter()]):TypeError:('unable to convert to vim structure',)
                                    +vim.List([FailingIterNext()]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using vim.List([%s])
                                    -vim.List([None]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -vim.List([{"": 1}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -vim.List([{u"": 1}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -vim.List([FailingMapping()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -vim.List([FailingMappingKey()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +vim.List([None]):TypeError:('unable to convert to vim structure',)
                                    +vim.List([{"": 1}]):ValueError:('empty keys are not allowed',)
                                    +vim.List([{u"": 1}]):ValueError:('empty keys are not allowed',)
                                    +vim.List([FailingMapping()]):NotImplementedError:()
                                    +vim.List([FailingMappingKey()]):NotImplementedError:()
                                    <<< Finished
                                    >> ListItem
                                    -l[1000]:(<type 'exceptions.IndexError'>, IndexError('list index out of range',))
                                    +l[1000]:IndexError:('list index out of range',)
                                    >> ListAssItem
                                    -ll[1] = 2:(<class 'vim.error'>, error('list is locked',))
                                    -l[1000] = 3:(<type 'exceptions.IndexError'>, IndexError('list index out of range',))
                                    +ll[1] = 2:error:('list is locked',)
                                    +l[1000] = 3:IndexError:('list index out of range',)
                                    >> ListAssSlice
                                    -ll[1:100] = "abc":(<class 'vim.error'>, error('list is locked',))
                                    +ll[1:100] = "abc":error:('list is locked',)
                                    >>> Testing StringToChars using l[:] = [{%s : 1}]
                                    -l[:] = [{1 : 1}]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l[:] = [{u"\0" : 1}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l[:] = [{"\0" : 1}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l[:] = [{1 : 1}]:TypeError:('object must be string',)
                                    +l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',)
                                    +l[:] = [{"\0" : 1}]:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}]
                                    -l[:] = [{"abc" : {1 : 1}}]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l[:] = [{"abc" : {u"\0" : 1}}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l[:] = [{"abc" : {"\0" : 1}}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l[:] = [{"abc" : {1 : 1}}]:TypeError:('object must be string',)
                                    +l[:] = [{"abc" : {u"\0" : 1}}]:TypeError:('expected string without null bytes',)
                                    +l[:] = [{"abc" : {"\0" : 1}}]:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}]
                                    -l[:] = [{"abc" : Mapping({1 : 1})}]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l[:] = [{"abc" : Mapping({u"\0" : 1})}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l[:] = [{"abc" : Mapping({"\0" : 1})}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l[:] = [{"abc" : Mapping({1 : 1})}]:TypeError:('object must be string',)
                                    +l[:] = [{"abc" : Mapping({u"\0" : 1})}]:TypeError:('expected string without null bytes',)
                                    +l[:] = [{"abc" : Mapping({"\0" : 1})}]:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using l[:] = [{"abc" : %s}]
                                    -l[:] = [{"abc" : FailingIter()}]:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l[:] = [{"abc" : FailingIterNext()}]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l[:] = [{"abc" : FailingIter()}]:TypeError:('unable to convert to vim structure',)
                                    +l[:] = [{"abc" : FailingIterNext()}]:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using l[:] = [{"abc" : %s}]
                                    -l[:] = [{"abc" : None}]:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l[:] = [{"abc" : {"": 1}}]:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l[:] = [{"abc" : {u"": 1}}]:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l[:] = [{"abc" : FailingMapping()}]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l[:] = [{"abc" : FailingMappingKey()}]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l[:] = [{"abc" : None}]:TypeError:('unable to convert to vim structure',)
                                    +l[:] = [{"abc" : {"": 1}}]:ValueError:('empty keys are not allowed',)
                                    +l[:] = [{"abc" : {u"": 1}}]:ValueError:('empty keys are not allowed',)
                                    +l[:] = [{"abc" : FailingMapping()}]:NotImplementedError:()
                                    +l[:] = [{"abc" : FailingMappingKey()}]:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
                                    -l[:] = [Mapping({1 : 1})]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l[:] = [Mapping({u"\0" : 1})]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l[:] = [Mapping({"\0" : 1})]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l[:] = [Mapping({1 : 1})]:TypeError:('object must be string',)
                                    +l[:] = [Mapping({u"\0" : 1})]:TypeError:('expected string without null bytes',)
                                    +l[:] = [Mapping({"\0" : 1})]:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})]
                                    -l[:] = [Mapping({"abc" : {1 : 1}})]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l[:] = [Mapping({"abc" : {u"\0" : 1}})]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l[:] = [Mapping({"abc" : {"\0" : 1}})]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l[:] = [Mapping({"abc" : {1 : 1}})]:TypeError:('object must be string',)
                                    +l[:] = [Mapping({"abc" : {u"\0" : 1}})]:TypeError:('expected string without null bytes',)
                                    +l[:] = [Mapping({"abc" : {"\0" : 1}})]:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})]
                                    -l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l[:] = [Mapping({"abc" : Mapping({u"\0" : 1})})]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:TypeError:('object must be string',)
                                    +l[:] = [Mapping({"abc" : Mapping({u"\0" : 1})})]:TypeError:('expected string without null bytes',)
                                    +l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})]
                                    -l[:] = [Mapping({"abc" : FailingIter()})]:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l[:] = [Mapping({"abc" : FailingIterNext()})]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l[:] = [Mapping({"abc" : FailingIter()})]:TypeError:('unable to convert to vim structure',)
                                    +l[:] = [Mapping({"abc" : FailingIterNext()})]:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abc" : %s})]
                                    -l[:] = [Mapping({"abc" : None})]:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l[:] = [Mapping({"abc" : {"": 1}})]:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l[:] = [Mapping({"abc" : {u"": 1}})]:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l[:] = [Mapping({"abc" : FailingMapping()})]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l[:] = [Mapping({"abc" : FailingMappingKey()})]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l[:] = [Mapping({"abc" : None})]:TypeError:('unable to convert to vim structure',)
                                    +l[:] = [Mapping({"abc" : {"": 1}})]:ValueError:('empty keys are not allowed',)
                                    +l[:] = [Mapping({"abc" : {u"": 1}})]:ValueError:('empty keys are not allowed',)
                                    +l[:] = [Mapping({"abc" : FailingMapping()})]:NotImplementedError:()
                                    +l[:] = [Mapping({"abc" : FailingMappingKey()})]:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing *Iter* using l[:] = [%s]
                                    -l[:] = [FailingIter()]:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l[:] = [FailingIterNext()]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l[:] = [FailingIter()]:TypeError:('unable to convert to vim structure',)
                                    +l[:] = [FailingIterNext()]:NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using l[:] = [%s]
                                    -l[:] = [None]:(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l[:] = [{"": 1}]:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l[:] = [{u"": 1}]:(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l[:] = [FailingMapping()]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l[:] = [FailingMappingKey()]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l[:] = [None]:TypeError:('unable to convert to vim structure',)
                                    +l[:] = [{"": 1}]:ValueError:('empty keys are not allowed',)
                                    +l[:] = [{u"": 1}]:ValueError:('empty keys are not allowed',)
                                    +l[:] = [FailingMapping()]:NotImplementedError:()
                                    +l[:] = [FailingMappingKey()]:NotImplementedError:()
                                    <<< Finished
                                    >> ListConcatInPlace
                                    >>> Testing StringToChars using l.extend([{%s : 1}])
                                    -l.extend([{1 : 1}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l.extend([{u"\0" : 1}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l.extend([{"\0" : 1}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l.extend([{1 : 1}]):TypeError:('object must be string',)
                                    +l.extend([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
                                    +l.extend([{"\0" : 1}]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}])
                                    -l.extend([{"abc" : {1 : 1}}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l.extend([{"abc" : {u"\0" : 1}}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l.extend([{"abc" : {"\0" : 1}}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l.extend([{"abc" : {1 : 1}}]):TypeError:('object must be string',)
                                    +l.extend([{"abc" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',)
                                    +l.extend([{"abc" : {"\0" : 1}}]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}])
                                    -l.extend([{"abc" : Mapping({1 : 1})}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l.extend([{"abc" : Mapping({u"\0" : 1})}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l.extend([{"abc" : Mapping({"\0" : 1})}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l.extend([{"abc" : Mapping({1 : 1})}]):TypeError:('object must be string',)
                                    +l.extend([{"abc" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',)
                                    +l.extend([{"abc" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using l.extend([{"abc" : %s}])
                                    -l.extend([{"abc" : FailingIter()}]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l.extend([{"abc" : FailingIterNext()}]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l.extend([{"abc" : FailingIter()}]):TypeError:('unable to convert to vim structure',)
                                    +l.extend([{"abc" : FailingIterNext()}]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using l.extend([{"abc" : %s}])
                                    -l.extend([{"abc" : None}]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l.extend([{"abc" : {"": 1}}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l.extend([{"abc" : {u"": 1}}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l.extend([{"abc" : FailingMapping()}]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l.extend([{"abc" : FailingMappingKey()}]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l.extend([{"abc" : None}]):TypeError:('unable to convert to vim structure',)
                                    +l.extend([{"abc" : {"": 1}}]):ValueError:('empty keys are not allowed',)
                                    +l.extend([{"abc" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
                                    +l.extend([{"abc" : FailingMapping()}]):NotImplementedError:()
                                    +l.extend([{"abc" : FailingMappingKey()}]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using l.extend([Mapping({%s : 1})])
                                    -l.extend([Mapping({1 : 1})]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l.extend([Mapping({u"\0" : 1})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l.extend([Mapping({"\0" : 1})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l.extend([Mapping({1 : 1})]):TypeError:('object must be string',)
                                    +l.extend([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',)
                                    +l.extend([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})])
                                    -l.extend([Mapping({"abc" : {1 : 1}})]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l.extend([Mapping({"abc" : {u"\0" : 1}})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l.extend([Mapping({"abc" : {"\0" : 1}})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l.extend([Mapping({"abc" : {1 : 1}})]):TypeError:('object must be string',)
                                    +l.extend([Mapping({"abc" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',)
                                    +l.extend([Mapping({"abc" : {"\0" : 1}})]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})])
                                    -l.extend([Mapping({"abc" : Mapping({1 : 1})})]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -l.extend([Mapping({"abc" : Mapping({u"\0" : 1})})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +l.extend([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('object must be string',)
                                    +l.extend([Mapping({"abc" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',)
                                    +l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using l.extend([Mapping({"abc" : %s})])
                                    -l.extend([Mapping({"abc" : FailingIter()})]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l.extend([Mapping({"abc" : FailingIterNext()})]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l.extend([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert to vim structure',)
                                    +l.extend([Mapping({"abc" : FailingIterNext()})]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using l.extend([Mapping({"abc" : %s})])
                                    -l.extend([Mapping({"abc" : None})]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l.extend([Mapping({"abc" : {"": 1}})]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l.extend([Mapping({"abc" : {u"": 1}})]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l.extend([Mapping({"abc" : FailingMapping()})]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l.extend([Mapping({"abc" : FailingMappingKey()})]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l.extend([Mapping({"abc" : None})]):TypeError:('unable to convert to vim structure',)
                                    +l.extend([Mapping({"abc" : {"": 1}})]):ValueError:('empty keys are not allowed',)
                                    +l.extend([Mapping({"abc" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
                                    +l.extend([Mapping({"abc" : FailingMapping()})]):NotImplementedError:()
                                    +l.extend([Mapping({"abc" : FailingMappingKey()})]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing *Iter* using l.extend([%s])
                                    -l.extend([FailingIter()]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l.extend([FailingIterNext()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l.extend([FailingIter()]):TypeError:('unable to convert to vim structure',)
                                    +l.extend([FailingIterNext()]):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using l.extend([%s])
                                    -l.extend([None]):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -l.extend([{"": 1}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l.extend([{u"": 1}]):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -l.extend([FailingMapping()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l.extend([FailingMappingKey()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +l.extend([None]):TypeError:('unable to convert to vim structure',)
                                    +l.extend([{"": 1}]):ValueError:('empty keys are not allowed',)
                                    +l.extend([{u"": 1}]):ValueError:('empty keys are not allowed',)
                                    +l.extend([FailingMapping()]):NotImplementedError:()
                                    +l.extend([FailingMappingKey()]):NotImplementedError:()
                                    <<< Finished
                                    >> ListSetattr
                                    -del l.locked:(<type 'exceptions.AttributeError'>, AttributeError('cannot delete vim.List attributes',))
                                    -l.locked = FailingTrue():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -l.xxx = True:(<type 'exceptions.AttributeError'>, AttributeError('cannot set this attribute',))
                                    +del l.locked:AttributeError:('cannot delete vim.List attributes',)
                                    +l.locked = FailingTrue():NotImplementedError:()
                                    +l.xxx = True:AttributeError:('cannot set this attribute',)
                                    > Function
                                    >> FunctionConstructor
                                    -vim.Function("123"):(<type 'exceptions.ValueError'>, ValueError('unnamed function does not exist',))
                                    -vim.Function("xxx_non_existent_function_xxx"):(<type 'exceptions.ValueError'>, ValueError('function does not exist',))
                                    +vim.Function("123"):ValueError:('unnamed function does not exist',)
                                    +vim.Function("xxx_non_existent_function_xxx"):ValueError:('function does not exist',)
                                    vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
                                    >> FunctionCall
                                    >>> Testing StringToChars using f({%s : 1})
                                    -f({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -f({u"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -f({"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +f({1 : 1}):TypeError:('object must be string',)
                                    +f({u"\0" : 1}):TypeError:('expected string without null bytes',)
                                    +f({"\0" : 1}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using f({"abc" : {%s : 1}})
                                    -f({"abc" : {1 : 1}}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -f({"abc" : {u"\0" : 1}}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -f({"abc" : {"\0" : 1}}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +f({"abc" : {1 : 1}}):TypeError:('object must be string',)
                                    +f({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
                                    +f({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using f({"abc" : Mapping({%s : 1})})
                                    -f({"abc" : Mapping({1 : 1})}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -f({"abc" : Mapping({u"\0" : 1})}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -f({"abc" : Mapping({"\0" : 1})}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +f({"abc" : Mapping({1 : 1})}):TypeError:('object must be string',)
                                    +f({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
                                    +f({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using f({"abc" : %s})
                                    -f({"abc" : FailingIter()}):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -f({"abc" : FailingIterNext()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +f({"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',)
                                    +f({"abc" : FailingIterNext()}):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using f({"abc" : %s})
                                    -f({"abc" : None}):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -f({"abc" : {"": 1}}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -f({"abc" : {u"": 1}}):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -f({"abc" : FailingMapping()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -f({"abc" : FailingMappingKey()}):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +f({"abc" : None}):TypeError:('unable to convert to vim structure',)
                                    +f({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',)
                                    +f({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',)
                                    +f({"abc" : FailingMapping()}):NotImplementedError:()
                                    +f({"abc" : FailingMappingKey()}):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing StringToChars using f(Mapping({%s : 1}))
                                    -f(Mapping({1 : 1})):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -f(Mapping({u"\0" : 1})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -f(Mapping({"\0" : 1})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +f(Mapping({1 : 1})):TypeError:('object must be string',)
                                    +f(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',)
                                    +f(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}}))
                                    -f(Mapping({"abc" : {1 : 1}})):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -f(Mapping({"abc" : {u"\0" : 1}})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -f(Mapping({"abc" : {"\0" : 1}})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +f(Mapping({"abc" : {1 : 1}})):TypeError:('object must be string',)
                                    +f(Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',)
                                    +f(Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})}))
                                    -f(Mapping({"abc" : Mapping({1 : 1})})):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
                                    -f(Mapping({"abc" : Mapping({u"\0" : 1})})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    -f(Mapping({"abc" : Mapping({"\0" : 1})})):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
                                    +f(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('object must be string',)
                                    +f(Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',)
                                    +f(Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',)
                                    <<< Finished
                                    >>> Testing *Iter* using f(Mapping({"abc" : %s}))
                                    -f(Mapping({"abc" : FailingIter()})):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -f(Mapping({"abc" : FailingIterNext()})):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +f(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert to vim structure',)
                                    +f(Mapping({"abc" : FailingIterNext()})):NotImplementedError:()
                                    <<< Finished
                                    >>> Testing ConvertFromPyObject using f(Mapping({"abc" : %s}))
                                    -f(Mapping({"abc" : None})):(<type 'exceptions.TypeError'>, TypeError('unable to convert to vim structure',))
                                    -f(Mapping({"abc" : {"": 1}})):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -f(Mapping({"abc" : {u"": 1}})):(<type 'exceptions.ValueError'>, ValueError('empty keys are not allowed',))
                                    -f(Mapping({"abc" : FailingMapping()})):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    -f(Mapping({"abc" : FailingMappingKey()})):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
                                    +f(Mapping({"abc" : None})):TypeError:('unable to convert to vim structure',)
                                    +f(Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',)
                                    +f(Mapping({"abc" : {u"": 1}})
                                    (Message over 64 KB, truncated)
                                  • ZyX
                                    # HG changeset patch # User ZyX # Date 1371036594 -14400 # Wed Jun 12 15:29:54 2013 +0400 # Branch python-path # Node ID
                                    Message 17 of 26 , Jun 12, 2013
                                    View Source
                                    • 0 Attachment
                                      # HG changeset patch
                                      # User ZyX <kp-pav@...>
                                      # Date 1371036594 -14400
                                      # Wed Jun 12 15:29:54 2013 +0400
                                      # Branch python-path
                                      # Node ID 27aa091d5fa525fd4ba97b4b68dc62e64e8bd3a0
                                      # Parent 643f64bbd9386d746313a7678cfa08826b4a5122
                                      Use the same method for python3 as for python2

                                      diff -r 643f64bbd938 -r 27aa091d5fa5 runtime/doc/if_pyth.txt
                                      --- a/runtime/doc/if_pyth.txt Wed Jun 12 14:24:13 2013 +0400
                                      +++ b/runtime/doc/if_pyth.txt Wed Jun 12 15:29:54 2013 +0400
                                      @@ -315,7 +315,7 @@
                                      {rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
                                      each {rtp} found in 'runtimepath'.

                                      -Implementation for python 2 is similar to the following, but written in C: >
                                      +Implementation is similar to the following, but written in C: >

                                      from imp import find_module, load_module
                                      import vim
                                      @@ -344,16 +344,16 @@
                                      # matter for python which object has find_module function attached to as
                                      # an attribute.
                                      class VimPathFinder(object):
                                      + @classmethod
                                      def find_module(cls, fullname, path=None):
                                      try:
                                      return VimModuleLoader(_find_module(fullname, fullname, path or vim._get_paths()))
                                      except ImportError:
                                      return None
                                      - find_module = classmethod(find_module)

                                      + @classmethod
                                      def load_module(cls, fullname, path=None):
                                      return _find_module(fullname, fullname, path or vim._get_paths())
                                      - load_module = classmethod(load_module)

                                      def hook(path):
                                      if path == vim.VIM_SPECIAL_PATH:
                                      @@ -363,30 +363,6 @@

                                      sys.path_hooks.append(hook)

                                      -Implementation for python 3 is cleaner: code is similar to the following, but,
                                      -again, written in C: >
                                      -
                                      - from importlib.machinery import PathFinder
                                      - import sys
                                      -
                                      - class Finder(PathFinder):
                                      - @classmethod
                                      - def find_module(cls, fullname):
                                      - # see vim._get_paths below
                                      - new_path = _get_paths()
                                      -
                                      - # super().find_module is also a class method
                                      - # super() is not used because this variant is easier to implement
                                      - # in C
                                      - return PathFinder.find_module(fullname, new_path)
                                      -
                                      - def path_hook(path):
                                      - if path == VIM_SPECIAL_PATH:
                                      - return Finder
                                      - raise ImportError
                                      -
                                      - sys.path_hooks.append(path_hook)
                                      -
                                      vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH*
                                      String constant used in conjunction with vim path hook. If path hook
                                      installed by vim is requested to handle anything but path equal to
                                      @@ -402,8 +378,7 @@
                                      You should not be using any of these directly except for vim.path_hook
                                      in case you need to do something with sys.meta_path. It is not
                                      guaranteed that any of the objects will exist in the future vim
                                      - versions. In fact, find_module methods do not exists
                                      - in python3.
                                      + versions.

                                      vim._get_paths *python-_get_paths*
                                      Methods returning a list of paths which will be searched for by path
                                      diff -r 643f64bbd938 -r 27aa091d5fa5 src/if_py_both.h
                                      --- a/src/if_py_both.h Wed Jun 12 14:24:13 2013 +0400
                                      +++ b/src/if_py_both.h Wed Jun 12 15:29:54 2013 +0400
                                      @@ -60,6 +60,11 @@
                                      static PyObject *vim_module;
                                      static PyObject *vim_special_path_object;

                                      +static PyObject *py_find_module;
                                      +static PyObject *py_load_module;
                                      +
                                      +static PyObject *VimError;
                                      +
                                      /*
                                      * obtain a lock on the Vim data structures
                                      */
                                      @@ -393,8 +398,34 @@
                                      return 0;
                                      }

                                      -
                                      -static PyObject *VimError;
                                      +typedef struct
                                      +{
                                      + PyObject_HEAD
                                      + PyObject *module;
                                      +} LoaderObject;
                                      +static PyTypeObject LoaderType;
                                      +
                                      + static void
                                      +LoaderDestructor(LoaderObject *self)
                                      +{
                                      + Py_DECREF(self->module);
                                      + DESTRUCTOR_FINISH(self);
                                      +}
                                      +
                                      + static PyObject *
                                      +LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED)
                                      +{
                                      + PyObject *r = self->module;
                                      +
                                      + Py_INCREF(r);
                                      + return r;
                                      +}
                                      +
                                      +static struct PyMethodDef LoaderMethods[] = {
                                      + /* name, function, calling, doc */
                                      + {"load_module", (PyCFunction)LoaderLoadModule, METH_VARARGS, ""},
                                      + { NULL, NULL, 0, NULL}
                                      +};

                                      /* Check to see whether a Vim error has been reported, or a keyboard
                                      * interrupt has been detected.
                                      @@ -925,6 +956,151 @@
                                      return r;
                                      }

                                      + static PyObject *
                                      +call_load_module(char *name, int len, PyObject *find_module_result)
                                      +{
                                      + PyObject *r;
                                      + PyObject *fd, *pathname, *description;
                                      +
                                      + if (!PyTuple_Check(find_module_result)
                                      + || PyTuple_GET_SIZE(find_module_result) != 3)
                                      + {
                                      + PyErr_SetString(PyExc_TypeError,
                                      + _("expected 3-tuple as imp.find_module() result"));
                                      + return NULL;
                                      + }
                                      +
                                      + if (!(fd = PyTuple_GET_ITEM(find_module_result, 0))
                                      + || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
                                      + || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
                                      + {
                                      + PyErr_SetString(PyExc_RuntimeError,
                                      + _("internal error: imp.find_module returned tuple with NULL"));
                                      + return NULL;
                                      + }
                                      +
                                      + return PyObject_CallFunction(py_load_module,
                                      + "s#OOO", name, len, fd, pathname, description);
                                      +}
                                      +
                                      + static PyObject *
                                      +find_module(char *fullname, char *tail, PyObject *new_path)
                                      +{
                                      + PyObject *find_module_result;
                                      + PyObject *module;
                                      + char *dot;
                                      +
                                      + if ((dot = (char *) vim_strchr((char_u *) tail, '.')))
                                      + {
                                      + /*
                                      + * There is a dot in the name: call find_module recursively without the
                                      + * first component
                                      + */
                                      + PyObject *newest_path;
                                      + int partlen = (int) (dot - 1 - tail);
                                      +
                                      + if (!(find_module_result = PyObject_CallFunction(py_find_module,
                                      + "s#O", tail, partlen, new_path)))
                                      + return NULL;
                                      +
                                      + if (!(module = call_load_module(
                                      + fullname,
                                      + ((int) (tail - fullname)) + partlen,
                                      + find_module_result)))
                                      + {
                                      + Py_DECREF(find_module_result);
                                      + return NULL;
                                      + }
                                      +
                                      + Py_DECREF(find_module_result);
                                      +
                                      + if (!(newest_path = PyObject_GetAttrString(module, "__path__")))
                                      + {
                                      + Py_DECREF(module);
                                      + return NULL;
                                      + }
                                      +
                                      + Py_DECREF(module);
                                      +
                                      + module = find_module(fullname, dot + 1, newest_path);
                                      +
                                      + Py_DECREF(newest_path);
                                      +
                                      + return module;
                                      + }
                                      + else
                                      + {
                                      + if (!(find_module_result = PyObject_CallFunction(py_find_module,
                                      + "sO", tail, new_path)))
                                      + return NULL;
                                      +
                                      + if (!(module = call_load_module(
                                      + fullname,
                                      + STRLEN(fullname),
                                      + find_module_result)))
                                      + {
                                      + Py_DECREF(find_module_result);
                                      + return NULL;
                                      + }
                                      +
                                      + Py_DECREF(find_module_result);
                                      +
                                      + return module;
                                      + }
                                      +}
                                      +
                                      + static PyObject *
                                      +FinderFindModule(PyObject *self, PyObject *args)
                                      +{
                                      + char *fullname;
                                      + PyObject *module;
                                      + PyObject *new_path;
                                      + LoaderObject *loader;
                                      +
                                      + if (!PyArg_ParseTuple(args, "s", &fullname))
                                      + return NULL;
                                      +
                                      + if (!(new_path = Vim_GetPaths(self)))
                                      + return NULL;
                                      +
                                      + module = find_module(fullname, fullname, new_path);
                                      +
                                      + Py_DECREF(new_path);
                                      +
                                      + if (!module)
                                      + {
                                      + Py_INCREF(Py_None);
                                      + return Py_None;
                                      + }
                                      +
                                      + if (!(loader = PyObject_NEW(LoaderObject, &LoaderType)))
                                      + {
                                      + Py_DECREF(module);
                                      + return NULL;
                                      + }
                                      +
                                      + loader->module = module;
                                      +
                                      + return (PyObject *) loader;
                                      +}
                                      +
                                      + static PyObject *
                                      +VimPathHook(PyObject *self UNUSED, PyObject *args)
                                      +{
                                      + char *path;
                                      +
                                      + if (PyArg_ParseTuple(args, "s", &path)
                                      + && STRCMP(path, vim_special_path) == 0)
                                      + {
                                      + Py_INCREF(vim_module);
                                      + return vim_module;
                                      + }
                                      +
                                      + PyErr_Clear();
                                      + PyErr_SetNone(PyExc_ImportError);
                                      + return NULL;
                                      +}
                                      +
                                      /*
                                      * Vim module - Definitions
                                      */
                                      @@ -938,9 +1114,7 @@
                                      {"chdir", (PyCFunction)VimChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
                                      {"fchdir", (PyCFunction)VimFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
                                      {"foreach_rtp", VimForeachRTP, METH_VARARGS, "Call given callable for each path in &rtp"},
                                      -#if PY_MAJOR_VERSION < 3
                                      {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"},
                                      -#endif
                                      {"path_hook", VimPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"},
                                      {"_get_paths", (PyCFunction)Vim_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"},
                                      { NULL, NULL, 0, NULL}
                                      @@ -5188,21 +5362,6 @@
                                      } CurrentObject;
                                      static PyTypeObject CurrentType;

                                      -#if PY_MAJOR_VERSION >= 3
                                      -typedef struct
                                      -{
                                      - PyObject_HEAD
                                      -} FinderObject;
                                      -static PyTypeObject FinderType;
                                      -#else
                                      -typedef struct
                                      -{
                                      - PyObject_HEAD
                                      - PyObject *module;
                                      -} LoaderObject;
                                      -static PyTypeObject LoaderType;
                                      -#endif
                                      -
                                      static void
                                      init_structs(void)
                                      {
                                      @@ -5418,6 +5577,14 @@
                                      OptionsType.tp_traverse = (traverseproc)OptionsTraverse;
                                      OptionsType.tp_clear = (inquiry)OptionsClear;

                                      + vim_memset(&LoaderType, 0, sizeof(LoaderType));
                                      + LoaderType.tp_name = "vim.Loader";
                                      + LoaderType.tp_basicsize = sizeof(LoaderObject);
                                      + LoaderType.tp_flags = Py_TPFLAGS_DEFAULT;
                                      + LoaderType.tp_doc = "vim message object";
                                      + LoaderType.tp_methods = LoaderMethods;
                                      + LoaderType.tp_dealloc = (destructor)LoaderDestructor;
                                      +
                                      #if PY_MAJOR_VERSION >= 3
                                      vim_memset(&vimmodule, 0, sizeof(vimmodule));
                                      vimmodule.m_name = "vim";
                                      @@ -5448,11 +5615,7 @@
                                      PYTYPE_READY(FunctionType);
                                      PYTYPE_READY(OptionsType);
                                      PYTYPE_READY(OutputType);
                                      -#if PY_MAJOR_VERSION >= 3
                                      - PYTYPE_READY(FinderType);
                                      -#else
                                      PYTYPE_READY(LoaderType);
                                      -#endif
                                      return 0;
                                      }

                                      @@ -5576,11 +5739,7 @@
                                      {"List", (PyObject *)&ListType},
                                      {"Function", (PyObject *)&FunctionType},
                                      {"Options", (PyObject *)&OptionsType},
                                      -#if PY_MAJOR_VERSION >= 3
                                      - {"Finder", (PyObject *)&FinderType},
                                      -#else
                                      - {"Loader", (PyObject *)&LoaderType},
                                      -#endif
                                      + {"_Loader", (PyObject *)&LoaderType},
                                      };

                                      typedef int (*object_adder)(PyObject *, const char *, PyObject *);
                                      @@ -5604,6 +5763,7 @@
                                      int i;
                                      PyObject *other_module;
                                      PyObject *attr;
                                      + PyObject *imp;

                                      for (i = 0; i < (int)(sizeof(numeric_constants)
                                      / sizeof(struct numeric_constant));
                                      @@ -5671,15 +5831,26 @@

                                      ADD_OBJECT(m, "VIM_SPECIAL_PATH", vim_special_path_object);

                                      -#if PY_MAJOR_VERSION >= 3
                                      - ADD_OBJECT(m, "_PathFinder", path_finder);
                                      - ADD_CHECKED_OBJECT(m, "_find_module",
                                      - (py_find_module = PyObject_GetAttrString(path_finder,
                                      - "find_module")));
                                      -#else
                                      + if (!(imp = PyImport_ImportModule("imp")))
                                      + return -1;
                                      +
                                      + if (!(py_find_module = PyObject_GetAttrString(imp, "find_module")))
                                      + {
                                      + Py_DECREF(imp);
                                      + return -1;
                                      + }
                                      +
                                      + if (!(py_load_module = PyObject_GetAttrString(imp, "load_module")))
                                      + {
                                      + Py_DECREF(py_find_module);
                                      + Py_DECREF(imp);
                                      + return -1;
                                      + }
                                      +
                                      + Py_DECREF(imp);
                                      +
                                      ADD_OBJECT(m, "_find_module", py_find_module);
                                      ADD_OBJECT(m, "_load_module", py_load_module);
                                      -#endif

                                      return 0;
                                      }
                                      diff -r 643f64bbd938 -r 27aa091d5fa5 src/if_python.c
                                      --- a/src/if_python.c Wed Jun 12 14:24:13 2013 +0400
                                      +++ b/src/if_python.c Wed Jun 12 15:29:54 2013 +0400
                                      @@ -752,12 +752,6 @@
                                      static PyObject *ListGetattr(PyObject *, char *);
                                      static PyObject *FunctionGetattr(PyObject *, char *);

                                      -static PyObject *FinderFindModule(PyObject *, PyObject *);
                                      -static PyObject *VimPathHook(PyObject *, PyObject *);
                                      -
                                      -static PyObject *py_find_module;
                                      -static PyObject *py_load_module;
                                      -
                                      #ifndef Py_VISIT
                                      # define Py_VISIT(obj) visit(obj, arg)
                                      #endif
                                      @@ -1382,173 +1376,6 @@
                                      }
                                      #endif

                                      - static void
                                      -LoaderDestructor(LoaderObject *self)
                                      -{
                                      - Py_DECREF(self->module);
                                      - DESTRUCTOR_FINISH(self);
                                      -}
                                      -
                                      - static PyObject *
                                      -LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED)
                                      -{
                                      - PyObject *r = self->module;
                                      -
                                      - Py_INCREF(r);
                                      - return r;
                                      -}
                                      -
                                      -static struct PyMethodDef LoaderMethods[] = {
                                      - /* name, function, calling, doc */
                                      - {"load_module", (PyCFunction)LoaderLoadModule, METH_VARARGS, ""},
                                      - { NULL, NULL, 0, NULL}
                                      -};
                                      -
                                      - static PyObject *
                                      -call_load_module(char *name, int len, PyObject *find_module_result)
                                      -{
                                      - PyObject *r;
                                      - PyObject *fd, *pathname, *description;
                                      -
                                      - if (!PyTuple_Check(find_module_result)
                                      - || PyTuple_GET_SIZE(find_module_result) != 3)
                                      - {
                                      - PyErr_SetString(PyExc_TypeError,
                                      - _("expected 3-tuple as imp.find_module() result"));
                                      - return NULL;
                                      - }
                                      -
                                      - if (!(fd = PyTuple_GET_ITEM(find_module_result, 0))
                                      - || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
                                      - || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
                                      - {
                                      - PyErr_SetString(PyExc_RuntimeError,
                                      - _("internal error: imp.find_module returned tuple with NULL"));
                                      - return NULL;
                                      - }
                                      -
                                      - return PyObject_CallFunction(py_load_module,
                                      - "s#OOO", name, len, fd, pathname, description);
                                      -}
                                      -
                                      - static PyObject *
                                      -find_module(char *fullname, char *tail, PyObject *new_path)
                                      -{
                                      - PyObject *find_module_result;
                                      - PyObject *module;
                                      - char *dot;
                                      -
                                      - if ((dot = (char *) vim_strchr((char_u *) tail, '.')))
                                      - {
                                      - /*
                                      - * There is a dot in the name: call find_module recursively without the
                                      - * first component
                                      - */
                                      - PyObject *newest_path;
                                      - int partlen = (int) (dot - 1 - tail);
                                      -
                                      - if (!(find_module_result = PyObject_CallFunction(py_find_module,
                                      - "s#O", tail, partlen, new_path)))
                                      - return NULL;
                                      -
                                      - if (!(module = call_load_module(
                                      - fullname,
                                      - ((int) (tail - fullname)) + partlen,
                                      - find_module_result)))
                                      - {
                                      - Py_DECREF(find_module_result);
                                      - return NULL;
                                      - }
                                      -
                                      - Py_DECREF(find_module_result);
                                      -
                                      - if (!(newest_path = PyObject_GetAttrString(module, "__path__")))
                                      - {
                                      - Py_DECREF(module);
                                      - return NULL;
                                      - }
                                      -
                                      - Py_DECREF(module);
                                      -
                                      - module = find_module(fullname, dot + 1, newest_path);
                                      -
                                      - Py_DECREF(newest_path);
                                      -
                                      - return module;
                                      - }
                                      - else
                                      - {
                                      - if (!(find_module_result = PyObject_CallFunction(py_find_module,
                                      - "sO", tail, new_path)))
                                      - return NULL;
                                      -
                                      - if (!(module = call_load_module(
                                      - fullname,
                                      - STRLEN(fullname),
                                      - find_module_result)))
                                      - {
                                      - Py_DECREF(find_module_result);
                                      - return NULL;
                                      - }
                                      -
                                      - Py_DECREF(find_module_result);
                                      -
                                      - return module;
                                      - }
                                      -}
                                      -
                                      - static PyObject *
                                      -FinderFindModule(PyObject *self, PyObject *args)
                                      -{
                                      - char *fullname;
                                      - PyObject *module;
                                      - PyObject *new_path;
                                      - LoaderObject *loader;
                                      -
                                      - if (!PyArg_ParseTuple(args, "s", &fullname))
                                      - return NULL;
                                      -
                                      - if (!(new_path = Vim_GetPaths(self)))
                                      - return NULL;
                                      -
                                      - module = find_module(fullname, fullname, new_path);
                                      -
                                      - Py_DECREF(new_path);
                                      -
                                      - if (!module)
                                      - {
                                      - Py_INCREF(Py_None);
                                      - return Py_None;
                                      - }
                                      -
                                      - if (!(loader = PyObject_NEW(LoaderObject, &LoaderType)))
                                      - {
                                      - Py_DECREF(module);
                                      - return NULL;
                                      - }
                                      -
                                      - loader->module = module;
                                      -
                                      - return (PyObject *) loader;
                                      -}
                                      -
                                      - static PyObject *
                                      -VimPathHook(PyObject *self UNUSED, PyObject *args)
                                      -{
                                      - char *path;
                                      -
                                      - if (PyArg_ParseTuple(args, "s", &path)
                                      - && STRCMP(path, vim_special_path) == 0)
                                      - {
                                      - Py_INCREF(vim_module);
                                      - return vim_module;
                                      - }
                                      -
                                      - PyErr_Clear();
                                      - PyErr_SetNone(PyExc_ImportError);
                                      - return NULL;
                                      -}
                                      -
                                      static int
                                      PythonMod_Init(void)
                                      {
                                      @@ -1556,32 +1383,6 @@
                                      static char *(argv[2]) = {"/must>not&exist/foo", NULL};
                                      PyObject *imp;

                                      - if (!(imp = PyImport_ImportModule("imp")))
                                      - return -1;
                                      -
                                      - if (!(py_find_module = PyObject_GetAttrString(imp, "find_module")))
                                      - {
                                      - Py_DECREF(imp);
                                      - return -1;
                                      - }
                                      -
                                      - if (!(py_load_module = PyObject_GetAttrString(imp, "load_module")))
                                      - {
                                      - Py_DECREF(py_find_module);
                                      - Py_DECREF(imp);
                                      - return -1;
                                      - }
                                      -
                                      - Py_DECREF(imp);
                                      -
                                      - vim_memset(&LoaderType, 0, sizeof(LoaderType));
                                      - LoaderType.tp_name = "vim.Loader";
                                      - LoaderType.tp_basicsize = sizeof(LoaderObject);
                                      - LoaderType.tp_flags = Py_TPFLAGS_DEFAULT;
                                      - LoaderType.tp_doc = "vim message object";
                                      - LoaderType.tp_methods = LoaderMethods;
                                      - LoaderType.tp_dealloc = (destructor)LoaderDestructor;
                                      -
                                      if (init_types())
                                      return -1;

                                      diff -r 643f64bbd938 -r 27aa091d5fa5 src/if_python3.c
                                      --- a/src/if_python3.c Wed Jun 12 14:24:13 2013 +0400
                                      +++ b/src/if_python3.c Wed Jun 12 15:29:54 2013 +0400
                                      @@ -175,6 +175,7 @@
                                      # define PyObject_HasAttrString py3_PyObject_HasAttrString
                                      # define PyObject_SetAttrString py3_PyObject_SetAttrString
                                      # define PyObject_CallFunctionObjArgs py3_PyObject_CallFunctionObjArgs
                                      +# define _PyObject_CallFunction_SizeT py3__PyObject_CallFunction_SizeT
                                      # define PyObject_Call py3_PyObject_Call
                                      # define PyEval_GetLocals py3_PyEval_GetLocals
                                      # define PyEval_GetGlobals py3_PyEval_GetGlobals
                                      @@ -296,6 +297,7 @@
                                      static int (*py3_PyObject_HasAttrString)(PyObject *, const char *);
                                      static PyObject* (*py3_PyObject_SetAttrString)(PyObject *, const char *, PyObject *);
                                      static PyObject* (*py3_PyObject_CallFunctionObjArgs)(PyObject *, ...);
                                      +static PyObject* (*py3__PyObject_CallFunction_SizeT)(PyObject *, char *, ...);
                                      static PyObject* (*py3_PyObject_Call)(PyObject *, PyObject *, PyObject *);
                                      static PyObject* (*py3_PyEval_GetGlobals)();
                                      static PyObject* (*py3_PyEval_GetLocals)();
                                      @@ -458,6 +460,7 @@
                                      {"PyObject_HasAttrString", (PYTHON_PROC*)&py3_PyObject_HasAttrString},
                                      {"PyObject_SetAttrString", (PYTHON_PROC*)&py3_PyObject_SetAttrString},
                                      {"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&py3_PyObject_CallFunctionObjArgs},
                                      + {"_PyObject_CallFunction_SizeT", (PYTHON_PROC*)&py3__PyObject_CallFunction_SizeT},
                                      {"PyObject_Call", (PYTHON_PROC*)&py3_PyObject_Call},
                                      {"PyEval_GetGlobals", (PYTHON_PROC*)&py3_PyEval_GetGlobals},
                                      {"PyEval_GetLocals", (PYTHON_PROC*)&py3_PyEval_GetLocals},
                                      @@ -740,9 +743,6 @@

                                      static struct PyModuleDef vimmodule;

                                      -static PyObject *path_finder;
                                      -static PyObject *py_find_module = NULL;
                                      -
                                      #define PY_CAN_RECURSE

                                      /*
                                      @@ -1603,71 +1603,12 @@
                                      #endif

                                      static PyObject *
                                      -VimPathHook(PyObject *self UNUSED, PyObject *args)
                                      -{
                                      - char *path;
                                      -
                                      - if (PyArg_ParseTuple(args, "s", &path)
                                      - && STRCMP(path, vim_special_path) == 0)
                                      - {
                                      - Py_INCREF(&FinderType);
                                      - return (PyObject *) &FinderType;
                                      - }
                                      -
                                      - PyErr_Clear();
                                      - PyErr_SetNone(PyExc_ImportError);
                                      - return NULL;
                                      -}
                                      -
                                      - static PyObject *
                                      -FinderFindModule(PyObject *cls UNUSED, PyObject *fullname)
                                      -{
                                      - PyObject *new_path;
                                      - PyObject *r;
                                      -
                                      - if (!(new_path = Vim_GetPaths(NULL)))
                                      - return NULL;
                                      -
                                      - /* call find_module of the super() class */
                                      - r = PyObject_CallFunctionObjArgs(py_find_module, fullname, new_path, NULL);
                                      -
                                      - Py_DECREF(new_path);
                                      -
                                      - return r;
                                      -}
                                      -
                                      -static struct PyMethodDef FinderMethods[] = {
                                      - {"find_module", FinderFindModule, METH_CLASS|METH_O, ""},
                                      - {NULL, NULL, 0, NULL}
                                      -};
                                      -
                                      - static PyObject *
                                      Py3Init_vim(void)
                                      {
                                      /* The special value is removed from sys.path in Python3_Init(). */
                                      static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL};
                                      PyObject *importlib_machinery;

                                      - if (!(importlib_machinery = PyImport_ImportModule("importlib.machinery")))
                                      - return NULL;
                                      -
                                      - if (!(path_finder = PyObject_GetAttrString(importlib_machinery,
                                      - "PathFinder")))
                                      - {
                                      - Py_DECREF(importlib_machinery);
                                      - return NULL;
                                      - }
                                      -
                                      - Py_DECREF(importlib_machinery);
                                      -
                                      - vim_memset(&FinderType, 0, sizeof(FinderObject));
                                      - FinderType.tp_name = "vim.Finder";
                                      - FinderType.tp_basicsize = sizeof(FinderObject);
                                      - FinderType.tp_base = (PyTypeObject *) path_finder;
                                      - FinderType.tp_flags = Py_TPFLAGS_DEFAULT;
                                      - FinderType.tp_doc = "Vim finder class, for use with path hook";
                                      - FinderType.tp_methods = FinderMethods;
                                      -
                                      if (init_types())
                                      return NULL;


                                      --
                                      --
                                      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 vim_dev+unsubscribe@....
                                      For more options, visit https://groups.google.com/groups/opt_out.
                                    • Bram Moolenaar
                                      ... Thanks for the updates. Unfortunately, now both test 86 and 87 fail for me. Previously only test 86 was failing. python --version Python 2.7.3 python3
                                      Message 18 of 26 , Jun 12, 2013
                                      View Source
                                      • 0 Attachment
                                        ZyX wrote:

                                        > # HG changeset patch
                                        > # User ZyX <kp-pav@...>
                                        > # Date 1371036594 -14400
                                        > # Wed Jun 12 15:29:54 2013 +0400
                                        > # Branch python-path
                                        > # Node ID 27aa091d5fa525fd4ba97b4b68dc62e64e8bd3a0
                                        > # Parent 643f64bbd9386d746313a7678cfa08826b4a5122
                                        > Use the same method for python3 as for python2

                                        Thanks for the updates. Unfortunately, now both test 86 and 87 fail for
                                        me. Previously only test 86 was failing.

                                        python --version
                                        Python 2.7.3

                                        python3 --version
                                        Python 3.2.3

                                        % diff -u testdir/test86.ok testdir/test86.failed
                                        --- testdir/test86.ok 2013-06-12 14:21:28.000000000 +0200
                                        +++ testdir/test86.failed 2013-06-12 14:38:10.000000000 +0200
                                        @@ -1083,9 +1083,6 @@
                                        vim.current.window = True:TypeError:('expected vim.Window object',)
                                        vim.current.tabpage = True:TypeError:('expected vim.TabPage object',)
                                        vim.current.xxx = True:AttributeError:('xxx',)
                                        -2,xx
                                        -before
                                        -after
                                        vim.command("throw 'abc'"):error:('abc',)
                                        Exe("throw 'def'"):error:('def',)
                                        vim.eval("Exe('throw ''ghi''')"):error:('ghi',)

                                        % diff -u testdir/test87.ok testdir/test87.failed
                                        --- testdir/test87.ok 2013-06-12 14:12:13.000000000 +0200
                                        +++ testdir/test87.failed 2013-06-12 14:38:13.000000000 +0200
                                        @@ -1092,9 +1092,6 @@
                                        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',))


                                        --
                                        "Hit any key to continue" does _not_ mean you can hit the on/off button!

                                        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                        \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                        --
                                        --
                                        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 vim_dev+unsubscribe@....
                                        For more options, visit https://groups.google.com/groups/opt_out.
                                      • Nikolay Pavlov
                                        ... vim.Window object ,)) ... vim.TabPage object ,)) ... Could you show output of :messages right before quitting? It is obvious there was an exception, but I
                                        Message 19 of 26 , Jun 12, 2013
                                        View Source
                                        • 0 Attachment


                                          On Jun 12, 2013 4:41 PM, "Bram Moolenaar" <Bram@...> wrote:
                                          >
                                          >
                                          > ZyX wrote:
                                          >
                                          > > # HG changeset patch
                                          > > # User ZyX <kp-pav@...>
                                          > > # Date 1371036594 -14400
                                          > > #      Wed Jun 12 15:29:54 2013 +0400
                                          > > # Branch python-path
                                          > > # Node ID 27aa091d5fa525fd4ba97b4b68dc62e64e8bd3a0
                                          > > # Parent  643f64bbd9386d746313a7678cfa08826b4a5122
                                          > > Use the same method for python3 as for python2
                                          >
                                          > Thanks for the updates.  Unfortunately, now both test 86 and 87 fail for
                                          > me.  Previously only test 86 was failing.
                                          >
                                          > python --version
                                          > Python 2.7.3
                                          >
                                          > python3 --version
                                          > Python 3.2.3
                                          >
                                          > % diff -u testdir/test86.ok testdir/test86.failed
                                          > --- testdir/test86.ok   2013-06-12 14:21:28.000000000 +0200
                                          > +++ testdir/test86.failed       2013-06-12 14:38:10.000000000 +0200
                                          > @@ -1083,9 +1083,6 @@
                                          >  vim.current.window = True:TypeError:('expected vim.Window object',)
                                          >  vim.current.tabpage = True:TypeError:('expected vim.TabPage object',)
                                          >  vim.current.xxx = True:AttributeError:('xxx',)
                                          > -2,xx
                                          > -before
                                          > -after
                                          >  vim.command("throw 'abc'"):error:('abc',)
                                          >  Exe("throw 'def'"):error:('def',)
                                          >  vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
                                          >
                                          > % diff -u testdir/test87.ok testdir/test87.failed
                                          > --- testdir/test87.ok   2013-06-12 14:12:13.000000000 +0200
                                          > +++ testdir/test87.failed       2013-06-12 14:38:13.000000000 +0200
                                          > @@ -1092,9 +1092,6 @@
                                          >  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',))

                                          Could you show output of :messages right before quitting? It is obvious there was an exception, but I cannot say what it was.

                                          > --
                                          > "Hit any key to continue" does _not_ mean you can hit the on/off button!
                                          >
                                          >  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
                                          > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                          > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
                                          >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

                                          --
                                          --
                                          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 vim_dev+unsubscribe@....
                                          For more options, visit https://groups.google.com/groups/opt_out.
                                           
                                           
                                        • Jun T.
                                          ... (snip) ... I m getting the same error (python2.7.3 and python 3.2.3). It seems the tests are failing when they try to import module . The module module
                                          Message 20 of 26 , Jun 12, 2013
                                          View Source
                                          • 0 Attachment
                                            On 2013/06/12, at 21:41, Bram Moolenaar <Bram@...> wrote:
                                            > Thanks for the updates. Unfortunately, now both test 86 and 87 fail for
                                            > me.
                                            (snip)
                                            > -2,xx
                                            > -before
                                            > -after

                                            I'm getting the same error (python2.7.3 and python 3.2.3).

                                            It seems the tests are failing when they try to 'import module'.
                                            The module 'module' is in testdir/python{2,3}/module.py, which
                                            in turn imports a module named 'before_1'.

                                            Where is this module 'before_1' ?

                                            In addition, if I configure --with-python3interp=dynamic,
                                            test87 core dumps.
                                            This core dump can be fixed by the following patch:


                                            diff -r 8a49630c8a5f src/if_python3.c
                                            --- a/src/if_python3.c Wed Jun 12 22:41:37 2013 +0200
                                            +++ b/src/if_python3.c Thu Jun 13 12:25:31 2013 +0900
                                            @@ -488,7 +488,7 @@
                                            {"PyEval_InitThreads", (PYTHON_PROC*)&py3_PyEval_InitThreads},
                                            {"PyEval_RestoreThread", (PYTHON_PROC*)&py3_PyEval_RestoreThread},
                                            {"PyEval_SaveThread", (PYTHON_PROC*)&py3_PyEval_SaveThread},
                                            - {"PyArg_Parse", (PYTHON_PROC*)&py3_PyArg_Parse},
                                            + {"_PyArg_Parse_SizeT", (PYTHON_PROC*)&py3_PyArg_Parse},
                                            {"Py_IsInitialized", (PYTHON_PROC*)&py3_Py_IsInitialized},
                                            {"_PyObject_NextNotImplemented", (PYTHON_PROC*)&py3__PyObject_NextNotImplemented},
                                            {"_Py_NoneStruct", (PYTHON_PROC*)&py3__Py_NoneStruct},



                                            Note:
                                            Since PY_SSIZE_T_CLEAN is unconditionally defined in if_python3.c
                                            (and I think it is correct), the following part in if_python3.c
                                            (line 428) may be simplified to always use ssize_t-clean version.

                                            # ifndef PY_SSIZE_T_CLEAN
                                            {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
                                            {"Py_BuildValue", (PYTHON_PROC*)&py3_Py_BuildValue},
                                            # else
                                            {"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
                                            {"_Py_BuildValue_SizeT", (PYTHON_PROC*)&py3_Py_BuildValue},
                                            # endif


                                            --
                                            --
                                            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 vim_dev+unsubscribe@....
                                            For more options, visit https://groups.google.com/groups/opt_out.
                                          • Bram Moolenaar
                                            ... For test 86: Messages maintainer: Bram Moolenaar E325: ATTENTION test86.in 1124 lines, 30296 characters Xdotest [New File] 1113 lines,
                                            Message 21 of 26 , Jun 13, 2013
                                            View Source
                                            • 0 Attachment
                                              ZyX wrote:

                                              > > > # HG changeset patch
                                              > > > # User ZyX <kp-pav@...>
                                              > > > # Date 1371036594 -14400
                                              > > > # Wed Jun 12 15:29:54 2013 +0400
                                              > > > # Branch python-path
                                              > > > # Node ID 27aa091d5fa525fd4ba97b4b68dc62e64e8bd3a0
                                              > > > # Parent 643f64bbd9386d746313a7678cfa08826b4a5122
                                              > > > Use the same method for python3 as for python2
                                              > >
                                              > > Thanks for the updates. Unfortunately, now both test 86 and 87 fail for
                                              > > me. Previously only test 86 was failing.
                                              > >
                                              > > python --version
                                              > > Python 2.7.3
                                              > >
                                              > > python3 --version
                                              > > Python 3.2.3
                                              > >
                                              > > % diff -u testdir/test86.ok testdir/test86.failed
                                              > > --- testdir/test86.ok 2013-06-12 14:21:28.000000000 +0200
                                              > > +++ testdir/test86.failed 2013-06-12 14:38:10.000000000 +0200
                                              > > @@ -1083,9 +1083,6 @@
                                              > > vim.current.window = True:TypeError:('expected vim.Window object',)
                                              > > vim.current.tabpage = True:TypeError:('expected vim.TabPage object',)
                                              > > vim.current.xxx = True:AttributeError:('xxx',)
                                              > > -2,xx
                                              > > -before
                                              > > -after
                                              > > vim.command("throw 'abc'"):error:('abc',)
                                              > > Exe("throw 'def'"):error:('def',)
                                              > > vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
                                              > >
                                              > > % diff -u testdir/test87.ok testdir/test87.failed
                                              > > --- testdir/test87.ok 2013-06-12 14:12:13.000000000 +0200
                                              > > +++ testdir/test87.failed 2013-06-12 14:38:13.000000000 +0200
                                              > > @@ -1092,9 +1092,6 @@
                                              > > 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',))
                                              >
                                              > Could you show output of :messages right before quitting? It is obvious
                                              > there was an exception, but I cannot say what it was.

                                              For test 86:

                                              Messages maintainer: Bram Moolenaar <Bram@...>
                                              E325: ATTENTION
                                              "test86.in" 1124 lines, 30296 characters
                                              "Xdotest" [New File] 1113 lines, 30003 characters written
                                              "Xdotest" [New File] 1113 lines, 30003 characters written
                                              E484: Can't open file small.vim
                                              Error detected while processing function Test:
                                              line 159:
                                              Traceback (most recent call last):
                                              File "<string>", line 1, in <module>
                                              vim.error: list is locked
                                              8 more lines
                                              3 more lines
                                              Already only one window
                                              abcdef
                                              line 741:
                                              abcdef
                                              abc
                                              line 743:
                                              abc
                                              7 more lines
                                              line 1081:
                                              Traceback (most recent call last):
                                              File "<string>", line 4, in <module>
                                              ImportError: No module named module
                                              "test86.in" [Modified][Not edited] line 1554 of 2214 --70%-- col


                                              Test 87:

                                              Messages maintainer: Bram Moolenaar <Bram@...>
                                              E325: ATTENTION
                                              "test87.in" 1080 lines, 29342 characters
                                              "Xdotest" [New File] 1074 lines, 29258 characters written
                                              "Xdotest" [New File] 1074 lines, 29258 characters written
                                              E484: Can't open file small.vim
                                              Error detected while processing function Test:
                                              line 158:
                                              Traceback (most recent call last):
                                              File "<string>", line 1, in <module>
                                              vim.error: list is locked
                                              8 more lines
                                              3 more lines
                                              Already only one window
                                              abcdef
                                              line 706:
                                              abcdef
                                              abc
                                              line 708:
                                              abc
                                              7 more lines
                                              line 1043:
                                              Traceback (most recent call last):
                                              File "<string>", line 4, in <module>
                                              ImportError: No module named module
                                              "test87.in" [Modified][Not edited] line 1499 of 2179 --68%-- col 1


                                              --
                                              hundred-and-one symptoms of being an internet addict:
                                              177. You log off of your system because it's time to go to work.

                                              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                              \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                              --
                                              --
                                              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 vim_dev+unsubscribe@....
                                              For more options, visit https://groups.google.com/groups/opt_out.
                                            • Nikolay Pavlov
                                              ... for ... vim.Window object ,)) ... vim.TabPage object ,)) ... AttributeError( xxx ,)) ... Some files are missing in the diff, but [present](
                                              Message 22 of 26 , Jun 13, 2013
                                              View Source
                                              • 0 Attachment


                                                On Jun 13, 2013 2:40 PM, "Bram Moolenaar" <Bram@...> wrote:
                                                >
                                                >
                                                > ZyX wrote:
                                                >
                                                > > > > # HG changeset patch
                                                > > > > # User ZyX <kp-pav@...>
                                                > > > > # Date 1371036594 -14400
                                                > > > > #      Wed Jun 12 15:29:54 2013 +0400
                                                > > > > # Branch python-path
                                                > > > > # Node ID 27aa091d5fa525fd4ba97b4b68dc62e64e8bd3a0
                                                > > > > # Parent  643f64bbd9386d746313a7678cfa08826b4a5122
                                                > > > > Use the same method for python3 as for python2
                                                > > >
                                                > > > Thanks for the updates.  Unfortunately, now both test 86 and 87 fail for
                                                > > > me.  Previously only test 86 was failing.
                                                > > >
                                                > > > python --version
                                                > > > Python 2.7.3
                                                > > >
                                                > > > python3 --version
                                                > > > Python 3.2.3
                                                > > >
                                                > > > % diff -u testdir/test86.ok testdir/test86.failed
                                                > > > --- testdir/test86.ok   2013-06-12 14:21:28.000000000 +0200
                                                > > > +++ testdir/test86.failed       2013-06-12 14:38:10.000000000 +0200
                                                > > > @@ -1083,9 +1083,6 @@
                                                > > >  vim.current.window = True:TypeError:('expected vim.Window object',)
                                                > > >  vim.current.tabpage = True:TypeError:('expected vim.TabPage object',)
                                                > > >  vim.current.xxx = True:AttributeError:('xxx',)
                                                > > > -2,xx
                                                > > > -before
                                                > > > -after
                                                > > >  vim.command("throw 'abc'"):error:('abc',)
                                                > > >  Exe("throw 'def'"):error:('def',)
                                                > > >  vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
                                                > > >
                                                > > > % diff -u testdir/test87.ok testdir/test87.failed
                                                > > > --- testdir/test87.ok   2013-06-12 14:12:13.000000000 +0200
                                                > > > +++ testdir/test87.failed       2013-06-12 14:38:13.000000000 +0200
                                                > > > @@ -1092,9 +1092,6 @@
                                                > > >  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',))
                                                > >
                                                > > Could you show output of :messages right before quitting? It is obvious
                                                > > there was an exception, but I cannot say what it was.
                                                >
                                                > For test 86:
                                                >
                                                > Messages maintainer: Bram Moolenaar <Bram@...>
                                                > E325: ATTENTION
                                                > "test86.in" 1124 lines, 30296 characters
                                                > "Xdotest" [New File] 1113 lines, 30003 characters written
                                                > "Xdotest" [New File] 1113 lines, 30003 characters written
                                                > E484: Can't open file small.vim
                                                > Error detected while processing function Test:
                                                > line  159:
                                                > Traceback (most recent call last):
                                                >   File "<string>", line 1, in <module>
                                                > vim.error: list is locked
                                                > 8 more lines
                                                > 3 more lines
                                                > Already only one window
                                                > abcdef
                                                > line  741:
                                                > abcdef
                                                > abc
                                                > line  743:
                                                > abc
                                                > 7 more lines
                                                > line 1081:
                                                > Traceback (most recent call last):
                                                >   File "<string>", line 4, in <module>
                                                > ImportError: No module named module
                                                > "test86.in" [Modified][Not edited] line 1554 of 2214 --70%-- col
                                                >
                                                >
                                                > Test 87:
                                                >
                                                > Messages maintainer: Bram Moolenaar <Bram@...>
                                                > E325: ATTENTION
                                                > "test87.in" 1080 lines, 29342 characters
                                                > "Xdotest" [New File] 1074 lines, 29258 characters written
                                                > "Xdotest" [New File] 1074 lines, 29258 characters written
                                                > E484: Can't open file small.vim
                                                > Error detected while processing function Test:
                                                > line  158:
                                                > Traceback (most recent call last):
                                                >   File "<string>", line 1, in <module>
                                                > vim.error: list is locked
                                                > 8 more lines
                                                > 3 more lines
                                                > Already only one window
                                                > abcdef
                                                > line  706:
                                                > abcdef
                                                > abc
                                                > line  708:
                                                > abc
                                                > 7 more lines
                                                > line 1043:
                                                > Traceback (most recent call last):
                                                >   File "<string>", line 4, in <module>
                                                > ImportError: No module named module
                                                > "test87.in" [Modified][Not edited] line 1499 of 2179 --68%-- col 1

                                                Some files are missing in the diff, but [present](https://bitbucket.org/ZyX_I/vim/commits/a1b8a5ddecec70085e7e62f8ea9bc6c46ecea530#chg-src/testdir/python_before/before_1.py) in the commit. diff -c should be missing them: with -N flag used they are considered not changed (-N treats missing files as empty ... and added files are also empty). But hg export ... I did not expect such failure.

                                                > --
                                                > hundred-and-one symptoms of being an internet addict:
                                                > 177. You log off of your system because it's time to go to work.
                                                >
                                                >  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
                                                > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                                > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
                                                >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

                                                --
                                                --
                                                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 vim_dev+unsubscribe@....
                                                For more options, visit https://groups.google.com/groups/opt_out.
                                                 
                                                 
                                              • Elimar Riesebieter
                                                * Jun T. [2013-06-13 13:42 +0900]: [...] ... Confirmed ;-) Elimar -- Numeric stability is probably not all that important when
                                                Message 23 of 26 , Jun 13, 2013
                                                View Source
                                                • 0 Attachment
                                                  * Jun T. <takimoto-j@...> [2013-06-13 13:42 +0900]:

                                                  [...]
                                                  > In addition, if I configure --with-python3interp=dynamic,
                                                  > test87 core dumps.
                                                  > This core dump can be fixed by the following patch:
                                                  >
                                                  >
                                                  > diff -r 8a49630c8a5f src/if_python3.c
                                                  > --- a/src/if_python3.c Wed Jun 12 22:41:37 2013 +0200
                                                  > +++ b/src/if_python3.c Thu Jun 13 12:25:31 2013 +0900
                                                  > @@ -488,7 +488,7 @@
                                                  > {"PyEval_InitThreads", (PYTHON_PROC*)&py3_PyEval_InitThreads},
                                                  > {"PyEval_RestoreThread", (PYTHON_PROC*)&py3_PyEval_RestoreThread},
                                                  > {"PyEval_SaveThread", (PYTHON_PROC*)&py3_PyEval_SaveThread},
                                                  > - {"PyArg_Parse", (PYTHON_PROC*)&py3_PyArg_Parse},
                                                  > + {"_PyArg_Parse_SizeT", (PYTHON_PROC*)&py3_PyArg_Parse},
                                                  > {"Py_IsInitialized", (PYTHON_PROC*)&py3_Py_IsInitialized},
                                                  > {"_PyObject_NextNotImplemented", (PYTHON_PROC*)&py3__PyObject_NextNotImplemented},
                                                  > {"_Py_NoneStruct", (PYTHON_PROC*)&py3__Py_NoneStruct},

                                                  Confirmed ;-)

                                                  Elimar
                                                  --
                                                  Numeric stability is probably not all that
                                                  important when you're guessing;-)

                                                  --
                                                  --
                                                  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 vim_dev+unsubscribe@....
                                                  For more options, visit https://groups.google.com/groups/opt_out.
                                                • Bram Moolenaar
                                                  ... OK, adding the missing empty files make the tests pass. I added a comment, empty files may indeed be ignored by some tools. Don t you have some way to
                                                  Message 24 of 26 , Jun 13, 2013
                                                  View Source
                                                  • 0 Attachment
                                                    ZyX wrote:

                                                    > > > Thanks for the updates. Unfortunately, now both test 86 and 87
                                                    > > > fail for me. Previously only test 86 was failing.

                                                    > Some files are missing in the diff, but [present](
                                                    > https://bitbucket.org/ZyX_I/vim/commits/a1b8a5ddecec70085e7e62f8ea9bc6c46ecea530#chg-src/testdir/python_before/before_1.py)
                                                    > in the commit. diff -c should be missing them: with -N flag used they are
                                                    > considered not changed (-N treats missing files as empty ... and added
                                                    > files are also empty). But hg export ... I did not expect such failure.

                                                    OK, adding the missing "empty" files make the tests pass.
                                                    I added a comment, empty files may indeed be ignored by some tools.

                                                    Don't you have some way to diff your version with the released
                                                    version in Mercurial?

                                                    --
                                                    hundred-and-one symptoms of being an internet addict:
                                                    181. You make up words that go with the "happy tune" your modem makes
                                                    while dialing your ISP.

                                                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                                    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                                    \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                                    \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                                    --
                                                    --
                                                    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 vim_dev+unsubscribe@....
                                                    For more options, visit https://groups.google.com/groups/opt_out.
                                                  • Bram Moolenaar
                                                    ... Solved in patch 7.3.1183. ... Thanks, I ll include that. ... Yes, for Python 3 PY_SSIZE_T_CLEAN should always be defined. -- hundred-and-one symptoms of
                                                    Message 25 of 26 , Jun 13, 2013
                                                    View Source
                                                    • 0 Attachment
                                                      Jun Takimoto wrote:

                                                      > On 2013/06/12, at 21:41, Bram Moolenaar <Bram@...> wrote:
                                                      > > Thanks for the updates. Unfortunately, now both test 86 and 87 fail for
                                                      > > me.
                                                      > (snip)
                                                      > > -2,xx
                                                      > > -before
                                                      > > -after
                                                      >
                                                      > I'm getting the same error (python2.7.3 and python 3.2.3).
                                                      >
                                                      > It seems the tests are failing when they try to 'import module'.
                                                      > The module 'module' is in testdir/python{2,3}/module.py, which
                                                      > in turn imports a module named 'before_1'.
                                                      >
                                                      > Where is this module 'before_1' ?

                                                      Solved in patch 7.3.1183.

                                                      > In addition, if I configure --with-python3interp=dynamic,
                                                      > test87 core dumps.
                                                      > This core dump can be fixed by the following patch:
                                                      >
                                                      >
                                                      > diff -r 8a49630c8a5f src/if_python3.c
                                                      > --- a/src/if_python3.c Wed Jun 12 22:41:37 2013 +0200
                                                      > +++ b/src/if_python3.c Thu Jun 13 12:25:31 2013 +0900
                                                      > @@ -488,7 +488,7 @@
                                                      > {"PyEval_InitThreads", (PYTHON_PROC*)&py3_PyEval_InitThreads},
                                                      > {"PyEval_RestoreThread", (PYTHON_PROC*)&py3_PyEval_RestoreThread},
                                                      > {"PyEval_SaveThread", (PYTHON_PROC*)&py3_PyEval_SaveThread},
                                                      > - {"PyArg_Parse", (PYTHON_PROC*)&py3_PyArg_Parse},
                                                      > + {"_PyArg_Parse_SizeT", (PYTHON_PROC*)&py3_PyArg_Parse},
                                                      > {"Py_IsInitialized", (PYTHON_PROC*)&py3_Py_IsInitialized},
                                                      > {"_PyObject_NextNotImplemented", (PYTHON_PROC*)&py3__PyObject_NextNotImplemented},
                                                      > {"_Py_NoneStruct", (PYTHON_PROC*)&py3__Py_NoneStruct},

                                                      Thanks, I'll include that.

                                                      > Note:
                                                      > Since PY_SSIZE_T_CLEAN is unconditionally defined in if_python3.c
                                                      > (and I think it is correct), the following part in if_python3.c
                                                      > (line 428) may be simplified to always use ssize_t-clean version.
                                                      >
                                                      > # ifndef PY_SSIZE_T_CLEAN
                                                      > {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
                                                      > {"Py_BuildValue", (PYTHON_PROC*)&py3_Py_BuildValue},
                                                      > # else
                                                      > {"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
                                                      > {"_Py_BuildValue_SizeT", (PYTHON_PROC*)&py3_Py_BuildValue},
                                                      > # endif

                                                      Yes, for Python 3 PY_SSIZE_T_CLEAN should always be defined.

                                                      --
                                                      hundred-and-one symptoms of being an internet addict:
                                                      187. You promise yourself that you'll only stay online for another
                                                      15 minutes...at least once every hour.

                                                      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                                      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                                      \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                                      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                                      --
                                                      --
                                                      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 vim_dev+unsubscribe@....
                                                      For more options, visit https://groups.google.com/groups/opt_out.
                                                    • Justin Charette
                                                      ... I have a related problem with the vdebug plugin[1] on vim 7.6.1163 with python 2.7.3. I just want to confirm that 7.3.1183 is expected to fix this issue.
                                                      Message 26 of 26 , Jun 16, 2013
                                                      View Source
                                                      • 0 Attachment
                                                        On Thursday, June 13, 2013 11:58:16 AM UTC-7, Bram Moolenaar wrote:
                                                        > Jun Takimoto wrote:
                                                        >
                                                        >
                                                        >
                                                        > > On 2013/06/12, at 21:41, Bram Moolenaar wrote:
                                                        >
                                                        > > > Thanks for the updates. Unfortunately, now both test 86 and 87 fail for
                                                        >
                                                        > > > me.
                                                        >
                                                        > > (snip)
                                                        >
                                                        > > > -2,xx
                                                        >
                                                        > > > -before
                                                        >
                                                        > > > -after
                                                        >
                                                        > >
                                                        >
                                                        > > I'm getting the same error (python2.7.3 and python 3.2.3).
                                                        >
                                                        > >
                                                        >
                                                        > > It seems the tests are failing when they try to 'import module'.
                                                        >
                                                        > > The module 'module' is in testdir/python{2,3}/module.py, which
                                                        >
                                                        > > in turn imports a module named 'before_1'.
                                                        >
                                                        > >
                                                        >
                                                        > > Where is this module 'before_1' ?
                                                        >
                                                        >
                                                        >
                                                        > Solved in patch 7.3.1183.

                                                        I have a related problem with the vdebug plugin[1] on vim 7.6.1163 with python 2.7.3. I just want to confirm that 7.3.1183 is expected to fix this issue.

                                                        [1] https://github.com/joonty/vdebug/issues/93

                                                        --
                                                        --
                                                        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 vim_dev+unsubscribe@....
                                                        For more options, visit https://groups.google.com/groups/opt_out.
                                                      Your message has been successfully submitted and would be delivered to recipients shortly.