Skip to content

gh-100239: expose sq_repeat helpers for BINARY_OP_EXTEND#148791

Merged
kumaraditya303 merged 3 commits intopython:mainfrom
NekoAsakura:gh-100239/expose-sq-repeat-helpers
May 8, 2026
Merged

gh-100239: expose sq_repeat helpers for BINARY_OP_EXTEND#148791
kumaraditya303 merged 3 commits intopython:mainfrom
NekoAsakura:gh-100239/expose-sq-repeat-helpers

Conversation

@NekoAsakura
Copy link
Copy Markdown
Contributor

@NekoAsakura NekoAsakura commented Apr 20, 2026

main branch %
str * int 32.0 ns 26.4 ns -17.5%
int * str 32.7 ns 26.8 ns -18.0%
bytes * int 27.0 ns 23.1 ns -14.4%
int * bytes 27.2 ns 23.0 ns -15.4%
tuple * int 29.3 ns 24.9 ns -15.0%
int * tuple 29.7 ns 24.8 ns -16.5%

Comment thread Python/specialize.c Outdated
int_str_multiply(PyObject *lhs, PyObject *rhs)
{
return seq_int_multiply(rhs, lhs, PyUnicode_Type.tp_as_sequence->sq_repeat);
Py_ssize_t count = PyLong_AsSsize_t(lhs);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is repeated a couple of times, we could use a macro to define the methods (similar to FLOAT_LONG_ACTION). But current form is also fine with me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. 17 insertions(+), 59 deletions(-).

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32583781 | 📁 Comparing 9cf450a against main (13188db)

  🔍 Preview build  

109 files changed · ± 107 modified · - 2 deleted

± Modified

- Deleted

@NekoAsakura
Copy link
Copy Markdown
Contributor Author

@markshannon gentle ping :')

@kumaraditya303 kumaraditya303 enabled auto-merge (squash) May 8, 2026 11:05
@kumaraditya303 kumaraditya303 merged commit d2d24e4 into python:main May 8, 2026
56 checks passed
@NekoAsakura NekoAsakura deleted the gh-100239/expose-sq-repeat-helpers branch May 8, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants