This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ezio.melotti, mrabarnett, serhiy.storchaka
Date 2017-05-07.14:39:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494167958.42.0.581219852932.issue30298@psf.upfronthosting.co.za>
In-reply-to
Content
There is a difference between handling inline modifiers in regular expressions between Python and all other regular expression engines that support inline modifiers. In other engines an inline modifier affect only the part of the pattern after it. It Python it affects also the part before it. For avoiding possible confusion and for removing this difference in distant future, using inline modifiers not at the start of the pattern was deprecated in 3.6 (see issue22493).

But the condition for raising a warning is too strong. It allows using '(?is)...', but '(?i)(?s)...' emits a warning. This makes hard modifying regular expressions by prefixing them with inline modifiers. This condition is unjustifiably strong because '(?i)(?s)...' doesn't have any ambiguity. It also disallows ' (?i)...' in verbose mode despite the fact that whitespaces are not significant in verbose mode.

Proposed patch weaks the condition of deprecation warnings. It allows using several subsequent inline modifiers at the start of the pattern and ignores whitespaces in verbose mode.
History
Date User Action Args
2017-05-07 14:39:18serhiy.storchakasetrecipients: + serhiy.storchaka, ezio.melotti, mrabarnett
2017-05-07 14:39:18serhiy.storchakasetmessageid: <1494167958.42.0.581219852932.issue30298@psf.upfronthosting.co.za>
2017-05-07 14:39:18serhiy.storchakalinkissue30298 messages
2017-05-07 14:39:18serhiy.storchakacreate