summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Henriksen <insertinterestingnamehere@gmail.com>2016-03-03 15:21:00 -0700
committerIan Henriksen <insertinterestingnamehere@gmail.com>2016-03-03 15:23:50 -0700
commit16ad9e21da64c4de4f964980ad1b8c18ca70035b (patch)
tree23155daba75fd21256e4ea8b360bc9bb04471637
parent812cd069193e36707c4bce3e53f47de40cf982e6 (diff)
downloadcython-16ad9e21da64c4de4f964980ad1b8c18ca70035b.tar.gz
Don't error out when non-const value is passed as a const specified
parameter to a function. When function arguments are marked as const, this means that the function should not modify them, not that non-const arguments are not allowed. This also fixes a test that began failing because this change resulted in a slightly different error message when conversion to a const qualified argument is not possible.
-rw-r--r--Cython/Compiler/ExprNodes.py2
-rw-r--r--tests/errors/cpp_no_auto_conversion.pyx2
2 files changed, 3 insertions, 1 deletions
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 5b39da436..0a47dca3b 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -5052,6 +5052,8 @@ class SimpleCallNode(CallNode):
for i in range(min(max_nargs, actual_nargs)):
formal_arg = func_type.args[i]
formal_type = formal_arg.type
+ if formal_type.is_const:
+ formal_type = formal_type.const_base_type
arg = args[i].coerce_to(formal_type, env)
if formal_arg.not_none:
# C methods must do the None checks at *call* time
diff --git a/tests/errors/cpp_no_auto_conversion.pyx b/tests/errors/cpp_no_auto_conversion.pyx
index eb7889ba5..1312c3e17 100644
--- a/tests/errors/cpp_no_auto_conversion.pyx
+++ b/tests/errors/cpp_no_auto_conversion.pyx
@@ -19,5 +19,5 @@ cdef long long e = constructor_overload(17)
_ERRORS = u"""
-18:40: Cannot assign type 'long' to 'const wrapped_int'
+18:40: Cannot assign type 'long' to 'wrapped_int'
"""