Commit 6cd7c8f3 authored by Robert Bradshaw's avatar Robert Bradshaw

Avoid const types in inference.

This fixes #1798.
parent fb5e9200
...@@ -4338,6 +4338,10 @@ def widest_numeric_type(type1, type2): ...@@ -4338,6 +4338,10 @@ def widest_numeric_type(type1, type2):
type1 = type1.ref_base_type type1 = type1.ref_base_type
if type2.is_reference: if type2.is_reference:
type2 = type2.ref_base_type type2 = type2.ref_base_type
if type1.is_const:
type1 = type1.const_base_type
if type2.is_const:
type2 = type2.const_base_type
if type1 == type2: if type1 == type2:
widest_type = type1 widest_type = type1
elif type1.is_complex or type2.is_complex: elif type1.is_complex or type2.is_complex:
......
...@@ -191,3 +191,14 @@ def py_div_long(long a, long b): ...@@ -191,3 +191,14 @@ def py_div_long(long a, long b):
OverflowError: ... OverflowError: ...
""" """
return a / b return a / b
def c_div_const_test(a, b):
"""
>>> c_div_const_test(5, 3)
1
"""
return c_div_const(a, b)
cdef long c_div_const(const long a, int b):
cdef long c = a / b
return c
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