Skip to content

Commit aaee11d

Browse files
committed
perf: mark _get_buffer_or_str and _parse_fastcall_args Py_ALWAYS_INLINE
Ensures inlining across all optimization levels and compilers, matching CPython's own convention for performance-critical local helpers.
1 parent 7f2727a commit aaee11d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/_xxhash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* On success, *owner is set to the object that owns the buffer
5050
* (NULL if the arg itself supports the buffer protocol).
5151
* Caller must PyBuffer_Release(buf) and Py_XDECREF(*owner). */
52-
static int
52+
static Py_ALWAYS_INLINE int
5353
_get_buffer_or_str(PyObject *obj, Py_buffer *buf, PyObject **owner)
5454
{
5555
/* Check str first to avoid a guaranteed-failing PyObject_GetBuffer call
@@ -75,7 +75,7 @@ _get_buffer_or_str(PyObject *obj, Py_buffer *buf, PyObject **owner)
7575
* keyword 'seed', with proper error reporting for unknown keywords,
7676
* duplicate arguments, and too many positional args.
7777
* Returns 0 on success, -1 on error with exception set. */
78-
static int
78+
static Py_ALWAYS_INLINE int
7979
_parse_fastcall_args(PyObject *const *args, Py_ssize_t nargs,
8080
PyObject *kwnames, const char *funcname,
8181
Py_buffer *buf, PyObject **buf_owner,

0 commit comments

Comments
 (0)