Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 554780b

Browse filesBrowse files
committed
gh-111545: Add Include/cpython/pyhash.h header file
Move non-limited C API to a new Include/cpython/pyhash.h header file.
1 parent 0ff6368 commit 554780b
Copy full SHA for 554780b

File tree

Expand file treeCollapse file tree

5 files changed

+24
-13
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+24
-13
lines changed

‎Include/cpython/pyhash.h

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef Py_CPYTHON_HASH_H
2+
# error "this header file must not be included directly"
3+
#endif
4+
5+
/* hash function definition */
6+
typedef struct {
7+
Py_hash_t (*const hash)(const void *, Py_ssize_t);
8+
const char *name;
9+
const int hash_bits;
10+
const int seed_bits;
11+
} PyHash_FuncDef;
12+
13+
PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);

‎Include/pyhash.h

Copy file name to clipboardExpand all lines: Include/pyhash.h
+6-13Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,6 @@
44
extern "C" {
55
#endif
66

7-
#ifndef Py_LIMITED_API
8-
/* hash function definition */
9-
typedef struct {
10-
Py_hash_t (*const hash)(const void *, Py_ssize_t);
11-
const char *name;
12-
const int hash_bits;
13-
const int seed_bits;
14-
} PyHash_FuncDef;
15-
16-
PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
17-
#endif
18-
19-
207
/* Cutoff for small string DJBX33A optimization in range [1, cutoff).
218
*
229
* About 50% of the strings in a typical Python application are smaller than
@@ -60,6 +47,12 @@ PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
6047
# endif /* uint64_t && uint32_t && aligned */
6148
#endif /* Py_HASH_ALGORITHM */
6249

50+
#ifndef Py_LIMITED_API
51+
# define Py_CPYTHON_HASH_H
52+
# include "cpython/pyhash.h"
53+
# undef Py_CPYTHON_HASH_H
54+
#endif
55+
6356
#ifdef __cplusplus
6457
}
6558
#endif

‎Makefile.pre.in

Copy file name to clipboardExpand all lines: Makefile.pre.in
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,7 @@ PYTHON_HEADERS= \
17681768
$(srcdir)/Include/cpython/pyerrors.h \
17691769
$(srcdir)/Include/cpython/pyfpe.h \
17701770
$(srcdir)/Include/cpython/pyframe.h \
1771+
$(srcdir)/Include/cpython/pyhash.h \
17711772
$(srcdir)/Include/cpython/pylifecycle.h \
17721773
$(srcdir)/Include/cpython/pymem.h \
17731774
$(srcdir)/Include/cpython/pystate.h \

‎PCbuild/pythoncore.vcxproj

Copy file name to clipboardExpand all lines: PCbuild/pythoncore.vcxproj
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
<ClInclude Include="..\Include\cpython\pyerrors.h" />
173173
<ClInclude Include="..\Include\cpython\pyfpe.h" />
174174
<ClInclude Include="..\Include\cpython\pyframe.h" />
175+
<ClInclude Include="..\Include\cpython\pyhash.h" />
175176
<ClInclude Include="..\Include\cpython\pylifecycle.h" />
176177
<ClInclude Include="..\Include\cpython\pymem.h" />
177178
<ClInclude Include="..\Include\cpython\pystate.h" />

‎PCbuild/pythoncore.vcxproj.filters

Copy file name to clipboardExpand all lines: PCbuild/pythoncore.vcxproj.filters
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@
468468
<ClInclude Include="..\Include\cpython\pyframe.h">
469469
<Filter>Include\cpython</Filter>
470470
</ClInclude>
471+
<ClInclude Include="..\Include\cpython\pyhash.h">
472+
<Filter>Include\cpython</Filter>
473+
</ClInclude>
471474
<ClInclude Include="..\Include\cpython\pylifecycle.h">
472475
<Filter>Include\cpython</Filter>
473476
</ClInclude>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.