Skip to content

Commit 495f1b3

Browse files
committed
made Result class private
1 parent e16cd49 commit 495f1b3

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

tests/test_tkthread.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class ExpectedTestError(Exception):
4141
class TestResultClass(unittest.TestCase):
4242

4343
def test_event(self):
44-
r = tkthread.Result()
44+
r = tkthread._Result()
4545
self.assertEqual(r.event.is_set(), False)
4646

4747
def test_set_result(self):
48-
r = tkthread.Result()
48+
r = tkthread._Result()
4949
self.assertEqual(r.result, None)
5050

5151
@thread_start(r)
@@ -56,7 +56,7 @@ def tset(r):
5656
self.assertEqual(r.result, True)
5757

5858
def test_set_error(self):
59-
r = tkthread.Result()
59+
r = tkthread._Result()
6060

6161
@thread_start(r)
6262
def tset(r):
@@ -68,7 +68,7 @@ def tset(r):
6868
r.get()
6969

7070
def test_wait(self):
71-
r = tkthread.Result()
71+
r = tkthread._Result()
7272
done = []
7373

7474
@thread_start(r)

tkthread/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def run(func):
7575

7676
from ._version import __version__
7777

78-
__all__ = ['TkThread', 'tk', 'Result', '__version__']
78+
__all__ = ['TkThread', 'tk', '__version__']
7979

80-
class Result(object):
80+
class _Result(object):
8181
"""Cross-thread synchronization of a result"""
8282
def __init__(self):
8383
self.event = threading.Event()
@@ -173,7 +173,7 @@ def __call__(self, func, *args, **kwargs):
173173
if threading.current_thread() is self._main_thread:
174174
return func(*args, **kwargs)
175175
else:
176-
tres = Result()
176+
tres = _Result()
177177
self._results.add(tres)
178178
self._thread_queue.put((func, args, kwargs, tres))
179179
return tres.get()
@@ -187,7 +187,7 @@ def destroy(self):
187187
188188
Threads that call into TkThread must be stopped
189189
before calling .destroy() to avoid missing pending
190-
Result objects from being set to error.
190+
calls from being set to error.
191191
"""
192192
self._running = False
193193
self._thread_queue.put(None) # unblock _tcl_thread queue

0 commit comments

Comments
 (0)