jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/778665 )
Change subject: [bugfix] use already imported scripts module for run_python_file ......................................................................
[bugfix] use already imported scripts module for run_python_file
Also update scripts version signature
Bug: T305799 Change-Id: Ic9e32754417e9918474e4fbc3970ec5667b3cc45 --- M pwb.py M scripts/__init__.py 2 files changed, 10 insertions(+), 7 deletions(-)
Approvals: D3r1ck01: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index 5fa8c9a..49b5a62 100755 --- a/pwb.py +++ b/pwb.py @@ -450,12 +450,15 @@ filename = os.path.join(os.curdir, relative_filename)
module = None - if file_package and file_package not in sys.modules: + if file_package: try: - module = import_module(file_package) - except ImportError as e: - warn('Parent module {} not found: {}' - .format(file_package, e), ImportWarning) + module = sys.modules[file_package] + except KeyError: + try: + module = import_module(file_package) + except ImportError as e: + warn('Parent module {} not found: {}' + .format(file_package, e), ImportWarning)
help_option = any(arg.startswith('-help:') or arg == '-help' for arg in script_args) diff --git a/scripts/__init__.py b/scripts/__init__.py index 3afcca2..92c0935 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -25,8 +25,8 @@ due to spelling mistake """ # -# (C) Pywikibot team, 2021 +# (C) Pywikibot team, 2021-2022 # # Distributed under the terms of the MIT license. # -__version__ = '7.0.0' +__version__ = '7.2.0'
pywikibot-commits@lists.wikimedia.org