Skip to content

Segmentation fault under Python 3.9.12 #102329

Description

@YaoJiayi

Crash report

The following code snippet crashes with core dumped:

import unittest
from test import support
import sys

class Tests(unittest.TestCase):
    def test_bug(self):
        modules = set()
        for name, module in sys.modules.items():
            modules.add(module)
        new_tuples = tuple(modules)
        new_set = set(new_tuples)
        print('')
        print('sys.modules:')
        print('')
        import pprint
        pprint.pprint(modules)
        print('')
        print('len(sys.modules):', len(modules))


def test_main():
    support.run_unittest(Tests)

if __name__ == '__main__':
    test_main()

Error messages

(<object object at 0x7f0fe7b6d6a0>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>)
Segmentation fault (core dumped)

Your environment

  • CPython versions tested on: Python 3.9.12
  • Operating system and architecture: Linux hx-rs4810gs 5.15.0-57-generic 63~20.04.1-Ubuntu SMP Wed Nov 30 13:40:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Feb 28, 2023
  2. zware commented on Feb 28, 2023

    @zware
    Member

    I can't reproduce this on Linux 6.0.12-76060006-generic #202212290932~1674139725~22.04~ca93ccf SMP PREEMPT_DYNAMIC Thu J x86_64 with Python 3.9.14. Can you reproduce with any other version?

  3. YaoJiayi commented on Feb 28, 2023

    @YaoJiayi
    Author

    I've just tried Python 3.8.16. It has the same error message.

  4. terryjreedy commented on Feb 28, 2023

    @terryjreedy
    Member

    Please reduce the code to the minimum needed to get a crash and then indicate which line it crashes on.

  5. YaoJiayi commented on Feb 28, 2023

    @YaoJiayi
    Author

    It seems that "from test import support" produces the crash.

  6. zware commented on Feb 28, 2023

    @zware
    Member

    Is that your own test.support module, or the private helper from the standard library test suite?

  7. sobolevn commented on Feb 28, 2023

    @sobolevn
    Member

    I cannot reproduce this crash on macos with python 3.9.15, 3.10.2, and 3.12-dev :(

  8. added
    pendingThe issue will be closed if no feedback is provided
    on Feb 28, 2023
  9. removed
    type-crashA hard crash of the interpreter, possibly with a core dump
    pendingThe issue will be closed if no feedback is provided
    on Mar 1, 2023
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions