Skip to content

gh-144087: Add support for unicode MINUS SIGN in int, float and complex#144095

Draft
johnslavik wants to merge 22 commits intopython:mainfrom
johnslavik:feat-handle-minus-sign
Draft

gh-144087: Add support for unicode MINUS SIGN in int, float and complex#144095
johnslavik wants to merge 22 commits intopython:mainfrom
johnslavik:feat-handle-minus-sign

Conversation

@johnslavik
Copy link
Member

@johnslavik johnslavik commented Jan 21, 2026

I don't see a different approach to solving this that is equally or more optimal in terms of trade-offs. If there's any alternative approach that I've missed, please let me know.

@jaraco
Copy link
Member

jaraco commented Jan 24, 2026

LGTM. Needs tests and blurb. Maybe consider making the assignment a constant instead of a comment, though I don't feel strongly about it.

@johnslavik
Copy link
Member Author

johnslavik commented Jan 24, 2026

LGTM. Needs tests and blurb.

Yep! Work in progress.

Thanks for chiming in :)

@skirpichev
Copy link
Member

This also needs documentation. I would guess, it will take major part of the PR.

@picnixz
Copy link
Member

picnixz commented Jan 28, 2026

I don't see a different approach to solving this that is equally or more optimal in terms of trade-offs

How about only checking for the first non whitespace character? signs should not appear in the middle of a number unless they are in the e/E/p suffix I guess?

@skirpichev
Copy link
Member

How about only checking for the first non whitespace character?

Hardly this optimizes something.

unless they are in the e/E/p suffix I guess?

Yes. _PyUnicode_TransformDecimalAndSpaceToASCII() used for floats and complexes (which gives another case of "sign in the middle") too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants