[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

Thomas Caswell report at bugs.python.org
Thu Aug 29 12:39:02 EDT 2019


New submission from Thomas Caswell <tcaswell at gmail.com>:

In python37, numpy1.17 the following runs without warning.

import numpy as np
sorted([1, 2], reverse=np.bool_(True))  

with python38 this emits a

DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index

I bisected this back to https://github.com/python/cpython/pull/11952 which looks very intentional, however it is tripping deprecation warnings in numpy to prevent things like `[1, 2, 3][np.bool_(False), np.bool_(True)]` from doing surprising things.

I have previously gotten the sense that core would like to know about these sorts of regressions rather than just handling them down-stream.  I will be opening an issue with numpy as well.

----------
files: numpy_warning_bisect.log
messages: 350800
nosy: tcaswell
priority: normal
severity: normal
status: open
title: regression when passing numpy bools to sorted(..., reverse=r)
versions: Python 3.8
Added file: https://bugs.python.org/file48568/numpy_warning_bisect.log

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37980>
_______________________________________


More information about the Python-bugs-list mailing list