[New-bugs-announce] [issue24294] DeprecationWarnings should be visible by default in the interactive REPL

Nathaniel Smith report at bugs.python.org
Wed May 27 10:06:30 CEST 2015

New submission from Nathaniel Smith:

DeprecationWarning and PendingDeprecationWarning are invisible by default. The rationale for this is that they are only useful to people who are writing code, so they should not be shown to end-users who are merely running code.

If someone is typing stuff into the interactive REPL, though, and the code they type uses some deprecated functionality, then we should actually show them this warning. We know that the author is sitting right there. And they're probably going to take whatever they tested interactively and move it into a more permanent form and ugh.

This problem is particularly acute for packages that are primarily used through the interactive prompt, like numpy. I am tired of getting bugs like this: https://github.com/numpy/numpy/issues/5919

The solution is simple: when entering interactive mode, the REPL should do something like:

warnings.filterwarnings("default", category=DeprecationWarning, module="__main__")
warnings.filterwarnings("default", category=PendingDeprecationWarning, module="__main__")

messages: 244147
nosy: njs
priority: normal
severity: normal
status: open
title: DeprecationWarnings should be visible by default in the interactive REPL
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list