jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1309856?usp=email )
Change subject: tools: use sys._getframemodulename in redirect_func if available
......................................................................
tools: use sys._getframemodulename in redirect_func if available
Change-Id: I97dfd23640d7e66d0b01a2416b46dc97df01b7f8
---
M pywikibot/tools/_deprecate.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index 9044a1c..4105dc5 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -731,10 +731,14 @@
target_module = target.__module__
if target_module and target_module[-1] != '.':
target_module += '.'
+
if source_module == '.':
source_module = target_module
elif source_module and source_module[-1] != '.':
source_module += '.'
+ elif PYTHON_VERSION >= (3, 12):
+ source_module = sys._getframemodulename( # type: ignore[attr-defined]
+ 1) + '.'
else:
source_module = sys._getframe(1).f_globals['__name__'] + '.'
if class_name:
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1309856?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I97dfd23640d7e66d0b01a2416b46dc97df01b7f8
Gerrit-Change-Number: 1309856
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]