@@ -353,25 +353,44 @@ module API {
353
353
354
354
/** Returns the names of known built-ins. */
355
355
private string builtin_name ( ) {
356
- // Built-in functions shared between Python 2.7.6 and 3.9.5
356
+ // Built-in functions and exceptions shared between Python 2 and 3
357
357
result in [
358
358
"abs" , "all" , "any" , "bin" , "bool" , "bytearray" , "callable" , "chr" , "classmethod" ,
359
359
"compile" , "complex" , "delattr" , "dict" , "dir" , "divmod" , "enumerate" , "eval" , "filter" ,
360
360
"float" , "format" , "frozenset" , "getattr" , "globals" , "hasattr" , "hash" , "help" , "hex" ,
361
361
"id" , "input" , "int" , "isinstance" , "issubclass" , "iter" , "len" , "list" , "locals" , "map" ,
362
362
"max" , "memoryview" , "min" , "next" , "object" , "oct" , "open" , "ord" , "pow" , "print" ,
363
363
"property" , "range" , "repr" , "reversed" , "round" , "set" , "setattr" , "slice" , "sorted" ,
364
- "staticmethod" , "str" , "sum" , "super" , "tuple" , "type" , "vars" , "zip" , "__import__"
364
+ "staticmethod" , "str" , "sum" , "super" , "tuple" , "type" , "vars" , "zip" , "__import__" ,
365
+ // Exceptions
366
+ "ArithmeticError" , "AssertionError" , "AttributeError" , "BaseException" , "BufferError" ,
367
+ "BytesWarning" , "DeprecationWarning" , "EOFError" , "EnvironmentError" , "Exception" ,
368
+ "FloatingPointError" , "FutureWarning" , "GeneratorExit" , "IOError" , "ImportError" ,
369
+ "ImportWarning" , "IndentationError" , "IndexError" , "KeyError" , "KeyboardInterrupt" ,
370
+ "LookupError" , "MemoryError" , "NameError" , "NotImplemented" , "NotImplementedError" ,
371
+ "OSError" , "OverflowError" , "PendingDeprecationWarning" , "ReferenceError" , "RuntimeError" ,
372
+ "RuntimeWarning" , "StandardError" , "StopIteration" , "SyntaxError" , "SyntaxWarning" ,
373
+ "SystemError" , "SystemExit" , "TabError" , "TypeError" , "UnboundLocalError" ,
374
+ "UnicodeDecodeError" , "UnicodeEncodeError" , "UnicodeError" , "UnicodeTranslateError" ,
375
+ "UnicodeWarning" , "UserWarning" , "ValueError" , "Warning" , "ZeroDivisionError"
365
376
]
366
377
or
367
- // Built-in constants shared between Python 2.7.6 and 3.9.5
378
+ // Built-in constants shared between Python 2 and 3
368
379
result in [ "False" , "True" , "None" , "NotImplemented" , "Ellipsis" , "__debug__" ]
369
380
or
370
- // Python 3.9.5 only
381
+ // Python 3 only
371
382
major_version ( ) = 3 and
372
- result in [ "ascii" , "breakpoint" , "bytes" , "exec" ]
383
+ result in [
384
+ "ascii" , "breakpoint" , "bytes" , "exec" ,
385
+ // Exceptions
386
+ "BlockingIOError" , "BrokenPipeError" , "ChildProcessError" , "ConnectionAbortedError" ,
387
+ "ConnectionError" , "ConnectionRefusedError" , "ConnectionResetError" , "FileExistsError" ,
388
+ "FileNotFoundError" , "InterruptedError" , "IsADirectoryError" , "ModuleNotFoundError" ,
389
+ "NotADirectoryError" , "PermissionError" , "ProcessLookupError" , "RecursionError" ,
390
+ "ResourceWarning" , "StopAsyncIteration" , "TimeoutError"
391
+ ]
373
392
or
374
- // Python 2.7.6 only
393
+ // Python 2 only
375
394
major_version ( ) = 2 and
376
395
result in [
377
396
"basestring" , "cmp" , "execfile" , "file" , "long" , "raw_input" , "reduce" , "reload" ,
0 commit comments