Skip to content

Create PyErr_GetWindowsMessage() function #53213

Closed

Description

@vstinner
BPO 8967
Nosy @vstinner
Files
  • pyerr_getwindowsmessage.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 = None
    closed_at = <Date 2011-03-02.01:07:10.921>
    created_at = <Date 2010-06-11.00:09:14.013>
    labels = ['interpreter-core', 'invalid', 'expert-unicode', 'OS-windows']
    title = 'Create PyErr_GetWindowsMessage() function'
    updated_at = <Date 2011-03-02.01:07:10.919>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2011-03-02.01:07:10.919>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-03-02.01:07:10.921>
    closer = 'vstinner'
    components = ['Interpreter Core', 'Unicode', 'Windows']
    creation = <Date 2010-06-11.00:09:14.013>
    creator = 'vstinner'
    dependencies = []
    files = ['17615']
    hgrepos = []
    issue_num = 8967
    keywords = ['patch']
    message_count = 2.0
    messages = ['107505', '129843']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue8967'
    versions = ['Python 3.2']

    Activity

    1. vstinner commented on Jun 11, 2010

      @vstinner
      MemberAuthor

      PyErr_SetExcFromWindowsErrWithFilenameObject() and PyErr_SetFromErrnoWithFilenameObject() have the same code to read the localized error message. The code can be factorized in a new function PyErr_GetWindowsMessage().

      About the patch:

      • free s_buf just after the call to PyUnicode_FromUnicode(), don't wait until the end of the function
      • free s_buf if s_buf is not NULL and len==0. I suppose that this case is impossible, if len==0, s_buf is set to NULL or leaved unchanged (so it's also equal to NULL)

      I wrote the function to raise an UnicodeDecodeError with a Windows error message.

    2. vstinner commented on Mar 2, 2011

      @vstinner
      MemberAuthor

      This issue doesn't solve any real issue. I prefer to close it because I don't need it anymore.

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions