jenkins-bot submitted this change.
[bugfix] Check whether _putthead is current_thread() to join()
Do not _putthread.join() if _putthead is not current_thread().
Otherwise a RuntimeError is raised to prevent a deadlock.
Also break the while loop during KeyboardInterrupt to drop all
throttles.
Bug: T263331
Change-Id: If79741b4f29c2ef48f5a1a14c1873c73d983fc2c
---
M pywikibot/__init__.py
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 97dadda..cfc2c0d 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1349,17 +1349,18 @@
'{lightblue}Waiting for {num} pages to be put. '
'Estimated time remaining: {sec}{default}', num=num, sec=sec))
- while (_putthread.is_alive()
- and (page_put_queue.qsize() > 0
- or page_put_queue_busy.qsize() > 0)):
- try:
- _putthread.join(1)
- except KeyboardInterrupt:
- if input_yn('There are {} pages remaining in the queue. '
- 'Estimated time remaining: {}\nReally exit?'
- .format(*remaining()),
- default=False, automatic_quit=False):
- return
+ if _putthread is not threading.current_thread():
+ while (_putthread.is_alive()
+ and (page_put_queue.qsize() > 0
+ or page_put_queue_busy.qsize() > 0)):
+ try:
+ _putthread.join(1)
+ except KeyboardInterrupt:
+ if input_yn('There are {} pages remaining in the queue. '
+ 'Estimated time remaining: {}\nReally exit?'
+ .format(*remaining()),
+ default=False, automatic_quit=False):
+ break
# only need one drop() call because all throttles use the same global pid
with suppress(IndexError):
To view, visit change 628580. To unsubscribe, or for help writing mail filters, visit settings.