Calling function in python extension module with wrong type crashes python.
- Dominant language
- Python
- Stars
- 16.8k
- Forks
- 603
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 6
Description
Compiling the following function to a python extension module and calling it with the wrong type, will crash the python interpreter instead of just trowing an exception:
```python
$ cat wrong_type.codon
def wrong_arg(x: int):
return x
```
```python
❯ ipython
Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:53:32) [GCC 12.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.32.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import wrong_type
In [2]: wrong_type.wrong_arg(1)
Out[2]: 1
In [3]: wrong_type.wrong_arg(1.2)
PyError: conversion error: Python object did not have type 'int'
Raised from: std.internal.python._conversion_error:0
/software/codon/codon-0.18.1/lib/codon/stdlib/internal/python.codon:1293:5
Aborted (core dumped)
```
Contributor guide
Assessment
This issue has not been assessed yet.