@@ -165,8 +165,9 @@ public class Pattern : IWeakReferenceable {
165165 internal Pattern ( CodeContext /*!*/ context , object pattern , ReFlags flags = 0 , bool compiled = false ) {
166166 _prePattern = PreParseRegex ( context , PatternAsString ( pattern , ref flags ) , verbose : flags . HasFlag ( ReFlags . VERBOSE ) , isBytes : ! flags . HasFlag ( ReFlags . UNICODE ) , out ReFlags options ) ;
167167 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
170171 if ( flags . HasFlag ( ReFlags . ASCII | ReFlags . LOCALE ) ) throw PythonOps . ValueError ( "ASCII and LOCALE flags are incompatible" ) ;
171172 _re = GenRegex ( context , _prePattern , flags , compiled , false ) ;
172173 this . pattern = pattern ;
@@ -418,7 +419,7 @@ public object sub(CodeContext/*!*/ context, object? repl, object? @string, int c
418419 // only when not adjacent to a previous match
419420 if ( string . IsNullOrEmpty ( match . Value ) && match . Index == prevEnd ) {
420421 return "" ;
421- } ;
422+ }
422423 prevEnd = match . Index + match . Length ;
423424
424425 if ( replacement != null ) return UnescapeGroups ( context , match , replacement ) ;
@@ -445,7 +446,7 @@ public PythonTuple subn(CodeContext/*!*/ context, object? repl, object? @string,
445446 // only when not adjacent to a previous match
446447 if ( string . IsNullOrEmpty ( match . Value ) && match . Index == prevEnd ) {
447448 return "" ;
448- } ;
449+ }
449450 prevEnd = match . Index + match . Length ;
450451
451452 totalCount ++ ;
0 commit comments