Bug 2318976

Summary: Mailman3 fails to start with Python 3.13
Product: [Fedora] Fedora Reporter: Göran Uddeborg <goeran>
Component: mailman3Assignee: Michel Lind <michel>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 41CC: infra-sig, mhroncok, michel, ngompa13, sjoerd
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: mailman3-3.3.10-1.fc44 mailman3-3.3.10-1.fc43 mailman3-3.3.10-1.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-11-13 17:58:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2414586    
Bug Blocks: 2244836    

Description Göran Uddeborg 2024-10-15 21:16:10 UTC
After upgrading to Python 3.13, I'm not able to run mailman3 any more.

Reproducible: Always

Steps to Reproduce:
1.sudo -u mailman mailman3 conf

(The regular service also fails to start, but this is a simple command-line reproducer.)
Actual Results:  
A backtrace ending in

  File "/usr/lib/python3.13/site-packages/mailman/commands/cli_gatenews.py", line 24, in <module>
    import nntplib
ModuleNotFoundError: No module named 'nntplib'


Expected Results:  
A printout of the configuration.

"nntplib" is imported in mailman/commands/cli_gatenews.py, but the "nntplib" library is removed in Python 3.13. I'm not the first to discover this as there is an upstreams bug https://gitlab.com/mailman/mailman/-/issues/1176 but I couldn't find any report here in Bugzilla.

Comment 1 Michel Lind 2024-11-13 18:36:40 UTC
Oof. Thanks for reporting!

Comment 2 Miro Hrončok 2025-04-01 10:40:32 UTC
From the spec file:


  # Tests fail with nspawn mock due to lack of access to /dev/stdout
  # TODO: Figure out a fix for this
  venv/bin/python -m nose2 -v || :

From the build log:

  ======================================================================
  ERROR: mailman.commands.tests.test_cli_gatenews (nose2.loader.ModuleImportFailure.mailman.commands.tests.test_cli_gatenews)
  ----------------------------------------------------------------------
  ImportError: Failed to import test module: mailman.commands.tests.test_cli_gatenews
  Traceback (most recent call last):
    File "/usr/lib/python3.13/site-packages/nose2/plugins/loader/discovery.py", line 195, in _find_tests_in_file
      module = util.module_from_name(module_name)
    File "/usr/lib/python3.13/site-packages/nose2/util.py", line 73, in module_from_name
      __import__(name)
      ~~~~~~~~~~^^^^^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/commands/tests/test_cli_gatenews.py", line 21, in <module>
      import nntplib
  ModuleNotFoundError: No module named 'nntplib'
  ======================================================================
  ERROR: test_opening_character_device (mailman.core.tests.test_logging.TestRunner.test_opening_character_device)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/tests/test_logging.py", line 28, in test_opening_character_device
      handler = ReopenableFileHandler('test', '/dev/stdout')
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/logging.py", line 51, in __init__
      self._stream = self._open()
                     ~~~~~~~~~~^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/logging.py", line 64, in _open
      return codecs.open(self.filename, open_mode, 'utf-8')
             ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen codecs>", line 921, in open
  PermissionError: [Errno 13] Permission denied: '/dev/stdout'
  ======================================================================
  ERROR: mailman.runners.tests.test_nntp (nose2.loader.ModuleImportFailure.mailman.runners.tests.test_nntp)
  ----------------------------------------------------------------------
  ImportError: Failed to import test module: mailman.runners.tests.test_nntp
  Traceback (most recent call last):
    File "/usr/lib/python3.13/site-packages/nose2/plugins/loader/discovery.py", line 195, in _find_tests_in_file
      module = util.module_from_name(module_name)
    File "/usr/lib/python3.13/site-packages/nose2/util.py", line 73, in module_from_name
      __import__(name)
      ~~~~~~~~~~^^^^^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/runners/tests/test_nntp.py", line 21, in <module>
      import nntplib
  ModuleNotFoundError: No module named 'nntplib'
  ======================================================================
  ERROR: LayerSuite
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/testing/layers.py", line 135, in setUp
      initialize.initialize_2(testing=True)
      ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/initialize.py", line 199, in initialize_2
      initialize_commands()
      ~~~~~~~~~~~~~~~~~~~^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/app/commands.py", line 29, in initialize
      add_components('commands', IEmailCommand, config.commands)
      ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/utilities/modules.py", line 218, in add_components
      for component_class in find_pluggable_components(subpackage, interface):
                             ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/utilities/modules.py", line 177, in find_pluggable_components
      yield from find_components('mailman.' + subpackage, interface)
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/utilities/modules.py", line 150, in find_components
      module = import_module(module_name)
    File "/usr/lib64/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 1026, in exec_module
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/commands/cli_gatenews.py", line 24, in <module>
      import nntplib
  ModuleNotFoundError: No module named 'nntplib'
  ----------------------------------------------------------------------
  Ran 53 tests in 0.275s
  FAILED (errors=4)


------------------


I believe the original reason for ignoring the test results is no longer valid.

If this was not ignored, we would have known about this problem a year ago. Please don't do that.

This is explicitly forbidden by the guidelines https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_running_tests -- exactly for this reason.

Comment 3 Sjoerd Mullender 2025-05-21 07:30:56 UTC
If you don't actually need NNTP support, the easiest way to get on your way is to add

[runner.nntp]
start: no

to your mailman.cfg file, and to create an empty file /usr/lib/python3.13/site-packages/nntplib.py

This is not a fix, this is a workaround.

Comment 4 Göran Uddeborg 2025-05-24 09:47:16 UTC
Thanks for that workaround! I helps me, and I suspect potentially many others.

Comment 5 Neal Gompa 2025-11-12 12:07:38 UTC
It looks like the fix is to package https://pypi.org/project/standard-nntplib/ and patch mailman3 to use it instead.

Comment 7 Michel Lind 2025-11-12 13:19:22 UTC
*** Bug 2367737 has been marked as a duplicate of this bug. ***

Comment 8 Michel Lind 2025-11-12 13:27:49 UTC
Looks like we need to update to 3.3.10 as well to apply this. Working on it (while I find someone else to take over mailman3 who can give it more attention)

Comment 9 Fedora Update System 2025-11-13 14:57:34 UTC
FEDORA-2025-cb6eb9eb77 (mailman3-3.3.10-1.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-cb6eb9eb77

Comment 10 Fedora Update System 2025-11-13 16:38:32 UTC
FEDORA-2025-5ed6932528 (mailman3-3.3.10-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-5ed6932528

Comment 11 Fedora Update System 2025-11-13 16:38:56 UTC
FEDORA-2025-d8c0a0a222 (mailman3-3.3.10-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-d8c0a0a222

Comment 12 Fedora Update System 2025-11-13 17:58:32 UTC
FEDORA-2025-cb6eb9eb77 (mailman3-3.3.10-1.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2025-11-14 01:59:48 UTC
FEDORA-2025-5ed6932528 has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-5ed6932528`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-5ed6932528

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2025-11-14 02:40:14 UTC
FEDORA-2025-d8c0a0a222 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-d8c0a0a222`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-d8c0a0a222

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2025-11-16 01:20:46 UTC
FEDORA-2025-5ed6932528 (mailman3-3.3.10-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2025-11-22 01:14:39 UTC
FEDORA-2025-d8c0a0a222 (mailman3-3.3.10-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.