[New-bugs-announce] [issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure
STINNER Victor
report at bugs.python.org
Wed May 27 10:44:18 EDT 2020
New submission from STINNER Victor <vstinner at python.org>:
Example:
---
from ctypes import c_int, CFUNCTYPE
def func():
return (1, 2, 3)
cb = CFUNCTYPE(c_int)(func)
cb()
---
Output:
---
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 262, in 'converting callback result'
TypeError: an integer is required (got type tuple)
Exception ignored in: <function func at 0x7f0c267ff1f0>
---
Assertion error in debug mode:
---
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 262, in 'converting callback result'
TypeError: 'tuple' object cannot be interpreted as an integer
python: Python/errors.c:1435: _PyErr_WriteUnraisableMsg: Assertion `exc_type != NULL' failed.
Abandon (core dumped)
---
Attached PR fix the issue.
----------
components: Library (Lib)
messages: 370089
nosy: vstinner
priority: normal
severity: normal
status: open
title: ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40795>
_______________________________________
More information about the New-bugs-announce
mailing list