Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24.2.1: test_import_from_another_thread fails #2030

Open
mtelka opened this issue Apr 9, 2024 · 0 comments
Open

24.2.1: test_import_from_another_thread fails #2030

mtelka opened this issue Apr 9, 2024 · 0 comments

Comments

@mtelka
Copy link
Contributor

mtelka commented Apr 9, 2024

  • gevent version: 24.2.1 installed from source
  • Python version: 3.9.19 installed from operating system package
  • Operating System: OpenIndiana Hipster (rolling release, up to date)

Description:

I'm running tests for gevent 24.2.1 and I found that the test_import_from_another_thread test fails:

  ======================================================================
  FAIL: test_import_from_another_thread (__main__.ThreadTests)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/tmp/test_threadingwtswui_n.py", line 859, in test_import_from_another_thread
      rc, out, err = assert_python_ok("-c", code)
    File "/usr/lib/python3.9/test/support/script_helper.py", line 156, in assert_python_ok
      return _assert_python(True, *args, **env_vars)
    File "/usr/lib/python3.9/test/support/script_helper.py", line 142, in _assert_python
      res.fail(cmd_line)
    File "/usr/lib/python3.9/test/support/script_helper.py", line 70, in fail
      raise AssertionError("Process return code is %d\n"
  AssertionError: Process return code is 1
  command line: ['/data/builds/oi-userland/components/python/gevent/build/amd64-3.9/.tox/py39/bin/python', '-X', 'faulthandler', '-I', '-c', "\nimport _thread\nimport sys\n\nevent = _thread.allocate_lock()\nevent.acquire()\n\ndef import_threading():\n    import threading\n    event.release()\n\nif 'threading' in sys.modules:\n    raise Exception('threading is already imported')\n\n_thread.start_new_thread(import_threading, ())\n\n# wait until the threading module is imported\nevent.acquire()\nevent.release()\n\nif 'threading' not in sys.modules:\n    raise Exception('threading is not imported')\n\n# don't wait until the thread completes\n"]

  stdout:
  ---

  ---

  stderr:
  ---
  Traceback (most recent call last):
    File "<string>", line 13, in <module>
  Exception: threading is already imported
  ---
  
  ----------------------------------------------------------------------

The problem seems to be that on this platform the threading module is always available:

$ python3.9 -c 'import sys; import pprint; pprint.pprint(sys.modules)' | grep threading
 'threading': <module 'threading' from '/usr/lib/python3.9/threading.py'>,
$ 

Honestly, I'm not sure if this is a bug in gevent (assuming threading is not available while it could be available) or in the Python on this platform (delivering the threading module where it should not be delivered).

BTW, the threading documentation suggests that the threading module is always available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant