Steps to replicate the issue (include links if applicable):
>>> site = pywikibot.Site() >>> page = pywikibot.Page(site, 'Wikipedia:Categories for discussion/Log/2025 November 8#Japanese superhero films by decade') >>> page.text
What happens?:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/jjmc89/wrk/pwb/pywikibot/page/_basepage.py", line 581, in text
return self.get(get_redirect=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jjmc89/wrk/pwb/pywikibot/page/_basepage.py", line 396, in get
raise SectionError(f'{page_section!r} is not a valid section '
pywikibot.exceptions.SectionError: 'Japanese superhero films by decade' is not a valid section of Wikipedia:Categories for discussion/Log/2025 November 8What should have happened instead?:
An exception is not raised due to a LRM being present in the wikitext but not in page.section().
[[Wikipedia:Categories for discussion/Log/2025 November 8#Japanese superhero films by decade]] is a working link to the section of the page with ==== Japanese superhero films\u200e by decade ====.
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Pywikibot: [ssh] pywikibot-core (af27117, g20065, 2025/11/28, 21:37:46, master)
Release version: 11.0.0.dev2
Other information (browser name/version, screenshots, etc.):
Report based on the content of the page as of https://en.wikipedia.org/w/index.php?title=Wikipedia:Categories_for_discussion/Log/2025_November_8&oldid=1324681231, which was subsequently edited to remove the LRM.