Skip to content

imp.new_module does not function correctly if the module is returned from a function and used directly #51389

Closed

Description

@jkp
mannequin
BPO 7140
Nosy @terryjreedy, @pitrou, @benjaminp
Superseder
  • bpo-18214: Stop purging modules which are garbage collected before shutdown
  • Files
  • testcase.py: Testcase demonstrating the issue.
  • testcase.py
  • 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 2013-07-31.09:36:01.655>
    created_at = <Date 2009-10-15.11:24:51.053>
    labels = ['type-bug', 'library']
    title = 'imp.new_module does not function correctly if the module is returned from a function and used directly'
    updated_at = <Date 2013-07-31.09:36:01.653>
    user = 'https://bugs.python.org/jkp'

    bugs.python.org fields:

    activity = <Date 2013-07-31.09:36:01.653>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-07-31.09:36:01.655>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2009-10-15.11:24:51.053>
    creator = 'jkp'
    dependencies = []
    files = ['15133', '15134']
    hgrepos = []
    issue_num = 7140
    keywords = []
    message_count = 7.0
    messages = ['94082', '94083', '94095', '118480', '118819', '121213', '193992']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'pitrou', 'benjamin.peterson', 'jkp', 'Arfrever']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '18214'
    type = 'behavior'
    url = 'https://bugs.python.org/issue7140'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

    Activity

    1. jkp commented on Oct 15, 2009

      jkpmannequin
      MannequinAuthor

      See the testcase included. If you instead assign the result of the
      get_module() call to a variable and then make the call to the function
      defined in that module it works as expected.

    2. added
      stdlib
      type-bug
      on Oct 15, 2009
    3. jkp commented on Oct 15, 2009

      jkpmannequin
      MannequinAuthor

      Updated the testcase to show that the __dict__ for the module is incorrect
      unless the module is assigned to a temp variable.

    4. benjaminp commented on Oct 15, 2009

      @benjaminp
      Contributor

      Fixed in r75437.

    5. benjaminp commented on Oct 12, 2010

      @benjaminp
      Contributor

      Rebroken in r85392. See bpo-10068.

    6. terryjreedy commented on Oct 15, 2010

      @terryjreedy
      Member

      Since that revision only touched py3k, I am guessing that it only broke 3.2.

    7. Arfrever commented on Nov 15, 2010

      Arfrevermannequin
      Mannequin

      But there were r85393 (2.7) and r85394 (3.1).

    8. pitrou commented on Jul 31, 2013

      @pitrou
      Member

      Work in progress in bpo-18214.

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

      stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions