@@ -165,8 +165,9 @@ public class Pattern : IWeakReferenceable {
165
165
internal Pattern ( CodeContext /*!*/ context , object pattern , ReFlags flags = 0 , bool compiled = false ) {
166
166
_prePattern = PreParseRegex ( context , PatternAsString ( pattern , ref flags ) , verbose : flags . HasFlag ( ReFlags . VERBOSE ) , isBytes : ! flags . HasFlag ( ReFlags . UNICODE ) , out ReFlags options ) ;
167
167
flags |= options ;
168
- // TODO: re-enable in 3.6
169
- // if (flags.HasFlag(ReFlags.UNICODE | ReFlags.LOCALE)) throw PythonOps.ValueError("cannot use LOCALE flag with a str pattern");
168
+ #if PYTHON_36_OR_GREATER
169
+ if ( flags . HasFlag ( ReFlags . UNICODE | ReFlags . LOCALE ) ) throw PythonOps . ValueError ( "cannot use LOCALE flag with a str pattern" ) ;
170
+ #endif
170
171
if ( flags . HasFlag ( ReFlags . ASCII | ReFlags . LOCALE ) ) throw PythonOps . ValueError ( "ASCII and LOCALE flags are incompatible" ) ;
171
172
_re = GenRegex ( context , _prePattern , flags , compiled , false ) ;
172
173
this . pattern = pattern ;
@@ -418,7 +419,7 @@ public object sub(CodeContext/*!*/ context, object? repl, object? @string, int c
418
419
// only when not adjacent to a previous match
419
420
if ( string . IsNullOrEmpty ( match . Value ) && match . Index == prevEnd ) {
420
421
return "" ;
421
- } ;
422
+ }
422
423
prevEnd = match . Index + match . Length ;
423
424
424
425
if ( replacement != null ) return UnescapeGroups ( context , match , replacement ) ;
@@ -445,7 +446,7 @@ public PythonTuple subn(CodeContext/*!*/ context, object? repl, object? @string,
445
446
// only when not adjacent to a previous match
446
447
if ( string . IsNullOrEmpty ( match . Value ) && match . Index == prevEnd ) {
447
448
return "" ;
448
- } ;
449
+ }
449
450
prevEnd = match . Index + match . Length ;
450
451
451
452
totalCount ++ ;
0 commit comments