New submission from Sebastian Ernst <er...@pleiszenburg.de>:

A c-function with the following signature ...

```C
int16_t __stdcall __declspec(dllimport) square_int(
        int16_t a
        );
```

... is being called with ctypes:

```python
def test_error_callargs_unconfigured_too_many_args():

        dll = ctypes.windll.LoadLibrary('tests/demo_dll.dll')
        square_int = dll.square_int

        with pytest.raises(ValueError):
                a = square_int(1, 2, 3)
```

Expected result: If the function is called with too many (positional) arguments 
(in the example 3 instead of 1), a `ValueError` should be raised. This is the 
case for at least CPython 3.4 to 3.7.

Actual result: "Nothing", i.e. no exception. The described test "fails". The 
function is called without an error - with CPython 3.8.0b4.

If this behavior is intended, is has not been (as far as I can tell) documented.

----------
components: ctypes
messages: 353021
nosy: smernst
priority: normal
severity: normal
status: open
title: ctypes ignores when a DLL function is called with too many arguments
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38258>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to