Built-in Exceptions — Python 3.16.0a0 documentation

docs.python.org

Tin mới

Thread Safety Guarantees

Python Module Index

3.16.0a0 Documentation

The Python Standard Library

Exception context¶

In Python, all exceptions must be instances of a class that derives from BaseException. In a try statement with an except clause that mentions a particular class, that clause also handles any exception classes derived fr

User-defined Exceptions

In Python, all exceptions must be instances of a class that derives from BaseException. In a try statement with an except clause that mentions a particular class, that clause also handles any exception classes derived fr

The raise statement

A writable field that holds the traceback object associated with this exception. See also: The raise statement.

Attribute references

Raised when an attribute reference (see Attribute references) or assignment fails. (When an object does not support attribute references or attribute assignments at all, TypeError is raised.)

io.TextIOBase.read()

Raised when the input() function hits an end-of-file condition (EOF) without reading any data. (Note: the io.TextIOBase.read() and io.IOBase.readline() methods return an empty string when they hit EOF.)

Note on Signal Handlers and Exceptions

Catching a KeyboardInterrupt requires special consideration. Because it can be raised at unpredictable points, it may, in some circumstances, leave the running program in an inconsistent state. It is generally best to al

filesystem encoding and error handler

Changed in version 3.4: The filename attribute is now the original file name passed to the function, instead of the name encoded to or decoded from the filesystem encoding and error handler. Also, the filename2 construct

threading.Thread.join

sys.is_finalizing()

This exception is derived from RuntimeError. It is raised when an operation is blocked during interpreter shutdown also known as Python finalization.

weakref: Support for weak references and weak dictionaries.

This exception is raised when a weak reference proxy, created by the weakref.proxy() function, is used to access an attribute of the referent after it has been garbage collected. For more information on weak references,

errno.ECONNABORTED

A subclass of ConnectionError, raised when a connection attempt is aborted by the peer. Corresponds to errno ECONNABORTED.

Warning Categories

The following exceptions are used as warning categories; see the Warning Categories documentation for more details.

Python Development Mode

Base class for warnings about deprecated features when those warnings are intended for other Python developers.