Page MenuHomePhabricator

test_replace_tag_file is failing on Python 2.7.2
Closed, ResolvedPublic

Description

https://ci.appveyor.com/project/Ladsgroup/pywikibot-g4xqx/build/1.0.225/job/83ny5p3qel5stcpi#L4717

======================================================================
ERROR: test_replace_tag_file (tests.textlib_tests.TestReplaceExcept)
Test replacing not inside file links.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\pywikibot-g4xqx\tests\textlib_tests.py", line 1305, in test_replace_tag_file
    'x', 'y', ['file'], site=self.site),
  File "c:\projects\pywikibot-g4xqx\pywikibot\textlib.py", line 377, in replaceExcept
    excMatch = dontTouchR.search(text, index)
MemoryError

This has occurred after the change in 8ede851d8c0655b7eb021e69003e96215da01231 (T191113)

It's a known bug in older versions of python, resolved in https://bugs.python.org/issue9669 (duplicate: https://bugs.python.org/issue12177)

Event Timeline

Dalba created this task.Apr 1 2018, 8:47 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptApr 1 2018, 8:47 AM
Dalba added a comment.Apr 1 2018, 8:51 AM
This comment was removed by Dalba.
Xqt triaged this task as High priority.Apr 1 2018, 8:15 PM
Dalba closed this task as Resolved.Apr 2 2018, 1:38 AM
Dalba changed the task status from Resolved to Declined.
Dalba assigned this task to Xqt.
Dalba reopened this task as Open.Apr 2 2018, 2:21 AM
This comment was removed by Dalba.
Dalba renamed this task from test_replace_tag_file is failing on Python 2.6 and 3.3 to test_replace_tag_file is failing on Python 2.7.2.Apr 2 2018, 2:23 AM
Dalba updated the task description. (Show Details)
Dalba removed Xqt as the assignee of this task.Apr 2 2018, 2:46 AM
Dalba added a subscriber: Xqt.
Dalba added a comment.EditedApr 2 2018, 2:55 AM

According to changelogs the first versions of python with the fixed released are 2.7.4 release candidate 1, 3.3.1 release candidate 1, and 3.4.0 alpha 1.

Dalba added a comment.Apr 2 2018, 7:32 AM

3.4.0 alpha 1 is the first release of 3.4 series and we have dropped support for 3.3.
So we only have this issue with 2.7.2 and 2.7.3.
We could consider dropping support for them but we need a deprecation period. Till then, I suggest using the old regex for those versions.

Dalba added a comment.Apr 2 2018, 7:46 AM

On second thought, consuming 100% of CPU (T191113) is not that better than a MemoryError. There must be a better way.

Change 423447 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] Draft

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

Change 423447 abandoned by Dalba:
Draft

Reason:
Have not tested it yet, submitted by mistake

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

Change 423451 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] textlib.py: Do not use * quantifier in positive lookaheads of FILE_LINK_REGEX

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

Dalba claimed this task.Apr 2 2018, 8:42 AM

Change 423451 merged by jenkins-bot:
[pywikibot/core@master] textlib.py: Avoid zero-width matching groups

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

Dalba removed Dalba as the assignee of this task.Apr 2 2018, 9:42 AM
Dalba removed a project: Patch-For-Review.

The patch failed to resolve the issue.

Change 423463 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] Use the old FILE_LINK_REGEX regex for Python versions older than 2.7.4

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

Change 423463 merged by jenkins-bot:
[pywikibot/core@master] Use the old FILE_LINK_REGEX regex for Python versions older than 2.7.4

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

Dalba closed this task as Resolved.Apr 2 2018, 11:28 AM
Dalba claimed this task.
Xqt changed the status of subtask T191192: Drop support for python 2.7.2 and 2.7.3 from Stalled to Open.Dec 3 2018, 9:44 PM