Browse Source

Monkey patch original current_thread _active

Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Also disable E402 to allow the change in.

Change-Id: I508fcd0707ecdd2bf720303f6cbb4087a38aaadd
Closes-Bug: #1863021
changes/70/725670/2
Corey Bryant 3 months ago
committed by Kirill Zaitsev
parent
commit
fe543a67c7
2 changed files with 8 additions and 1 deletions
  1. +6
    -0
      murano/monkey_patch.py
  2. +2
    -1
      tox.ini

+ 6
- 0
murano/monkey_patch.py View File

@@ -23,3 +23,9 @@ if os.name == 'nt':
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active

+ 2
- 1
tox.ini View File

@@ -95,7 +95,8 @@ whitelist_externals = rm
show-source = true
builtins = _
# W605 invalid escape sequence
ignore = W605,W504,W503,E123,H405
# E402 fires an error on eventlet import. Should probably remove condition alltogether
ignore = W605,W504,W503,E123,H405,E402
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build

[hacking]


Loading…
Cancel
Save