This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_multiprocessing: test.support.import_module() does not ignore the ImportError on SemLock
Type: Stage: needs patch
Components: Versions: Python 3.4
process
Status: closed Resolution: out of date
Dependencies: 15767 Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, sbt, vstinner
Priority: normal Keywords:

Created on 2013-06-25 19:06 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg191876 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-06-25 19:06
test.support.import_module() catchs ModuleNotFoundError instead of ImportError since the following changeset:

changeset:   84106:c4d7228421df
user:        Brett Cannon <brett@python.org>
date:        Wed Jun 12 20:12:30 2013 -0400
files:       Lib/test/regrtest.py Lib/test/support.py Lib/test/test___all__.py Lib/xmlrpc/server.py Lib/zipfile.py
description:
Move test___all__ over to unittest.main() and use ModuleNotFoundError

The problem is that multiprocessing.synchronize raises an ImportError if _multiprocess.SemLock does not exist:

# Try to import the mp.synchronize module cleanly, if it fails
# raise ImportError for platforms lacking a working sem_open implementation.
# See issue 3770
try:
    from X_multiprocessing import SemLock
except (ImportError):
    raise ImportError("This platform lacks a functioning sem_open" +
                      " implementation, therefore, the required" +
                      " synchronization primitives needed will not" +
                      " function, see issue 3770.")

As a result, test_multiprocessing is no more skipped on FreeBSD 6.4, but the following traceback is written:

http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%203.x/builds/3771/steps/test/logs/stdio

Re-running test 'test_multiprocessing' in verbose mode
test test_multiprocessing crashed -- Traceback (most recent call last):
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/multiprocessing/synchronize.py", line 27, in <module>
    from _multiprocessing import SemLock
ModuleNotFoundError: cannot import name SemLock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/regrtest.py", line 1300, in runtest_inner
    the_module = importlib.import_module(abstest)
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/importlib/__init__.py", line 93, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1614, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1595, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1562, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 609, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1058, in load_module
  File "<frozen importlib._bootstrap>", line 928, in load_module
  File "<frozen importlib._bootstrap>", line 274, in _call_with_frames_removed
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_multiprocessing.py", line 30, in <module>
    test.support.import_module('multiprocessing.synchronize')
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/support.py", line 123, in import_module
    return importlib.import_module(name)
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/importlib/__init__.py", line 93, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1614, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1595, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1562, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 609, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1058, in load_module
  File "<frozen importlib._bootstrap>", line 928, in load_module
  File "<frozen importlib._bootstrap>", line 274, in _call_with_frames_removed
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/multiprocessing/synchronize.py", line 32, in <module>
    " function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.
msg192320 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-07-04 22:26
Brett: Why did you close this issue? It still occurs on the buildbot:

http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%203.x/builds/3794/steps/test/logs/stdio
msg192321 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-07-04 22:45
Because I removed ModuleNotFoundError; check the buildbot again and you will notice it is 8 changesets behind, most of which are related to the removal of ModuleNotFoundError.
History
Date User Action Args
2022-04-11 14:57:47adminsetgithub: 62502
2013-07-04 22:45:18brett.cannonsetstatus: open -> closed
resolution: out of date
messages: + msg192321
2013-07-04 22:26:22vstinnersetstatus: closed -> open
resolution: out of date -> (no value)
messages: + msg192320
2013-07-04 22:17:53brett.cannonsetstatus: open -> closed
resolution: out of date
2013-07-04 19:29:26brett.cannonsetdependencies: + add ModuleNotFoundError
2013-07-01 16:14:58brett.cannonsetassignee: brett.cannon
stage: needs patch
2013-06-25 19:06:45vstinnercreate