Skip to content
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

bpo-31979: Simplify transforming decimals to ASCII #4336

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Nov 8, 2017

in int(), float() and complex() parsers.

https://bugs.python.org/issue31979

in int(), float() and complex() parsers.
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM. I just proposed to add a minor comment.

Nice cleanup! It's nice to see ugly fixup() and fix_decimal_and_space_to_ascii() go away. I prefer your code, it's simpler at the end.

if (s == NULL) {
goto exit;
}
assert(s != NULL);
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a short comment explaining that PyUnicode_AsUTF8AndSize() cannot fail on an ASCII string, since it simply returns a pointer to existing ASCII characters?

The assertion surprised me, I had to check how Unicode strings are implemented :-)

Same comment for the same assertion below.

@serhiy-storchaka serhiy-storchaka merged commit 9b6c60c into python:master Nov 13, 2017
@serhiy-storchaka serhiy-storchaka deleted the transform-decimal-to-ascii branch November 13, 2017 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants