Skip to content

please convert warnings to DeprecationWarning (Trac #1530) #2127

@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1530 on 2010-06-29 by @sandrotosi, assigned to unknown.

Hello,
I'm here forwarding the bug filed in the Debian bts at http://bugs.debian.org/519483 .

The ticket refers to 1.2.1 but the same still applies in 1.4.1 too, for example:

python-numpy-1.4.1$ grep -A4 warnings.warn numpy/lib/function_base.py
        warnings.warn("""
        The histogram semantics being used is now deprecated and
        will disappear in NumPy 2.0.  Please update your code to
        use the default semantics.
        """, DeprecationWarning)
--
            warnings.warn("""
            The new semantics of histogram is now the default and the `new`
            keyword will be removed in NumPy 2.0.
            """, Warning)
        a = asarray(a)

and there are several other places where warnings.warn is used:

python-numpy-1.4.1$ grep warnings.warn numpy/* -rc | grep -v ':0$'
numpy/core/memmap.py:2
numpy/core/numeric.py:1
numpy/core/setup_common.py:1
numpy/ctypeslib.py:1
numpy/distutils/command/config.py:2
numpy/distutils/core.py:5
numpy/distutils/cpuinfo.py:2
numpy/distutils/exec_command.py:1
numpy/distutils/fcompiler/gnu.py:1
numpy/distutils/misc_util.py:1
numpy/distutils/system_info.py:12
numpy/lib/arraysetops.py:1
numpy/lib/function_base.py:2
numpy/lib/io.py:3
numpy/lib/polynomial.py:1
numpy/lib/utils.py:2
numpy/ma/core.py:6
numpy/ma/extras.py:1
numpy/ma/mrecords.py:1
numpy/numarray/alter_code2.py:1
numpy/numarray/functions.py:4
numpy/oldnumeric/alter_code2.py:1
numpy/oldnumeric/ma.py:1
numpy/polynomial/chebyshev.py:1
numpy/polynomial/polynomial.py:1
numpy/testing/tests/test_utils.py:2

If the warnings.warn is used to signal a deprecation coming in the near future, then using DeprecationWarning is more precise (it specifies exactly that) and also would allow users to silence them.

Thanks for your support,
Sandro

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions