Built-in Exceptions

PendingDeprecationWarning — exception class

Signals a feature expected to be deprecated later, but not yet actively deprecated. Default filters generally hide it; prefer DeprecationWarning once the deprecation is active. The example explicitly promotes this warning category to an exception to make the result independent of default filters. Catch PendingDeprecationWarning when this category is the recovery boundary; do not rely on the exact human-readable message.

Formal Syntax & Structure

python syntaxpython
PendingDeprecationWarning

Return Value

type

The class object PendingDeprecationWarning; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
import warningstry:    with warnings.catch_warnings():        warnings.simplefilter("error", PendingDeprecationWarning)        warnings.warn("demo", PendingDeprecationWarning)except PendingDeprecationWarning as error:    print(type(error).__name__)
Python Reference