Skip to content

subprocess: surrogates of the error message (Python implementation on non-Windows) #52713

Closed

Description

@vstinner
BPO 8467
Nosy @vstinner
Files
  • subprocess_errmsg.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 2010-04-23.20:22:34.391>
    created_at = <Date 2010-04-20.12:02:54.306>
    labels = ['library', 'expert-unicode']
    title = 'subprocess: surrogates of the error message (Python implementation on non-Windows)'
    updated_at = <Date 2010-04-23.20:22:34.390>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2010-04-23.20:22:34.390>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-04-23.20:22:34.391>
    closer = 'vstinner'
    components = ['Library (Lib)', 'Unicode']
    creation = <Date 2010-04-20.12:02:54.306>
    creator = 'vstinner'
    dependencies = []
    files = ['17005']
    hgrepos = []
    issue_num = 8467
    keywords = ['patch']
    message_count = 2.0
    messages = ['103694', '104045']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue8467'
    versions = ['Python 3.1', 'Python 3.2']

    Activity

    1. vstinner commented on Apr 20, 2010

      @vstinner
      MemberAuthor

      On a non-Windows OS where _posixsubprocess is missing (subprocess uses the pure Python implementation), if the child fails with a Python exception and the exception message contains a surrogate character, message.encode() fails silently (exception while processing exceptions are just ignored).

      Surrogates should be passed to the parent process: surrogatepass can be used for that. Attached patch implements this idea with an unit test.

      --

      _posixsubprocess is not concerned because it writes an empty message for OSError (the parent process calls os.strerror() to get the message) or "Exception occurred in preexec_fn." (pure ASCII string) for RuntimeError.

      On Windows, _subprocess.CreateProcess() calls PyErr_SetFromWindowsErr() on failure without the filename. So there is no surrogates here.

    2. vstinner commented on Apr 23, 2010

      @vstinner
      MemberAuthor

      Commited in py3k (r80413), blocked in 3.1 (r80414).

      Python 3.1 uses pickle to encode the traceback and pickle supports surrogates (see bpo-8383).

    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

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytopic-unicode

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions