From 0b4355219bf825a58255aca868347578e10eb331 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Jul 04 2013 13:36:38 +0000 Subject: - patchlevel 1242 --- diff --git a/7.3.1242 b/7.3.1242 new file mode 100644 index 0000000..025dfff --- /dev/null +++ b/7.3.1242 @@ -0,0 +1,78 @@ +To: vim_dev@googlegroups.com +Subject: Patch 7.3.1242 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.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) +Files: src/if_py_both.h + + +*** ../vim-7.3.1241/src/if_py_both.h 2013-06-24 21:21:52.000000000 +0200 +--- src/if_py_both.h 2013-06-24 22:30:51.000000000 +0200 +*************** +*** 3549,3561 **** + if (!(bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL))) + return NULL; + +! if(PyBytes_AsStringAndSize(bytes, &str, &len) == -1 + || str == NULL) + { + Py_DECREF(bytes); + return NULL; + } + } + + /* + * Error checking: String must not contain newlines, as we +--- 3549,3574 ---- + if (!(bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL))) + return NULL; + +! 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 +*** ../vim-7.3.1241/src/version.c 2013-06-24 22:23:51.000000000 +0200 +--- src/version.c 2013-06-24 22:32:19.000000000 +0200 +*************** +*** 730,731 **** +--- 730,733 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 1242, + /**/ + +-- +A successful man is one who makes more money than his wife can spend. +A successful woman is one who can find such a man. + + /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///