Skip to content

Add support.catch_threading_exception() #81707

Description

@vstinner
BPO 37526
Nosy @vstinner
PRs
  • bpo-37526: Add support.catch_threading_exception() #14664
  • [3.8] bpo-37526: Add support.catch_threading_exception() (GH-14664) #14666
  • 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-07-09.12:37:40.196>
    created_at = <Date 2019-07-09.10:26:30.732>
    labels = ['3.8', 'tests', '3.9']
    title = 'Add support.catch_threading_exception()'
    updated_at = <Date 2019-07-09.12:37:40.192>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-07-09.12:37:40.192>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-07-09.12:37:40.196>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2019-07-09.10:26:30.732>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37526
    keywords = ['patch']
    message_count = 5.0
    messages = ['347540', '347543', '347545', '347552', '347556']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['14664', '14666']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37526'
    versions = ['Python 3.8', 'Python 3.9']

    Activity

    1. vstinner commented on Jul 9, 2019

      @vstinner
      MemberAuthor

      bpo-1230540 added threading.excepthook() to handle "uncaught exceptions raised by Thread.run()".

      I propose to add support.catch_threading_exception(): context manager to ease catching these exceptions.

      Attached PR implements it.

    2. vstinner commented on Jul 9, 2019

      @vstinner
      MemberAuthor

      See also bpo-36829: Add test.support.catch_unraisable_exception().

      catch_threading_exception() is very close to catch_unraisable_exception().

    3. vstinner commented on Jul 9, 2019

      @vstinner
      MemberAuthor

      New changeset 91b4f7a by Victor Stinner in branch 'master':
      bpo-37526: Add support.catch_threading_exception() (GH-14664)
      91b4f7a

    4. vstinner commented on Jul 9, 2019

      @vstinner
      MemberAuthor

      New changeset 58f2c7f by Victor Stinner (Miss Islington (bot)) in branch '3.8':
      bpo-37526: Add support.catch_threading_exception() (GH-14664) (GH-14666)
      58f2c7f

    5. vstinner commented on Jul 9, 2019

      @vstinner
      MemberAuthor

      Maybe the context manager could recreate attributes (set them to None) if the context manager is used wice, but I'm not sure that I don't want to promote to reuse catch_threading_exception().

      I didn't check if catch_threading_exception() creates a ref cycle. I guess so. It's likely than storing an exception creates a ref cycle. Anyway, __exit__() removes attributes.

    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.8 (EOL)end of life3.9 (EOL)end of lifetestsTests in the Lib/test dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions