Page MenuHomePhabricator

script_tests fails on threading free Python due to mwparserfromhell
Closed, ResolvedPublicBUG REPORT

Description

Threading free Python throws a warning in script_tests about unsafe mwparserfromhell:
RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'mwparserfromhell.parser._tokenizer', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.

See also: https://github.com/earwig/mwparserfromhell/issues/343

======================================================================
FAIL: test__login (tests.script_tests.TestScriptHelp.test__login)
Test running login -help.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/pywikibot/pywikibot/tests/script_tests.py", line 261, in test_script
    self.assertIn('Use -help for further information.',
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  stderr_other)
                  ^^^^^^^^^^^^^
AssertionError: 'Use -help for further information.' not found in ["WARNING: <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'mwparserfromhell.parser._tokenizer', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.", '']

======================================================================
FAIL: test_add_text (tests.script_tests.TestScriptHelp.test_add_text)
Test running add_text -help.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/pywikibot/pywikibot/tests/script_tests.py", line 261, in test_script
    self.assertIn('Use -help for further information.',
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  stderr_other)
                  ^^^^^^^^^^^^^
AssertionError: 'Use -help for further information.' not found in ["WARNING: <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'mwparserfromhell.parser._tokenizer', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.", '']

======================================================================
FAIL: test_archivebot (tests.script_tests.TestScriptHelp.test_archivebot)
Test running archivebot -help.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/pywikibot/pywikibot/tests/script_tests.py", line 261, in test_script
    self.assertIn('Use -help for further information.',
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  stderr_other)
                  ^^^^^^^^^^^^^
AssertionError: 'Use -help for further information.' not found in ["WARNING: <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'mwparserfromhell.parser._tokenizer', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.", '']

======================================================================
FAIL: test_basic (tests.script_tests.TestScriptHelp.test_basic)
Test running basic -help.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/pywikibot/pywikibot/tests/script_tests.py", line 261, in test_script
    self.assertIn('Use -help for further information.',
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  stderr_other)
                  ^^^^^^^^^^^^^
AssertionError: 'Use -help for further information.' not found in ["WARNING: <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'mwparserfromhell.parser._tokenizer', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.", '']

Related Objects

Event Timeline

Xqt triaged this task as High priority.Dec 14 2025, 12:59 PM
Xqt changed the subtype of this task from "Task" to "Bug Report".
Xqt moved this task from Backlog to Reported Upstream on the Upstream board.
Xqt moved this task from Backlog to Test failures on the Pywikibot-tests board.
Xqt renamed this task from script_tests fails on threading free Python to script_tests fails on threading free Python due to mwparserfromhell.Dec 14 2025, 2:30 PM

Change #1217855 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] tests: Force GIL "off" due to mwparserfromhell issue as suggested by warning

https://gerrit.wikimedia.org/r/1217855

Change #1217855 merged by Xqt:

[pywikibot/core@master] tests: Force GIL "off" due to mwparserfromhell issue as suggested by warning

https://gerrit.wikimedia.org/r/1217855

Xqt claimed this task.