StringToLine(obj) in if_py_both.h should return NULL if obj is neither
8bit string nor unicode string. 

As a simple example, try the following script:

:py import vim
:py b = vim.current.buffer
:py b.append([1,2])

This adds two empty lines to the current buffer (instead of throwing an error).

In the following patch, I just copied the error handling from StringToChars().


diff -r 7a5c346861e1 src/if_py_both.h
--- a/src/if_py_both.h  Sun Jun 23 16:40:40 2013 +0200
+++ b/src/if_py_both.h  Mon Jun 24 22:31:27 2013 +0900
@@ -3552,6 +3552,16 @@
            return NULL;
        }
     }
+    else {
+       PyErr_FORMAT(PyExc_TypeError,
+#if PY_MAJOR_VERSION < 3
+               N_("expected str() or unicode() instance, but got %s")
+#else
+               N_("expected bytes() or str() instance, but got %s")
+#endif
+               , Py_TYPE_NAME(obj));
+       return NULL;
+    }
 
     /*
      * Error checking: String must not contain newlines, as we




-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to