Mercurial > genshi > mirror
changeset 944:5c7d69204287 stable-0.6.x
Merge r1168 from trunk (fix error in dealing with None in the implemenation of Markup.escape in _speedups.c, see #439).
author | hodgestar |
---|---|
date | Wed, 03 Aug 2011 17:43:27 +0000 |
parents | 303af96ec546 |
children | 6492fab2229a |
files | genshi/_speedups.c genshi/tests/core.py |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/genshi/_speedups.c +++ b/genshi/_speedups.c @@ -194,7 +194,12 @@ return NULL; } if (PyObject_Not(text)) { - return type->tp_new(type, args, NULL); + args = PyTuple_New(0); + if (args == NULL) + return NULL; + text = type->tp_new(type, args, NULL); + Py_DECREF(args); + return text; } if (PyObject_TypeCheck(text, type)) { Py_INCREF(text);
--- a/genshi/tests/core.py +++ b/genshi/tests/core.py @@ -86,6 +86,11 @@ assert type(markup) is Markup self.assertEquals(string, unescape(markup)) + def test_Markup_escape_None_noquotes(self): + markup = Markup.escape(None, False) + assert type(markup) is Markup + self.assertEquals('', markup) + def test_add_str(self): markup = Markup('<b>foo</b>') + '<br/>' assert type(markup) is Markup