Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix pyhash_runtime_state on Windows.
  • Loading branch information
ericsnowcurrently committed Nov 15, 2022
commit a4a55d1211e493d3aff03b1901dc91285b3286e8
23 changes: 19 additions & 4 deletions Include/internal/pycore_pyhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,32 @@


struct pyhash_runtime_state {
// This is a placeholder so the struct isn't empty on Windows.
int _not_used;
#ifndef MS_WINDOWS
struct {
#ifndef MS_WINDOWS
int fd;
dev_t st_dev;
ino_t st_ino;
} urandom_cache;
#else
// This is a placeholder so the struct isn't empty on Windows.
int _not_used;
#endif
} urandom_cache;
};

#ifndef MS_WINDOWS
# define _py_urandom_cache_INIT \
{ \
.fd = -1, \
}
#else
# define _py_urandom_cache_INIT {0}
#endif

#define pyhash_state_INIT \
{ \
.urandom_cache = _py_urandom_cache_INIT, \
}


uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t);

Expand Down
6 changes: 1 addition & 5 deletions Include/internal/pycore_runtime_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ extern "C" {
_pymem_allocators_obj_arena_INIT, \
}, \
.obmalloc = _obmalloc_state_INIT(runtime.obmalloc), \
.pyhash_state = { \
.urandom_cache = { \
.fd = -1, \
}, \
}, \
.pyhash_state = pyhash_state_INIT, \
.interpreters = { \
/* This prevents interpreters from getting created \
until _PyInterpreterState_Enable() is called. */ \
Expand Down