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

Fix the use of PyUnicode_READY() #75574

Closed
serhiy-storchaka opened this issue Sep 8, 2017 · 3 comments
Closed

Fix the use of PyUnicode_READY() #75574

serhiy-storchaka opened this issue Sep 8, 2017 · 3 comments
Assignees
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@serhiy-storchaka
Copy link
Member

BPO 31393
Nosy @benjaminp, @serhiy-storchaka
PRs
  • bpo-31393: Fix the use of PyUnicode_READY(). #3451
  • [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). #3453
  • 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 2017-09-08.07:48:32.685>
    created_at = <Date 2017-09-08.06:12:20.268>
    labels = ['interpreter-core', '3.7', 'type-crash']
    title = 'Fix the use of PyUnicode_READY()'
    updated_at = <Date 2017-09-08.07:48:32.684>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-09-08.07:48:32.684>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2017-09-08.07:48:32.685>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2017-09-08.06:12:20.268>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31393
    keywords = ['patch']
    message_count = 3.0
    messages = ['301680', '301684', '301685']
    nosy_count = 2.0
    nosy_names = ['benjamin.peterson', 'serhiy.storchaka']
    pr_nums = ['3451', '3453']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue31393'
    versions = ['Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    PyUnicode_READY() raises an exception when returns -1 (MemoryError or ValueError). Not all code that calls PyUnicode_READY() handles this property. The following PR fixes all uses of PyUnicode_READY().

    • If PyUnicode_READY() returns -1 the caller should either fail immediately or clear the error.

    • The raised exception shouldn't be replaced by PyErr_BadArgument().

    • In MCACHE_CACHEABLE_NAME PyUnicode_READY() is replaced with PyUnicode_IS_READY(). This is just the check for fast path.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Sep 8, 2017
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset e3b2b4b by Serhiy Storchaka in branch 'master':
    bpo-31393: Fix the use of PyUnicode_READY(). (bpo-3451)
    e3b2b4b

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset ddb536b by Serhiy Storchaka in branch '3.6':
    [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (bpo-3453)
    ddb536b

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 8, 2017
    @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.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant