[pypy-commit] pypy fix-result-types: begin chopping up find_binop_result_dtype()
rlamy
noreply at buildbot.pypy.org
Sun May 10 16:57:41 CEST 2015
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: fix-result-types
Changeset: r77280:6d6342a32aba
Date: 2015-05-09 19:44 +0100
http://bitbucket.org/pypy/pypy/changeset/6d6342a32aba/
Log: begin chopping up find_binop_result_dtype()
diff --git a/pypy/module/micronumpy/casting.py b/pypy/module/micronumpy/casting.py
--- a/pypy/module/micronumpy/casting.py
+++ b/pypy/module/micronumpy/casting.py
@@ -164,16 +164,18 @@
return dt1
if dt1 is None:
return dt2
+ # Some operations promote op(bool, bool) to return int8, rather than bool
+ if promote_bools and (dt1.kind == dt2.kind == NPY.GENBOOLLTR):
+ return get_dtype_cache(space).w_int8dtype
+ return _promote_types(space, dt1, dt2, promote_to_float)
+def _promote_types(space, dt1, dt2, promote_to_float=False):
if dt1.num == NPY.OBJECT or dt2.num == NPY.OBJECT:
return get_dtype_cache(space).w_objectdtype
# dt1.num should be <= dt2.num
if dt1.num > dt2.num:
dt1, dt2 = dt2, dt1
- # Some operations promote op(bool, bool) to return int8, rather than bool
- if promote_bools and (dt1.kind == dt2.kind == NPY.GENBOOLLTR):
- return get_dtype_cache(space).w_int8dtype
# Everything numeric promotes to complex
if dt2.is_complex() or dt1.is_complex():
More information about the pypy-commit
mailing list