Jun Takimoto wrote:
> 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
ZyX, does this look OK to you?
--
ZOOT: I'm afraid our life must seem very dull and quiet compared to yours.
We are but eightscore young blondes, all between sixteen and
nineteen-and-a-half, cut off in this castle, with no one to protect us.
Oooh. It is a lonely life ... bathing ... dressing ... undressing ...
making exciting underwear....
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.