Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasraabe committed Nov 8, 2023
1 parent a2a5f22 commit 5d02dae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/_pytask/_hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ def hash_value(value: Any) -> int | str:
Compute the hash of paths, strings, and bytes with a hash function or otherwise the
hashes are salted.
The hash of None constant https://github.com/python/cpython/pull/99541 starting with
Python 3.12.
"""
#
if value is None:
return 4238894112
if isinstance(value, Path):
value = str(value)
if isinstance(value, str):
Expand Down
7 changes: 1 addition & 6 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import pickle
import sys
from pathlib import Path

import pytest
Expand Down Expand Up @@ -40,11 +39,7 @@ def test_hash_of_python_node(value, hash_, expected):
),
(
PythonNode(name="name", value=None),
# The hash of None constant https://github.com/python/cpython/pull/99541
# starting 3.12.
"a1f217807169de3253d1176ea5c45be20f3db2e2e81ea26c918f6008d2eb715b"
if sys.version_info >= (3, 12)
else "2af47fd015a32bd1b8d7f207930ca0a370f3a866c042d517350b59187a8f4987",
"a1f217807169de3253d1176ea5c45be20f3db2e2e81ea26c918f6008d2eb715b",
),
(
Task(base_name="task", path=Path("task.py"), function=None),
Expand Down

0 comments on commit 5d02dae

Please sign in to comment.