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

Unhandled error results of C API functions #68303

Closed
serhiy-storchaka opened this issue May 2, 2015 · 3 comments
Closed

Unhandled error results of C API functions #68303

serhiy-storchaka opened this issue May 2, 2015 · 3 comments
Assignees
Labels
extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 24115
Nosy @serhiy-storchaka
Files
  • issue24115.patch
  • 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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2015-05-30.14:50:12.164>
    created_at = <Date 2015-05-02.16:56:26.514>
    labels = ['extension-modules', 'interpreter-core', 'type-bug']
    title = 'Unhandled error results of C API functions'
    updated_at = <Date 2015-05-30.14:50:12.163>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-05-30.14:50:12.163>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-05-30.14:50:12.164>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules', 'Interpreter Core']
    creation = <Date 2015-05-02.16:56:26.514>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['39451']
    hgrepos = []
    issue_num = 24115
    keywords = ['patch']
    message_count = 3.0
    messages = ['242407', '243741', '244460']
    nosy_count = 3.0
    nosy_names = ['Arfrever', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue24115'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5', 'Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    PyObject_IsInstance() and PyObject_IsSubclass() cat return 0, 1, or -1. But some code use "if (PyObject_IsInstance(...))" or "if (!PyObject_IsInstance(...))". This should be fixed.

    @serhiy-storchaka serhiy-storchaka self-assigned this May 2, 2015
    @serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels May 2, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    Proposed patch adds handling of error results of following functions: PyObject_IsTrue(), PyObject_Not(), PyObject_IsInstance(), PyObject_RichCompareBool(), _PyDict_Contains(). All these functions usually return 0 or 1, but also can return -1 in the case of error, and this case was not handled in some places.

    @serhiy-storchaka serhiy-storchaka changed the title PyObject_IsInstance() and PyObject_IsSubclass() can fail Unhandled error results of C API functions May 21, 2015
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 30, 2015

    New changeset 82490d05f3b0 by Serhiy Storchaka in branch '2.7':
    Issue bpo-24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
    https://hg.python.org/cpython/rev/82490d05f3b0

    New changeset 8167df7d4cd0 by Serhiy Storchaka in branch '3.4':
    Issue bpo-24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
    https://hg.python.org/cpython/rev/8167df7d4cd0

    New changeset 7d1b81224c3b by Serhiy Storchaka in branch '3.5':
    Issue bpo-24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
    https://hg.python.org/cpython/rev/7d1b81224c3b

    New changeset f5d1bb0c4192 by Serhiy Storchaka in branch 'default':
    Issue bpo-24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
    https://hg.python.org/cpython/rev/f5d1bb0c4192

    @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
    extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant