summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-24 22:33:30 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-24 22:33:30 +0200
commitdaa270289b0eeb8467b1fea47e72d4727f2f7d28 (patch)
treec56b7b6cceed1a2f7409844dbf399ae453e1aa5e
parentc8c13a0307bd6a6b5d27875de03d01a3e3ff311c (diff)
downloadvim-git-daa270289b0eeb8467b1fea47e72d4727f2f7d28.tar.gz
updated for version 7.3.1242v7.3.1242
Problem: No failure when trying to use a number as a string. Solution: Give an error when StringToLine() is called with an instance of the wrong type. (Jun Takimoto)
-rw-r--r--src/if_py_both.h15
-rw-r--r--src/version.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index d66e2cbd1..b564d24b5 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -3549,13 +3549,26 @@ StringToLine(PyObject *obj)
if (!(bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL)))
return NULL;
- if(PyBytes_AsStringAndSize(bytes, &str, &len) == -1
+ if (PyBytes_AsStringAndSize(bytes, &str, &len) == -1
|| str == NULL)
{
Py_DECREF(bytes);
return NULL;
}
}
+ else
+ {
+#if PY_MAJOR_VERSION < 3
+ PyErr_FORMAT(PyExc_TypeError,
+ N_("expected str() or unicode() instance, but got %s"),
+ Py_TYPE_NAME(obj));
+#else
+ PyErr_FORMAT(PyExc_TypeError,
+ N_("expected bytes() or str() instance, but got %s"),
+ Py_TYPE_NAME(obj));
+#endif
+ return NULL;
+ }
/*
* Error checking: String must not contain newlines, as we
diff --git a/src/version.c b/src/version.c
index 41e9e4d23..cd804017c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1242,
+/**/
1241,
/**/
1240,