Skip to content

[mypyc] Implement str.lower() and str.upper() primitive #19375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
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
Next Next commit
Refactor CPyStr_Lower and CPyStr_Upper to use consistent variable nam…
…ing for character conversion
  • Loading branch information
Jahongir-Qurbonov committed Jul 6, 2025
commit cc2ed145cd76b12059f696b1d8a94ec49b244437
8 changes: 4 additions & 4 deletions mypyc/lib-rt/str_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ PyObject *CPyStr_Lower(PyObject *self) {
// Unified loop for all Unicode kinds
for (Py_ssize_t i = 0; i < len; i++) {
Py_UCS4 ch = PyUnicode_READ(kind, data, i);
Py_UCS4 lower = Py_UNICODE_TOLOWER(ch);
PyUnicode_WRITE(res_kind, res_data, i, lower);
Py_UCS4 rch = Py_UNICODE_TOLOWER(ch);
PyUnicode_WRITE(res_kind, res_data, i, rch);
}
return res;
}
Expand Down Expand Up @@ -617,8 +617,8 @@ PyObject *CPyStr_Upper(PyObject *self) {
// Unified loop for all Unicode kinds
for (Py_ssize_t i = 0; i < len; i++) {
Py_UCS4 ch = PyUnicode_READ(kind, data, i);
Py_UCS4 upper = Py_UNICODE_TOUPPER(ch);
PyUnicode_WRITE(res_kind, res_data, i, upper);
Py_UCS4 rch = Py_UNICODE_TOUPPER(ch);
PyUnicode_WRITE(res_kind, res_data, i, rch);
}
return res;
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy