File tree Expand file tree Collapse file tree 1 file changed +0
-46
lines changed
Expand file tree Collapse file tree 1 file changed +0
-46
lines changed Original file line number Diff line number Diff line change @@ -1228,52 +1228,6 @@ private static string UnescapeGroups(RegExpMatch m, string text) {
12281228 return text ;
12291229 }
12301230
1231- private static string ValidateArguments ( object pattern , object @string ) {
1232- if ( pattern is Pattern p ) {
1233- pattern = p . pattern ;
1234- }
1235-
1236- string str ;
1237- if ( pattern is Bytes ) {
1238- switch ( @string ) {
1239- case IBufferProtocol bufferProtocol :
1240- using ( IPythonBuffer buf = bufferProtocol . GetBuffer ( ) ) {
1241- str = buf . AsReadOnlySpan ( ) . MakeString ( ) ;
1242- }
1243- break ;
1244- case IList < byte > b :
1245- str = b . MakeString ( ) ;
1246- break ;
1247- case MmapModule . MmapDefault mmapFile :
1248- str = mmapFile . GetSearchString ( ) . MakeString ( ) ;
1249- break ;
1250- case string _:
1251- case ExtensibleString _:
1252- throw PythonOps . TypeError ( "cannot use a bytes pattern on a string-like object" ) ;
1253- default :
1254- throw PythonOps . TypeError ( "expected string or bytes-like object" ) ;
1255- }
1256- } else if ( pattern is string ) {
1257- switch ( @string ) {
1258- case string s :
1259- str = s ;
1260- break ;
1261- case ExtensibleString es :
1262- str = es ;
1263- break ;
1264- case IBufferProtocol _:
1265- case IList < byte > _:
1266- case MmapModule . MmapDefault _:
1267- throw PythonOps . TypeError ( "cannot use a string pattern on a bytes-like object" ) ;
1268- default :
1269- throw PythonOps . TypeError ( "expected string or bytes-like object" ) ;
1270- }
1271- } else {
1272- throw PythonOps . TypeError ( "pattern must be a string or compiled pattern" ) ;
1273- }
1274- return str ;
1275- }
1276-
12771231 private static PythonType error ( CodeContext /*!*/ context ) => ( PythonType ) context . LanguageContext . GetModuleState ( "reerror" ) ;
12781232
12791233 private readonly struct PatternKey : IEquatable < PatternKey > {
You can’t perform that action at this time.
0 commit comments