tcalmant / ipopo

iPOPO: a Service-Oriented Component Model for Python
https://ipopo.readthedocs.io/
Apache License 2.0
69 stars 28 forks source link

Shell command "threads" doesn't work in Jython #27

Closed tcalmant closed 9 years ago

tcalmant commented 9 years ago

sys._current_frames() is not available in Jython, therefore threads and thread shell commands fail.

$ threads
ERROR:pelix.shell.core:Error calling default.threads: '<reflected field public org.python.core.PyObject o' object has no attribute '_current_frames'
Traceback (most recent call last):
  File "C:\jython2.7b3\Lib\site-packages\pelix\shell\core.py", line 703, in execute
    result = method(io_handler, *args, **kwargs)
  File "C:\jython2.7b3\Lib\site-packages\pelix\shell\core.py", line 1152, in threads_list
    frames = sys._current_frames()
AttributeError: '<reflected field public org.python.core.PyObject o' object has no attribute '_current_frames'
tcalmant commented 9 years ago

Added a protection against the AttributeError in commit 3b25c9fa067ffd6cd11b0a4a340acd150549fc8e

Having thread and threads commands working in interpreters other than CPython are now an enhancement.

tcalmant commented 9 years ago

The threads command works on Pypy and Pypy3 nearly like in CPython (except Pypy doesn't let access to the value of the frame locals).

It doesn't interesting enough to implement this feature on other interpreters, as they might not give access to the state of threads others than the calling one.

If somebody thinks this feature is important, feel free to reopen the issue.