Author vstinner
Recipients vstinner
Date 2020-05-27.14:44:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590590658.49.0.612790938119.issue40795@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-05-27 14:44:18vstinnersetrecipients: + vstinner
2020-05-27 14:44:18vstinnersetmessageid: <1590590658.49.0.612790938119.issue40795@roundup.psfhosted.org>
2020-05-27 14:44:18vstinnerlinkissue40795 messages
2020-05-27 14:44:17vstinnercreate