[pypy-commit] pypy _warnings: copy cpython behaviour

mattip pypy.commits at gmail.com
Fri Sep 30 02:37:50 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: _warnings
Changeset: r87463:262030adf8f1
Date: 2016-09-30 09:37 +0300
http://bitbucket.org/pypy/pypy/changeset/262030adf8f1/

Log:	copy cpython behaviour

diff --git a/pypy/module/_warnings/interp_warnings.py b/pypy/module/_warnings/interp_warnings.py
--- a/pypy/module/_warnings/interp_warnings.py
+++ b/pypy/module/_warnings/interp_warnings.py
@@ -248,6 +248,10 @@
     if space.isinstance_w(w_message, space.w_Warning):
         w_text = space.str(w_message)
         w_category = space.type(w_message)
+    elif (not space.isinstance_w(w_message, space.w_unicode) or
+          not space.isinstance_w(w_message, space.w_str)):
+        w_text = space.str(w_message)
+        w_message = space.call_function(w_category, w_message)
     else:
         w_text = w_message
         w_message = space.call_function(w_category, w_message)


More information about the pypy-commit mailing list