mirror of
				https://github.com/ytdl-org/youtube-dl
				synced 2025-11-03 19:23:44 +00:00 
			
		
		
		
	[JSInterp] Handle undefined, etc, passed to JS_RegExp and Exception
This commit is contained in:
		
							parent
							
								
									94849bc997
								
							
						
					
					
						commit
						af049e309b
					
				@ -408,6 +408,7 @@ class JSInterpreter(object):
 | 
				
			|||||||
    class Exception(ExtractorError):
 | 
					    class Exception(ExtractorError):
 | 
				
			||||||
        def __init__(self, msg, *args, **kwargs):
 | 
					        def __init__(self, msg, *args, **kwargs):
 | 
				
			||||||
            expr = kwargs.pop('expr', None)
 | 
					            expr = kwargs.pop('expr', None)
 | 
				
			||||||
 | 
					            msg = str_or_none(msg, default='"None"')
 | 
				
			||||||
            if expr is not None:
 | 
					            if expr is not None:
 | 
				
			||||||
                msg = '{0} in: {1!r:.100}'.format(msg.rstrip(), expr)
 | 
					                msg = '{0} in: {1!r:.100}'.format(msg.rstrip(), expr)
 | 
				
			||||||
            super(JSInterpreter.Exception, self).__init__(msg, *args, **kwargs)
 | 
					            super(JSInterpreter.Exception, self).__init__(msg, *args, **kwargs)
 | 
				
			||||||
@ -435,6 +436,7 @@ class JSInterpreter(object):
 | 
				
			|||||||
                flags, _ = self.regex_flags(flags)
 | 
					                flags, _ = self.regex_flags(flags)
 | 
				
			||||||
            # First, avoid https://github.com/python/cpython/issues/74534
 | 
					            # First, avoid https://github.com/python/cpython/issues/74534
 | 
				
			||||||
            self.__self = None
 | 
					            self.__self = None
 | 
				
			||||||
 | 
					            pattern_txt = str_or_none(pattern_txt) or '(?:)'
 | 
				
			||||||
            self.__pattern_txt = pattern_txt.replace('[[', r'[\[')
 | 
					            self.__pattern_txt = pattern_txt.replace('[[', r'[\[')
 | 
				
			||||||
            self.__flags = flags
 | 
					            self.__flags = flags
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user