Skip to content

hash() method not returning same value across python versions #127615

@Jisan09

Description

@Jisan09

Bug report

Bug description:

Value from hash isn't matching over python versions, turned off Randomization with PYTHONHASHSEED. Till python 3.10 it was showing 3672830208859661989 for hash of str(3) , but from python 3.11 it became -6250727467951016618.

Any way to get same 3672830208859661989 on higher python versions?

export PYTHONHASHSEED=0

Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> hash("3")
3672830208859661989

export PYTHONHASHSEED=0

Python 3.13.1 (v3.13.1:06714517797, Dec  3 2024, 14:00:22) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> hash("3")
-6250727467951016618

CPython versions tested on:

3.9, 3.10, 3.11, 3.13

Operating systems tested on:

Linux, macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions