jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892415 )
Change subject: Revert "[IMPR] flush: log the traceback when exiting by exception"
......................................................................
Revert "[IMPR] flush: log the traceback when exiting by exception"
This reverts commit d90ef8ab9d057d241a8547d446b3d5da127299f0.
Reason for revert: Did not work as indented - only showed the object
Change-Id: Ic50846d7fa4d18c25c56cd387c3cf5b79bbd38e2
---
M pywikibot/comms/http.py
1 file changed, 13 insertions(+), 1 deletion(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 1a8f580..7828acf 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -115,7 +115,6 @@
session.close()
if hasattr(sys, 'last_type'):
- log(sys.last_traceback)
critical(f'Exiting due to uncaught exception {sys.last_type}')
log('Network session closed.')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892415
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic50846d7fa4d18c25c56cd387c3cf5b79bbd38e2
Gerrit-Change-Number: 892415
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892044 )
Change subject: [FIX] Avoid error when replacement includes backslash
......................................................................
[FIX] Avoid error when replacement includes backslash
Bug: T330021
Change-Id: I2255449aca7d496df4c56882997e254cb410d88e
---
M pywikibot/textlib.py
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Meno25: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 3079c22..1e09f87 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1214,7 +1214,8 @@
if re.match(fr'\s*{marker}', lastpart):
# Put the langlinks back into the noinclude's
regexp = re.compile(fr'{includeOff}\s*{marker}')
- newtext = regexp.sub(s + includeOff, s2)
+ # replace via lambda due to T330021
+ newtext = regexp.sub(lambda m: s + includeOff, s2)
else:
# Put the langlinks at the end, inside noinclude's
newtext = (s2.replace(marker, '').strip()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892044
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2255449aca7d496df4c56882997e254cb410d88e
Gerrit-Change-Number: 892044
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Meno25 <meno25mail(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892038 )
Change subject: [doc] Additional documentation about stopme()
......................................................................
[doc] Additional documentation about stopme()
Change-Id: I739af08c7f6d95885f042e414e8420ba3fed214d
---
M pywikibot/__init__.py
1 file changed, 38 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 259dfc9..afc4441 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -83,10 +83,10 @@
'exception', 'FilePage', 'handle_args', 'html2unicode', 'info', 'input',
'input_choice', 'input_yn', 'ItemPage', 'LexemeForm', 'LexemePage',
'LexemeSense', 'Link', 'log', 'MediaInfo', 'output', 'Page',
- 'PropertyPage', 'showDiff', 'show_help', 'Site', 'SiteLink', 'sleep',
- 'stdout', 'stopme', 'Timestamp', 'translate', 'ui', 'url2unicode',
- 'User', 'warning', 'WbGeoShape', 'WbMonolingualText', 'WbQuantity',
- 'WbTabularData', 'WbTime', 'WbUnknown', 'WikidataBot',
+ 'page_put_queue', 'PropertyPage', 'showDiff', 'show_help', 'Site',
+ 'SiteLink', 'sleep', 'stdout', 'stopme', 'Timestamp', 'translate', 'ui',
+ 'url2unicode', 'User', 'warning', 'WbGeoShape', 'WbMonolingualText',
+ 'WbQuantity', 'WbTabularData', 'WbTime', 'WbUnknown', 'WikidataBot',
)
# argvu is set by pywikibot.bot when it's imported
@@ -1384,7 +1384,7 @@
"""Suspend execution of the current thread for the given number of seconds.
Drop this process from the throttle log if wait time is greater than
- 30 seconds.
+ 30 seconds by calling :func:`stopme`.
"""
if secs >= 30:
stopme()
@@ -1392,23 +1392,29 @@
def stopme() -> None:
- """
- Drop this process from the throttle log, after pending threads finish.
+ """Drop this process from the throttle log, after pending threads finish.
- Can be called manually if desired. Does not clean async_manager.
- This should be run when a bot does not interact with the Wiki, or
- when it has stopped doing so. After a bot has run stopme() it will
- not slow down other bots any more.
+ Can be called manually if desired but usually it is not necessary.
+ Does not clean :func:`async_manager`. This should be run when a bot
+ does not interact with the Wiki, or when it has stopped doing so.
+ After a bot has run ``stopme()`` it will not slow down other bots
+ instances any more.
+
+ ``stopme()`` is called with :func:`sleep` function during long
+ delays and with :meth:`bot.BaseBot.exit` to wait for pending write
+ threads.
"""
_flush(False)
def _flush(stop: bool = True) -> None:
- """
- Drop this process from the throttle log, after pending threads finish.
+ """Drop this process from the throttle log, after pending threads finish.
- Wait for the page-putter to flush its queue. Also drop this process from
- the throttle log. Called automatically at Python exit.
+ Wait for the page-putter to flush its queue. Also drop this process
+ from the throttle log. Called automatically at Python exit.
+
+ :param stop: Also clear :func:`async_manager`s put queue. This is
+ only done at exit time.
"""
debug('_flush() called')
@@ -1465,7 +1471,12 @@
# Create a separate thread for asynchronous page saves (and other requests)
def async_manager(block=True) -> None:
- """Daemon; take requests from the queue and execute them in background."""
+ """Daemon to take requests from the queue and execute them in background.
+
+ :param block: If true, block :attr:`page_put_queue` if necessary
+ until a request is available to process. Otherwise process a
+ request if one is immediately available, else leave the function.
+ """
while True:
if not block and page_put_queue.empty():
break
@@ -1486,8 +1497,9 @@
page_put_queue.put((request, args, kwargs))
-# queue to hold pending requests
+#: Queue to hold pending requests
page_put_queue: Queue = Queue(_config.max_queue_size)
+
# queue to signal that async_manager is working on a request. See T147178.
page_put_queue_busy: Queue = Queue(_config.max_queue_size)
# set up the background thread
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892038
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I739af08c7f6d95885f042e414e8420ba3fed214d
Gerrit-Change-Number: 892038
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged