Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[mypyc] Implementstr.lower() andstr.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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Jahongir-Qurbonov wants to merge18 commits intopython:master
base:master
Choose a base branch
Loading
fromJahongir-Qurbonov:str-lower-upper

Conversation

@Jahongir-Qurbonov
Copy link
Contributor

Add primitive forstr.lower andstr.upper. Issue:mypyc/mypyc#1088

BobTheBuidler reacted with eyes emoji
@Jahongir-QurbonovJahongir-Qurbonov changed the titleAdd str.lower() and str.upper() primitives[mypyc] Implementstr.lower() andstr.upper() primitiveJul 4, 2025
@sterliakovsterliakov added the topic-mypycmypyc bugs labelJul 4, 2025
Copy link
Collaborator

@JukkaLJukkaL left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Left some comments -- the semantics are pretty tricky, and we need to be careful to catch all special cases. I'd suggest running a test (doesn't need to be included in this PR necessarily) comparing upper/lower of all length-1 strings with Python semantics.

Jahongir-Qurbonov reacted with thumbs up emoji
assert "abc".lower() == "abc"
assert "AbC123".lower() == "abc123"
assert "áÉÍ".lower() == "áéí"
assert "😴🚀".lower() == "😴🚀"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also test special cases (verify that this agrees with normal Python semantics):

  • 'SS'.lower() == 'ss'
  • 'Σ'.lower()
  • 'İ'.lower() (changes length!)

assert "ABC".upper() == "ABC"
assert "AbC123".upper() == "ABC123"
assert "áéí".upper() == "ÁÉÍ"
assert "😴🚀".upper() == "😴🚀"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also test special case (verify that this agrees with normal Python semantics):

  • 'ß'.upper() == 'SS'
  • 'ffi'.upper() (length increases!)

@Jahongir-QurbonovJahongir-Qurbonov marked this pull request as draftJuly 4, 2025 18:08
Jahongir-Qurbonovand others added8 commitsJuly 6, 2025 16:42
…static lookup tables and using direct character conversion
@BobTheBuidler
Copy link
Contributor

@JukkaL he never unmarked this as a draft, but I notice he added the tests you requested. Is there anything left blocking this one? I would find this quite helpful for my use cases so I am willing to finish it up if there's anything else.

@Jahongir-Qurbonov
Copy link
ContributorAuthor

@BobTheBuidler These have not passed the test successfully, I don't know when I will have time, you can continue with this

#assert "İ".lower() == "i̇"  # TODO: Latin capital letter I with dot above -> 'i' + combining dot#assert len("İ".lower()) == 2  # TODO: Confirms length change#assert "ß".upper() == "SS"     # TODO: German sharp S -> double S#assert "ffi".upper() == "FFI"    # TODO: Ligature 'ffi' -> separate letters#assert len("ffi".upper()) == 3   # TODO: Confirm length increases

@Jahongir-QurbonovJahongir-Qurbonov marked this pull request as ready for reviewAugust 17, 2025 12:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JukkaLJukkaLAwaiting requested review from JukkaL

Assignees

No one assigned

Labels

topic-mypycmypyc bugs

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@Jahongir-Qurbonov@BobTheBuidler@JukkaL@sterliakov

[8]ページ先頭

©2009-2025 Movatter.jp