[pypy-commit] pypy fix-result-types: Ensure that casting_table and promotion_table are built deterministically
rlamy
noreply at buildbot.pypy.org
Thu May 28 17:32:17 CEST 2015
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: fix-result-types
Changeset: r77657:ca908627b665
Date: 2015-05-28 16:32 +0100
http://bitbucket.org/pypy/pypy/changeset/ca908627b665/
Log: Ensure that casting_table and promotion_table are built
deterministically (they used to depend on the ordering of the
globals() dict)
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -2498,6 +2498,8 @@
if issubclass(tp, ComplexFloating):
all_complex_types.append((tp, 'complex'))
complex_types.append(tp)
+ for l in [float_types, int_types, complex_types]:
+ l.sort(key=lambda tp: tp.num)
_setup()
del _setup
@@ -2577,9 +2579,8 @@
if _can_cast(tp1, tp3) and _can_cast(tp2, tp3):
if result is None:
result = tp3
- else:
- if _can_cast(tp3, result):
- result = tp3
+ elif _can_cast(tp3, result) and not _can_cast(result, tp3):
+ result = tp3
promotes(tp1, tp2, result)
More information about the pypy-commit
mailing list