Commit 1c213b2b authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.28.x'

parents 0d37e44c ac6b858e
......@@ -34,6 +34,9 @@ Bugs fixed
* Overriding cpdef methods did not work in Python subclasses with slots.
(Github issue #1771)
* ``UnicodeEncodeError`` in Py2 when ``%s`` formatting is optimised for
unicode strings.
0.28.2 (2018-04-13)
===================
......
......@@ -3164,7 +3164,7 @@ class FormattedValueNode(ExprNode):
c_format_spec = None
find_conversion_func = {
's': 'PyObject_Str',
's': 'PyObject_Unicode',
'r': 'PyObject_Repr',
'a': 'PyObject_ASCII', # NOTE: mapped to PyObject_Repr() in Py2
}.get
......
......@@ -586,6 +586,7 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#define PyObject_Unicode PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
......
......@@ -500,3 +500,16 @@ def generated_fstring(int i, unicode u not None, o):
u, u, u, u,
o, o, o, o,
)
@cython.test_assert_path_exists(
"//FormattedValueNode",
"//AddNode",
)
def percent_s_unicode(u, int i):
u"""
>>> u = u'x\u0194z'
>>> print(percent_s_unicode(u, 12))
x\u0194z-12
"""
return u"%s-%d" % (u, i)
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