Kaydet (Commit) 8a0217cd authored tarafından Eric Smith's avatar Eric Smith

Port 60893 to py3k, without unicode test.

üst 537a6258
...@@ -493,6 +493,22 @@ render_field(PyObject *fieldobj, SubString *format_spec, OutputString *output) ...@@ -493,6 +493,22 @@ render_field(PyObject *fieldobj, SubString *format_spec, OutputString *output)
if (result == NULL) if (result == NULL)
goto done; goto done;
#if PY_VERSION_HEX >= 0x03000000
assert(PyString_Check(result));
#else
assert(PyString_Check(result) || PyUnicode_Check(result));
/* Convert result to our type. We could be str, and result could
be unicode */
{
PyObject *tmp = STRINGLIB_TOSTR(result);
if (tmp == NULL)
goto done;
Py_DECREF(result);
result = tmp;
}
#endif
ok = output_data(output, ok = output_data(output,
STRINGLIB_STR(result), STRINGLIB_LEN(result)); STRINGLIB_STR(result), STRINGLIB_LEN(result));
done: done:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment