PendingDeprecationWarning
PendingDeprecationWarning: this feature will be deprecated
Traceback
Traceback (most recent call last):
File "main.py", line 2, in <module>
warnings.warn("old_api() will be deprecated", PendingDeprecationWarning)
PendingDeprecationWarning: this feature will be deprecatedWhat causes this error
A feature is planned for future deprecation but is still fully supported. This is the earliest warning stage in the deprecation lifecycle.
How to fix it
Note the warning for future planning. Check library changelogs for the deprecation timeline. Begin migrating to the recommended alternative when convenient. No immediate action is required.
Code that causes this error
import warnings
warnings.warn("old_api() will be deprecated", PendingDeprecationWarning)Fixed code
# Migrate when ready to the new API # old: old_api(data) # new: new_api(data) new_api(data)
About PendingDeprecationWarning
A PendingDeprecationWarning is issued for features that are not yet deprecated but are planned for deprecation in the future. It serves as an even earlier notification than DeprecationWarning — the feature is still fully supported, but the maintainers have decided it will eventually be deprecated and then removed. By default, PendingDeprecationWarning is ignored (even more aggressively than DeprecationWarning).
It is primarily useful for library maintainers and early adopters who want to stay ahead of upcoming changes. The typical lifecycle is: PendingDeprecationWarning → DeprecationWarning → removal. Some projects skip PendingDeprecationWarning entirely and go straight to DeprecationWarning.
To see these warnings, use `python -W default::PendingDeprecationWarning` or configure the warnings module.
Common scenarios
Using deprecated APIs that will be removed in future versions
Performing numerical operations that produce inf or NaN values
Leaving files, sockets, or connections open without proper cleanup
Calling async functions without awaiting the result