Skip to content

Python reinitialization test #46269

Closed
Closed

Description

@tiran
BPO 1977
Nosy @loewis, @pitrou, @tiran
Superseder
  • bpo-10914: Python sub-interpreter test
  • Files
  • test_reinit.patch
  • test_reinit.c
  • 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 = 'https://github.com/pitrou'
    closed_at = <Date 2012-11-26.20:00:28.290>
    created_at = <Date 2008-01-30.19:10:43.009>
    labels = ['interpreter-core', 'type-feature', 'build']
    title = 'Python reinitialization test'
    updated_at = <Date 2012-11-26.20:00:28.288>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2012-11-26.20:00:28.288>
    actor = 'pitrou'
    assignee = 'pitrou'
    closed = True
    closed_date = <Date 2012-11-26.20:00:28.290>
    closer = 'pitrou'
    components = ['Build', 'Interpreter Core']
    creation = <Date 2008-01-30.19:10:43.009>
    creator = 'christian.heimes'
    dependencies = []
    files = ['9334', '9339']
    hgrepos = []
    issue_num = 1977
    keywords = ['patch']
    message_count = 12.0
    messages = ['61873', '61875', '61876', '61895', '61899', '61904', '83564', '116941', '116958', '126329', '176420', '176448']
    nosy_count = 4.0
    nosy_names = ['loewis', 'pitrou', 'christian.heimes', 'BreamoreBoy']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = None
    status = 'closed'
    superseder = '10914'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1977'
    versions = ['Python 3.2']

    Activity

    1. tiran commented on Jan 30, 2008

      @tiran
      MemberAuthor

      The patch adds a new test and a new executable. The executable calls
      Py_Initialze() and Py_Finalize() multiple times in a row. The test also
      shows that Python looses about 35 references in each round.

      $ ./test_reinit
      round 1
      [7751 refs]
      round 2
      [7797 refs]
      round 3
      [7834 refs]
      round 4
      [7871 refs]
      round 5
      [7908 refs]
      round 6
      [7945 refs]
      round 7
      [7982 refs]
      round 8
      [8019 refs]
      round 9
      [8056 refs]
      round 10
      [8093 refs]
    2. added
      buildThe build process and cross-build
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      type-featureA feature request or enhancement
      on Jan 30, 2008
    3. loewis commented on Jan 30, 2008

      loewismannequin
      Mannequin

      I'm not sure what the purpose of this test is. When would it pass, when
      would it fail? I don't think it is a bug if a
      Py_Initialize()/Py_Finalize() cycle loses references.

    4. tiran commented on Jan 30, 2008

      @tiran
      MemberAuthor

      Martin v. Löwis wrote:

      Martin v. Löwis added the comment:

      I'm not sure what the purpose of this test is. When would it pass, when
      would it fail? I don't think it is a bug if a
      Py_Initialize()/Py_Finalize() cycle loses references.

      Today my attempts to fix some reference leaks related to sys.flags and
      sys.float_info caused the test to fail. A single init/final cycle worked
      but the second cycle broke.

      The test also shows an issue in Python 3.0. The double linked reference
      list is broken:

      $ ./test_reinit
      round 1
      [24676 refs]
      round 2
      [25588 refs]
      round 3
      * ob
      object  : <refcnt 0 at 0x82248e8>
      type    : str
      refcount: 0
      address : 0x82248e8
      * op->_ob_prev->_ob_next
      object  : <refcnt 0 at 0x82248e8>
      type    : str
      refcount: 0
      address : 0x82248e8
      * op->_ob_next->_ob_prev
      object  : bytearray(b'')
      type    : bytearray
      refcount: 1
      address : 0x839ab98
      Fatal Python error: UNREF invalid object
      Aborted (core dumped)
    5. pitrou commented on Jan 31, 2008

      @pitrou
      Member

      Perhaps ROUNDS, CAUSE_SEGFAULT and VERBOSE could be command-line rather
      than compile-time options?

    6. tiran commented on Jan 31, 2008

      @tiran
      MemberAuthor

      I like to keep the test as simple as possible.

      Here is a new file that shows Python crashes in the third Py_Finalize().

    7. tiran commented on Jan 31, 2008

      @tiran
      MemberAuthor

      If fixed the problem with multiple reinitialization in r60477. It took
      me quite some time to find the right spot.

    8. pitrou commented on Mar 14, 2009

      @pitrou
      Member

      This is still a good idea.

    9. BreamoreBoy commented on Sep 20, 2010

      BreamoreBoymannequin
      Mannequin

      Quote msg83564 "This is still a good idea.", in which case shouldn't someone push this forward, failing that close as out of date?

    10. pitrou commented on Sep 20, 2010

      @pitrou
      Member

      Quote msg83564 "This is still a good idea.", in which case shouldn't
      someone push this forward, failing that close as out of date?

      Just because someone doesn't "push this forward" doesn't mean it's out of date.

    11. pitrou commented on Jan 15, 2011

      @pitrou
      Member

      See also bpo-10914.

    12. tiran commented on Nov 26, 2012

      @tiran
      MemberAuthor

      Antoine, is the test still required? bpo-10914 has introduced tests for the subinterpreter.

    13. pitrou commented on Nov 26, 2012

      @pitrou
      Member

      Ah, funny. I ended up doing the same thing as you without remembering about it!

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

    Labels

    buildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions