GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Better error handling in PyImport_Cleanup() · Issue #77511 · python/cpython

Better error handling in PyImport_Cleanup() #77511

New issue
Copy link
New issue
Copy link
Closed
Closed
Better error handling in PyImport_Cleanup()#77511
Copy link
Labels
3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Apr 22, 2018
Issue body actions
BPO 33330
Nosy @brettcannon, @ncoghlan, @pitrou, @vstinner, @ericsnowcurrently, @serhiy-storchaka, @miss-islington
PRs
  • bpo-33330: Improve error handling in PyImport_Cleanup(). #6564
  • [3.7] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564) #6601
  • [3.6] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564). #6604
  • [2.7] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564). #6605
  • bpo-33330: Write exceptions occurred in PyImport_Cleanup() to stderr. #6606
  • bpo-33330: PyImport_Cleanup check for exc leaks #7068
  • 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 = None
    created_at = <Date 2018-04-22.08:56:30.611>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7']
    title = 'Better error handling in PyImport_Cleanup()'
    updated_at = <Date 2018-05-23.10:36:34.627>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-05-23.10:36:34.627>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2018-04-22.08:56:30.611>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33330
    keywords = ['patch']
    message_count = 9.0
    messages = ['315592', '315751', '315756', '315757', '315766', '315767', '315915', '317367', '317381']
    nosy_count = 7.0
    nosy_names = ['brett.cannon', 'ncoghlan', 'pitrou', 'vstinner', 'eric.snow', 'serhiy.storchaka', 'miss-islington']
    pr_nums = ['6564', '6601', '6604', '6605', '6606', '7068']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33330'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    Activity

    1. serhiy-storchaka commented on Apr 22, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 22, 2018
      MemberAuthor
      More actions

      The proposed PR adds missed checks for errors and PyErr_Clear() calls in PyImport_Cleanup().

      It may be worth to use PyErr_WriteUnraisable() in place of PyErr_Clear() (newly added and existing) in most cases. But this can add an unexpected noise, and I don't wont to do this at this stage of 3.7. It could be done in 3.8 though, and backported to 3.7 later.

      I'm not sure that PyImport_Cleanup() works properly if sys.modules is not a dict. At this stage a custom mapping will likely be broken when most of modules are destroyed.

    2. serhiy-storchaka
      added
      3.7 (EOL)end of lifeend of life
      3.8 (EOL)end of lifeend of life
      interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Apr 22, 2018
    3. serhiy-storchaka commented on Apr 25, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 25, 2018
      MemberAuthor
      More actions

      New changeset e9d9494 by Serhiy Storchaka in branch 'master':
      bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564)
      e9d9494

    4. miss-islington commented on Apr 25, 2018

      @miss-islington
      miss-islington
      on Apr 25, 2018
      Contributor
      More actions

      New changeset 291c9d4 by Miss Islington (bot) in branch '3.7':
      bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564)
      291c9d4

    5. serhiy-storchaka commented on Apr 25, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 25, 2018
      MemberAuthor
      More actions

      PR 6606 replaces PyErr_Clear() with PyErr_WriteUnraisable(). This may add an unexpected noise at shutdown' but on other hand, this may be a helpful information in the case if something wrong happen. It doesn't produce additional output when run all tests, this means that that all is successful. I wonder in which circumstance that output will be occurred.

    6. serhiy-storchaka commented on Apr 26, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 26, 2018
      MemberAuthor
      More actions

      New changeset b16681f by Serhiy Storchaka in branch '3.6':
      [3.6] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564). (GH-6604)
      b16681f

    7. serhiy-storchaka commented on Apr 26, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 26, 2018
      MemberAuthor
      More actions

      New changeset 55299ff by Serhiy Storchaka in branch '2.7':
      [2.7] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564). (GH-6605)
      55299ff

    8. serhiy-storchaka commented on Apr 29, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 29, 2018
      MemberAuthor
      More actions

      New changeset c1a6832 by Serhiy Storchaka in branch 'master':
      bpo-33330: Write exceptions occurred in PyImport_Cleanup() to stderr. (GH-6606)
      c1a6832

    9. serhiy-storchaka
      closed this as completedon May 23, 2018
    10. vstinner commented on May 23, 2018

      @vstinner
      vstinner
      on May 23, 2018
      Member
      More actions

      I reopen the issue because I created the PR 7068 to propose further checks (in debug mode).

    11. vstinner
      reopened this on May 23, 2018
    12. serhiy-storchaka commented on May 23, 2018

      @serhiy-storchaka
      serhiy-storchaka
      on May 23, 2018
      MemberAuthor
      More actions

      See also bpo-33379 about the bug in subinterpreters exposed when add yet one PyErr_WriteUnraisable() in PyImport_Cleanup() (it was not added because of this).

    13. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    14. iritkatriel commented on Jun 20, 2022

      @iritkatriel
      iritkatriel
      on Jun 20, 2022
      Member
      More actions

      Is there anything left to do here?

    15. vstinner commented on Jun 21, 2022

      @vstinner
      vstinner
      on Jun 21, 2022
      Member
      More actions

      I gave up on my further enhancements #7068 (comment), so I just close the issue.

    16. vstinner
      closed this as completedon Jun 21, 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.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402520 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.