Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

regression in py38 with bool-as-index deprecation warning #14397

Copy link
Copy link
Open
@tacaswell

Description

@tacaswell
Issue body actions

Also reported upstream at https://bugs.python.org/issue37980

With numpy 1.17.1 and python37 the following does not warn

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

but with py38

In [2]: sorted([1, 2], reverse=np.bool_(True))                                                                                                                  
<ipython-input-2-6726f33270df>:1: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
  sorted([1, 2], reverse=np.bool_(True))
Out[2]: [2, 1]

This bisects to python/cpython#11952 which use __index__ in more places which is tripping the deprecation in a surprising place.

sorted([1, 2], reverse=bool(np.bool_(True)))

Works in all cases.

amueller and rth

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.