Skip to content

Commit 68532aa

Browse files
authored
Correct results type for untransalatable function (pyccel#1950)
The MacOS runner has been updated which has led to a warning being upgraded to an error, breaking our CI. It seems that there are some untransalatable functions which should return integers instead of `PythonObject*`s. This information can be deduced from the type of `self._error_exit_code`. Correcting the return type fixes the CI. Fixes pyccel#1951
1 parent bbe2443 commit 68532aa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ All notable changes to this project will be documented in this file.
5151
- #1927 : Improve error Message for missing target language compiler in Pyccel
5252
- #1933 : Improve code printing speed.
5353
- #1930 : Preserve ordering of import targets.
54+
- #1951 : Fix return type for class whose argument cannot be wrapped.
5455

5556
### Changed
5657

pyccel/codegen/wrapper/c_to_python_wrapper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,10 @@ def _get_untranslatable_function(self, name, scope, original_function, error_msg
443443
The new function which raises the error.
444444
"""
445445
func_args = [FunctionDefArgument(self.get_new_PyObject(n)) for n in ("self", "args", "kwargs")]
446-
func_results = [FunctionDefResult(self.get_new_PyObject("result", is_temp=True))]
446+
if self._error_exit_code is Nil():
447+
func_results = [FunctionDefResult(self.get_new_PyObject("result", is_temp=True))]
448+
else:
449+
func_results = [FunctionDefResult(self.scope.get_temporary_variable(self._error_exit_code.class_type, "result"))]
447450
function = PyFunctionDef(name = name, arguments = func_args, results = func_results,
448451
body = [FunctionCall(PyErr_SetString, [PyNotImplementedError,
449452
LiteralString(error_msg)]),

0 commit comments

Comments
 (0)