Page MenuHomePhabricator

Pywikibot fails with Python 3.12a7
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

py -3.12 pwb.py site_tests -v TestSiteProofreadinfo

What happens?:

tests: max_retries reduced from 15 to 1
test_cache_proofreadinfo_on_site_with_proofreadpage (__main__.TestSiteProofreadinfo.test_cache_proofreadinfo_on_site_with_proofreadpage)
Test Site._cache_proofreadinfo(). ... ok
test_cache_proofreadinfo_on_site_without_proofreadpage (__main__.TestSiteProofreadinfo.test_cache_proofreadinfo_on_site_without_proofreadpage)
Test Site._cache_proofreadinfo(). ... Exception ignored in garbage collection:
Traceback (most recent call last):
  File "D:\pwb\GIT\core\pywikibot\site\_basesite.py", line 187, in __getattr__
    def __getattr__(self, attr):

SystemError: <function BaseSite.family at 0x0000023AFBD87240> returned a result with an exception set
ERROR

======================================================================
ERROR: test_cache_proofreadinfo_on_site_without_proofreadpage (__main__.TestSiteProofreadinfo.test_cache_proofreadinfo_on_site_without_proofreadpage)
Test Site._cache_proofreadinfo().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\pwb\GIT\core\tests\site_tests.py", line 1236, in test_cache_proofreadinfo_on_site_without_proofreadpage
    site.proofread_index_ns
  File "D:\pwb\GIT\core\pywikibot\site\_basesite.py", line 198, in __getattr__
    raise AttributeError(f'{type(self).__name__} instance has no '
AttributeError: APISite instance has no attribute 'proofread_index_ns'. Did you mean: 'proofread_page_ns'?

----------------------------------------------------------------------
Ran 2 tests in 1.739s

FAILED (errors=1)

https://github.com/wikimedia/pywikibot/actions/runs/4647025294/jobs/8230498089
https://github.com/wikimedia/pywikibot/actions/runs/4647025294/jobs/8230498136

In short:

import pywikibot
s = pywikibot.Site('en')
s._cache_proofreadinfo()
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    s._cache_proofreadinfo()
  File "D:\pwb\GIT\core\pywikibot\site\_decorators.py", line 58, in callee
    raise UnknownExtensionError(
pywikibot.exceptions.UnknownExtensionError: Method "_cache_proofreadinfo" is not implemented without the extension ProofreadPage
s.proofread_index_ns
Exception ignored in tp_clear of: <class 'cell'>
Traceback (most recent call last):
  File "D:\pwb\GIT\core\pywikibot\site\_basesite.py", line 187, in __getattr__
    def __getattr__(self, attr):

SystemError: <function BaseSite.family at 0x000002196EF56480> returned a result with an exception set
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    s.proofread_index_ns
  File "D:\pwb\GIT\core\pywikibot\site\_basesite.py", line 198, in __getattr__
    raise AttributeError(f'{type(self).__name__} instance has no '
AttributeError: APISite instance has no attribute 'proofread_index_ns'. Did you mean: 'proofread_page_ns'?

What should happen instead:

import pywikibot
s = pywikibot.Site('en')
s._cache_proofreadinfo()
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    s._cache_proofreadinfo()
  File "D:\pwb\GIT\core\pywikibot\site\_decorators.py", line 58, in callee
    raise UnknownExtensionError(
pywikibot.exceptions.UnknownExtensionError: Method "_cache_proofreadinfo" is not implemented without the extension ProofreadPage
s.proofread_index_ns
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    s.proofread_index_ns
  File "D:\pwb\GIT\core\pywikibot\site\_extensions.py", line 127, in proofread_index_ns
    self._cache_proofreadinfo()
  File "D:\pwb\GIT\core\pywikibot\site\_decorators.py", line 58, in callee
    raise UnknownExtensionError(
pywikibot.exceptions.UnknownExtensionError: Method "_cache_proofreadinfo" is not implemented without the extension ProofreadPage

Software version:
Python 3.12a7 (works with 3.12a3-6)
Pywikibot 8.1.0dev3
Pywikibot 8.0.3

Event Timeline

Xqt triaged this task as High priority.Apr 10 2023, 9:20 AM
Xqt changed the task status from Open to In Progress.Apr 10 2023, 9:25 AM
Xqt claimed this task.

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

[pywikibot/core@master] [tests] Test 3.12.0a7 as experimental because it is failing

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

Change 907482 merged by jenkins-bot:

[pywikibot/core@master] [tests] Test 3.12.0a7 as experimental because it is failing

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

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

[pywikibot/core@master] Revert "[tests] Test 3.12.0a7 as experimental because it is failing"

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

Change 906619 merged by Xqt:

[pywikibot/core@master] Revert "[tests] Test 3.12.0a7 as experimental because it is failing"

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

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

[pywikibot/core@master] [tests] Add a workaround for T334378 to BaseSite.__getattr__

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

Change 907485 merged by jenkins-bot:

[pywikibot/core@master] [tests] Add a workaround for T334378 to BaseSite.__getattr__

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

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

[pywikibot/core@master] [tests] Follow-up patch for T334378

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

Change 907495 merged by jenkins-bot:

[pywikibot/core@master] [tests] Follow-up patch for T334378

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

Xqt reopened this task as Open.
Xqt lowered the priority of this task from High to Lowest.

Kept for upstream issue

Xqt raised the priority of this task from Lowest to Low.May 6 2023, 6:43 AM

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

[pywikibot/core@master] [bugfix] T334378 seems solved with Python 3.12.beta

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

Change 924520 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] T334378 seems solved with Python 3.12.beta

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