Skip to content

Comment on NumPy 1.20

Comments

I've been getting some odd warnings (thousands of them) from CI runs against 1.20, typical:

    some-file.py:83: DeprecationWarning: `np.bool` is a
    deprecated alias for the builtin `bool`. To silence 
    this warning, use `bool` by itself. Doing this will 
    not modify any behavior and is safe. If you specifically
    wanted the numpy scalar type, use `np.bool_` here.
    Deprecated in NumPy 1.20; for more details and guidance: 
    https://numpy.org/devdocs/release/1.20.0/notes.html#deprecations

    return self.z[j][i]
But all of the lines mentioned in these warning do not reference np.bool

I haven't seriously used Python for quite a while so I don't know if this is possible/usual, maybe there's some kind of code generation happening at runtime that would throw off line numbers or added/removed/substituted lines compared to the on-disk script files?

I don't actually use "np.bool" anywhere in the project :-|

That's what I meant by code generation, that maybe NumPy at runtime add/removes/substitutes some code to optimize dynamically, although I don't know if that's a thing in Python/NumPy.

Are you using libraries that use `np.bool`? These could trigger warnings to stderr that you would see.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.