exaloop / exaloop/codon

Calling function in python extension module with wrong type crashes python.

Open
#630 3 comments 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.