Skip to content

BUG: Fix ob_shash deprecation warning on Python 3.11 #21317

@felixxm

Description

@felixxm

Describe the issue:

ob_shash is deprecated on Python 3.11:

numpy/core/src/multiarray/scalarapi.c:709:13: warning: ‘ob_shash’ is deprecated [-Wdeprecated-declarations]

This looks unnecessary 🤔, cached hash value for obj should not be computed yet:

((PyBytesObject *)obj)->ob_shash = -1;

Reproduce the code example:

Run tests on Python 3.11.

Error message:

numpy/core/src/multiarray/scalarapi.c:709:13: warning: ‘ob_shash’ is deprecated [-Wdeprecated-declarations]

NumPy/Python version information:

1.23.0.dev0+1020.g08569fcf0 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions