warnings — Warning control — Python 3.14.7 documentation

docs.python.org

Tin mới

__main__ — Top-level code environment

dataclasses — Data Classes

Python Module Index

3.14.7 Documentation

The Python Standard Library

Python Runtime Services

Warning Categories¶

Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warrant raising an exception and terminating the program. F

Warning Categories¶

Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warrant raising an exception and terminating the program. F

logging.captureWarnings()

logging.captureWarnings() allows you to handle all warnings with the standard logging infrastructure.

built-in exceptions

There are a number of built-in exceptions that represent warning categories. This categorization is useful to be able to filter out groups of warnings.

Describing Warning Filters¶

The warnings filter is initialized by -W options passed to the Python interpreter command line and the PYTHONWARNINGS environment variable. The interpreter saves the arguments for all supplied entries without interpretat

Default Warning Filter¶

By default, Python installs several warning filters, which can be overridden by the -W command-line option, the PYTHONWARNINGS environment variable and calls to filterwarnings().

unittest: Unit testing framework for Python.

Warning categories that are primarily of interest to Python developers (rather than end users of applications written in Python) are ignored by default.

static type checkers

Decorator to indicate that a class, function or overload is deprecated.

typing.get_overloads()

Decorator to indicate that a class, function or overload is deprecated.

asyncio coroutines

If the context_aware_warnings flag is false, then catch_warnings will modify the global attributes of the warnings module. This is not safe if used within a concurrent program (using multiple threads or using asyncio cor

contextvars.ContextVar

If the context_aware_warnings flag is false, then catch_warnings will modify the global attributes of the warnings module. This is not safe if used within a concurrent program (using multiple threads or using asyncio cor