Page MenuHomePhabricator

Remove the use of inline flags in the middle of regular expression
Closed, ResolvedPublic

Description

See https://bugs.python.org/issue22493

I propose to deprecate (and then forbid in 3.7) the use of inline flags not at the start of regular expression. This will help to change the meaning of inline flags in the middle of the expression in future (in 3.8 or later).
DeprecationWarning: Flags not at the start of the expression

happens in textlib.removeDisabledParts()

Event Timeline

Xqt triaged this task as Low priority.May 25 2018, 3:13 AM
Xqt subscribed.

We can change framework regexes und should do that imho. But how can we deprecate this usage inside a foreign script when using pywikibot?

We can change framework regexes und should do that imho. But how can we deprecate this usage inside a foreign script when using pywikibot?

Probably this will be handled by Python itself? The deprecation warning from removeExcept is thrown by Python or not?

DeprecationWarning is issued by python.
We should change the framework regexes so that we do not get it due to our own code.
Script owners are on their own, I think. They are getting the same warning, they should fix their code.

Xqt renamed this task from Deprecate the use of flags not at the start of regular expression to Remove the use of inline flags in the middle of regular expression.May 26 2018, 5:36 AM

happens in textlib.removeDisabledParts()

That happens by joining multiple regexes where most of them has inline flags in front.

Change 435686 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [fix] Remove inline flags in removeDisabledParts

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

Change 435686 abandoned by Xqt:
[fix] Remove inline flags in removeDisabledParts

Reason:

Hopefully there will be a possibility to merge patterns and resolve

> their issues in the future: http://bugs.python.org/issue33658

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

Xqt changed the task status from Open to Stalled.May 27 2018, 11:17 AM
Xqt edited projects, added: Phabricator (Upstream); removed: Patch-For-Review.

Stalled until an upstream solution is published, see http://bugs.python.org/issue33658

There was proposed a workaround introduced in py3.7: https://bugs.python.org/issue33658 So basically we will need two sets of patterns, one set for py3.6- and one for py3.7+. But this is really not ideal :/

• Vvjjkkii renamed this task from Remove the use of inline flags in the middle of regular expression to pbcaaaaaaa.Jul 1 2018, 1:08 AM
• Vvjjkkii changed the task status from Stalled to Open.
• Vvjjkkii raised the priority of this task from Low to High.
• Vvjjkkii updated the task description. (Show Details)
• Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from pbcaaaaaaa to Remove the use of inline flags in the middle of regular expression.Jul 2 2018, 1:18 PM
CommunityTechBot changed the task status from Open to Stalled.
CommunityTechBot lowered the priority of this task from High to Low.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.

Change 445851 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] textlib._create_default_regexes: Avoid using inline flags

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

Xqt changed the task status from Stalled to Open.Jul 15 2018, 8:26 AM
Xqt assigned this task to Dalba.

Change 445851 merged by jenkins-bot:
[pywikibot/core@master] textlib._create_default_regexes: Avoid using inline flags

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