Skip to content

Commit a80d383

Browse files
author
Anselm Kruis
committed
Stackless issue python#79: make the module stackless IDE friendly
Add __all__ to stackless. Add entries to the module's __dict__ for the computed properties (i.e. current, main, ...). This helps IDEs (PyDev) to recognise the expression "stackless.current" as a defined name. (grafted from d5e6830501279c287a7971152a26b2ad5d244168)
1 parent 0de0efe commit a80d383

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Lib/stackless.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,35 @@ def __iter__(self):
3939
_wrap.range = range
4040
del range
4141

42+
__all__ = ['atomic',
43+
'channel',
44+
'enable_softswitch',
45+
'get_channel_callback',
46+
'get_schedule_callback',
47+
'get_thread_info',
48+
'getcurrent',
49+
'getcurrentid',
50+
'getdebug',
51+
'getmain',
52+
'getruncount',
53+
'getthreads',
54+
'getuncollectables',
55+
'pickle_with_tracing_state',
56+
'run',
57+
'schedule',
58+
'schedule_remove',
59+
'set_channel_callback',
60+
'set_error_handler',
61+
'set_schedule_callback',
62+
'switch_trap',
63+
'tasklet',
64+
'stackless', # ugly
65+
]
66+
67+
# these definitions have no function, but they help IDEs (i.e. PyDev) to recognise
68+
# expressions like "stackless.current" as well defined.
69+
current = runcount = main = debug = uncollectables = threads = pickle_with_tracing_state = None
70+
4271
def transmogrify():
4372
"""
4473
this function creates a subclass of the ModuleType with properties.

Stackless/unittests/test_outside.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
from stackless import *
3+
from stackless import test_cframe, test_cframe_nr, test_outside, test_cstate
34

45
from support import StacklessTestCase
56

0 commit comments

Comments
 (0)