标签: python-2.7 deprecation-warning
我在我的 api 中使用了 warnings.warn(message, DeprecationWarning, stacklevel=2),但我刚刚了解到除非由 __main__ 中的代码触发,否则这将被忽略。
warnings.warn(message, DeprecationWarning, stacklevel=2)
__main__
而且我的 api 被很多地方调用。