Skip to content

MacOS Sequoia, Python 3.13.0: Hard crash when working with legacy code #128075

Closed as not planned
@MikeRobinson12345

Description

Crash report

What happened?

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/utils.py", line 69, in __getitem__
    return self._engines[alias]
           ~~~~~~~~~~~~~^^^^^^^
KeyError: 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 174, in get_package_libraries
    module = import_module(entry[1])
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/mike/projects/GGA/pinax/templatetags/templatetags/shorttimesince_tag.py", line 6, in <module>
    from django.utils.translation import ungettext, gettext
ImportError: cannot import name 'ungettext' from 'django.utils.translation' (/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/translation/__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/mike/projects/GGA/./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
    ~~~~~~~~~~~~~~~^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/commands/runserver.py", line 75, in execute
    super().execute(*args, **options)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
Traceback (most recent call last):
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/utils.py", line 69, in __getitem__
    return self._engines[alias]
           ~~~~~~~~~~~~~^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/commands/runserver.py", line 112, in handle
    self.run(**options)
    ~~~~~~~~^^^^^^^^^^^
KeyError: 'django'
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/commands/runserver.py", line 119, in run
    autoreload.run_with_reloader(self.inner_run, **options)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception, another exception occurred:

  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/autoreload.py", line 671, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Traceback (most recent call last):
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/autoreload.py", line 660, in start_django
    reloader.run(django_main_thread)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 174, in get_package_libraries
    module = import_module(entry[1])
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/autoreload.py", line 343, in run
    autoreload_started.send(sender=self)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/dispatch/dispatcher.py", line 189, in send
    response = receiver(signal=self, sender=sender, **named)
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/mike/projects/GGA/pinax/templatetags/templatetags/shorttimesince_tag.py", line 6, in <module>
    from django.utils.translation import ungettext, gettext
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/autoreload.py", line 50, in watch_for_template_changes
    for directory in get_template_directories():
                     ~~~~~~~~~~~~~~~~~~~~~~~~^^
ImportError: cannot import name 'ungettext' from 'django.utils.translation' (/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/translation/__init__.py)
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/autoreload.py", line 16, in get_template_directories
    for backend in engines.all():
                   ~~~~~~~~~~~^^

The above exception was the direct cause of the following exception:

  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/utils.py", line 94, in all
    return [self[alias] for alias in self]
            ~~~~^^^^^^^
Traceback (most recent call last):
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/utils.py", line 85, in __getitem__
    engine = engine_cls(params)
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 26, in __init__
    options["libraries"] = self.get_templatetag_libraries(libraries)
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 88, in get_templatetag_libraries
    libraries = get_installed_libraries()
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 163, in get_installed_libraries
    module_name: full_name for module_name, full_name in get_template_tag_modules()
                                                         ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 151, in get_template_tag_modules
    for name in get_package_libraries(pkg):
                ~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
    ~~^^^^^^^^^^^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/backends/django.py", line 176, in get_package_libraries
    raise InvalidTemplateLibrary(
    ...<2 lines>...
    ) from e
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
    self.check(display_num_errors=True)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'pinax.templatetags.templatetags.shorttimesince_tag': cannot import name 'ungettext' from 'django.utils.translation' (/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/utils/translation/__init__.py)
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/management/base.py", line 486, in check
    all_issues = checks.run_checks(
        app_configs=app_configs,
    ...<2 lines>...
        databases=databases,
    )
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/contrib/admin/checks.py", line 79, in check_dependencies
    for engine in engines.all():
                  ~~~~~~~~~~~^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/utils.py", line 94, in all
    return [self[alias] for alias in self]
            ~~~~^^^^^^^
  File "/Users/mike/.virtualenvs/djangoprod/lib/python3.13/site-packages/django/template/utils.py", line 85, in __getitem__
    engine = engine_cls(params)
Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads
Python runtime state: finalizing (tstate=0x00000001056ec560)

Current thread 0x00000001f2b83840 (most recent call first):
  <no Python frame>

I'm trying to resurrect some old Python code that isn't maintained anymore. (Pinax.) But, what's significant is what happened at the very end – the entire Python interpreter CRASHED HARD. (This happened on the command line while invoking Django "runserver," hence a "web browser" context.)

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Output from running 'python -VV' on the command line:

No response

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions