Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure #84972

Closed
vstinner opened this issue May 27, 2020 · 4 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 40795
Nosy @vstinner, @miss-islington
PRs
  • bpo-40795: ctypes calls unraisablehook with an exception #20452
  • [3.9] bpo-40795: ctypes calls unraisablehook with an exception (GH-20452) #20469
  • [3.8] bpo-40795: ctypes calls unraisablehook with an exception (GH-20452) #20470
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-05-27.23:01:28.076>
    created_at = <Date 2020-05-27.14:44:18.344>
    labels = ['3.8', 'library', '3.9', '3.10']
    title = 'ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure'
    updated_at = <Date 2020-05-27.23:01:28.075>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-05-27.23:01:28.075>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-27.23:01:28.076>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2020-05-27.14:44:18.344>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40795
    keywords = ['patch']
    message_count = 4.0
    messages = ['370089', '370145', '370148', '370149']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'miss-islington']
    pr_nums = ['20452', '20469', '20470']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40795'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @vstinner
    Copy link
    Member Author

    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.

    @vstinner vstinner added 3.10 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir labels May 27, 2020
    @vstinner
    Copy link
    Member Author

    New changeset 10228ba by Victor Stinner in branch 'master':
    bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
    10228ba

    @miss-islington
    Copy link
    Contributor

    New changeset 45ce0db by Miss Islington (bot) in branch '3.8':
    bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
    45ce0db

    @miss-islington
    Copy link
    Contributor

    New changeset 9e3c583 by Miss Islington (bot) in branch '3.9':
    bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
    9e3c583

    @vstinner vstinner added the 3.8 only security fixes label May 27, 2020
    @vstinner vstinner added the 3.8 only security fixes label May 27, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants