@@ -230,6 +230,22 @@ type IExports =
230230
231231 abstract print: obj : obj -> unit
232232
233+ /// Print with custom end string (default is newline)
234+ [<NamedParams( fromIndex = 1 ) >]
235+ abstract print: obj : obj * ``end`` : string -> unit
236+
237+ /// Print with custom separator and end string
238+ [<NamedParams( fromIndex = 1 ) >]
239+ abstract print: obj : obj * sep : string * ``end`` : string -> unit
240+
241+ /// Print to a file-like object (e.g., sys.stderr)
242+ [<NamedParams( fromIndex = 1 ) >]
243+ abstract print: obj : obj * file : TextIOBase -> unit
244+
245+ /// Print to a file-like object with custom end string
246+ [<NamedParams( fromIndex = 1 ) >]
247+ abstract print: obj : obj * ``end`` : string * file : TextIOBase -> unit
248+
233249 [<NamedParams( fromIndex = 1 ) >]
234250 abstract ``open``:
235251 file: int *
@@ -257,6 +273,55 @@ type IExports =
257273[<ImportAll( " builtins" ) >]
258274let builtins : IExports = nativeOnly
259275
276+ // ============================================================================
277+ // Python Built-in Exceptions
278+ // https://docs.python.org/3/library/exceptions.html
279+ // ============================================================================
280+
281+ // BaseException subclasses (not Exception subclasses)
282+ // These require special handling in try/catch as they don't inherit from Exception
283+
284+ /// Raised when the user hits the interrupt key (normally Control-C or Delete).
285+ /// Note: Inherits from BaseException, not Exception.
286+ /// https://docs.python.org/3/library/exceptions.html#KeyboardInterrupt
287+ [<Import( " KeyboardInterrupt" , " builtins" ) >]
288+ type KeyboardInterrupt () =
289+ inherit exn()
290+
291+ /// Raised by the sys.exit() function.
292+ /// Note: Inherits from BaseException, not Exception.
293+ /// https://docs.python.org/3/library/exceptions.html#SystemExit
294+ [<Import( " SystemExit" , " builtins" ) >]
295+ type SystemExit () =
296+ inherit exn()
297+
298+ /// Raised when a generator or coroutine is closed.
299+ /// Note: Inherits from BaseException, not Exception.
300+ /// https://docs.python.org/3/library/exceptions.html#GeneratorExit
301+ [<Import( " GeneratorExit" , " builtins" ) >]
302+ type GeneratorExit () =
303+ inherit exn()
304+
305+ // Exception subclasses
306+
307+ /// Raised when a system function returns a system-related error.
308+ /// https://docs.python.org/3/library/exceptions.html#OSError
309+ [<Import( " OSError" , " builtins" ) >]
310+ type OSError () =
311+ inherit exn()
312+
313+ /// Raised when an operation runs out of memory.
314+ /// https://docs.python.org/3/library/exceptions.html#MemoryError
315+ [<Import( " MemoryError" , " builtins" ) >]
316+ type MemoryError () =
317+ inherit exn()
318+
319+ /// Raised when the interpreter finds an internal error.
320+ /// https://docs.python.org/3/library/exceptions.html#SystemError
321+ [<Import( " SystemError" , " builtins" ) >]
322+ type SystemError () =
323+ inherit exn()
324+
260325// NOTE: Below we can add builtins that don't require overloads, and do not
261326// conflict with common F# or .NET functions. If they do we keep them in
262327// `IExports` above.
0 commit comments