Skip to content

os.sched_setaffinity does not handle errors during iteration. #81601

Closed

Description

@brandtbucher
BPO 37420
Nosy @benjaminp, @miss-islington, @brandtbucher
PRs
  • bpo-37420: os.sched_setaffinity does not handle errors during iteration. #14414
  • [3.7] closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. (GH-14414) #14425
  • [3.8] closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. (GH-14414) #14426
  • 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 2019-06-27.16:11:13.968>
    created_at = <Date 2019-06-26.22:22:26.691>
    labels = ['type-bug', 'library', '3.9']
    title = 'os.sched_setaffinity does not handle errors during iteration.'
    updated_at = <Date 2019-06-27.16:45:35.150>
    user = 'https://github.com/brandtbucher'

    bugs.python.org fields:

    activity = <Date 2019-06-27.16:45:35.150>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-27.16:11:13.968>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2019-06-26.22:22:26.691>
    creator = 'brandtbucher'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37420
    keywords = ['patch']
    message_count = 4.0
    messages = ['346691', '346751', '346754', '346757']
    nosy_count = 3.0
    nosy_names = ['benjamin.peterson', 'miss-islington', 'brandtbucher']
    pr_nums = ['14414', '14425', '14426']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37420'
    versions = ['Python 3.9']

    Activity

    1. brandtbucher commented on Jun 26, 2019

      @brandtbucher
      MemberAuthor

      This is related to bpo-37417: os.sched_setaffinity doesn't properly handle errors that arise during iteration of the mask argument:

      Python 3.9.0a0 (heads/master:d52a83a, Jun 26 2019, 15:13:41) 
      [GCC 5.4.0 20160609] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import os
      >>> bad_iter = map(int, "0X")
      >>> os.sched_setaffinity(0, bad_iter)
      ValueError: invalid literal for int() with base 10: 'X'
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      SystemError: <built-in function sched_setaffinity> returned a result with an error set

      It looks like this bug is also present on all versions of Python 3. I've attached a patch with a fix and a regression test.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jun 26, 2019
    3. benjaminp commented on Jun 27, 2019

      @benjaminp
      Contributor

      New changeset 45a30af by Benjamin Peterson (Brandt Bucher) in branch 'master':
      closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. (GH-14414)
      45a30af

    4. miss-islington commented on Jun 27, 2019

      @miss-islington
      Contributor

      New changeset 65e1872 by Miss Islington (bot) in branch '3.7':
      closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. (GH-14414)
      65e1872

    5. miss-islington commented on Jun 27, 2019

      @miss-islington
      Contributor

      New changeset 6fbed53 by Miss Islington (bot) in branch '3.8':
      closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. (GH-14414)
      6fbed53

    6. 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

      3.9 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions