aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pypy/module/cpyext/object.py')
-rw-r--r--pypy/module/cpyext/object.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
index 776886db50..346ac6515e 100644
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -195,6 +195,10 @@ def PyObject_Repr(space, w_obj):
def PyObject_Format(space, w_obj, w_format_spec):
if w_format_spec is None:
w_format_spec = space.newtext('')
+ # issue 3404: handle PyObject_Format(type('a'), '')
+ if (space.isinstance_w(w_format_spec, space.w_unicode) and
+ space.len_w(w_format_spec) == 0):
+ return space.unicode_from_object(w_obj)
w_ret = space.call_method(w_obj, '__format__', w_format_spec)
if space.isinstance_w(w_format_spec, space.w_unicode):
return space.unicode_from_object(w_ret)