Skip to content

Commit

Permalink
fix: Make float and int hashable
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Jul 27, 2023
1 parent 653a375 commit 7ed7d3a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [0.12.1] - 2023-07-27

### Fixed

- Make float and int hashable.

## [0.12.0] - 2023-07-27

### Added
Expand Down Expand Up @@ -359,7 +365,8 @@
- Fixed handling of super tables with different sections.
- Fixed raw strings escaping.

[unreleased]: https://github.com/sdispater/tomlkit/compare/0.12.0...master
[unreleased]: https://github.com/sdispater/tomlkit/compare/0.12.1...master
[0.12.1]: https://github.com/sdispater/tomlkit/releases/tag/0.12.1
[0.12.0]: https://github.com/sdispater/tomlkit/releases/tag/0.12.0
[0.11.8]: https://github.com/sdispater/tomlkit/releases/tag/0.11.8
[0.11.7]: https://github.com/sdispater/tomlkit/releases/tag/0.11.7
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tomlkit"
version = "0.12.0"
version = "0.12.1"
description = "Style preserving TOML library"
authors = [
"Sébastien Eustace <sebastien@eustace.io>",
Expand Down
2 changes: 1 addition & 1 deletion tomlkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from tomlkit.api import ws


__version__ = "0.12.0"
__version__ = "0.12.1"
__all__ = [
"aot",
"array",
Expand Down
6 changes: 6 additions & 0 deletions tomlkit/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ def unwrap(self) -> int:

__int__ = unwrap

def __hash__(self) -> int:
return hash(self.unwrap())

@property
def discriminant(self) -> int:
return 2
Expand Down Expand Up @@ -693,6 +696,9 @@ def unwrap(self) -> float:

__float__ = unwrap

def __hash__(self) -> int:
return hash(self.unwrap())

@property
def discriminant(self) -> int:
return 3
Expand Down

0 comments on commit 7ed7d3a

Please sign in to comment.