Skip to content

bpo-37751: Fix normalizestring() with hyphens and spaces converted to underscores #15092

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

Merged
merged 9 commits into from
Aug 21, 2019

Conversation

qigangxu
Copy link
Contributor

@qigangxu qigangxu commented Aug 3, 2019

  • Fix normalizestring() with hyphens and spaces converted to underscores
  • Reuse _Py_normalize_encoding() in normalizestring()

https://bugs.python.org/issue37751

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

Copy link
Member

@shihai1991 shihai1991 left a comment

Choose a reason for hiding this comment

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

All the check have been passed, so LGTM.

@vstinner
Copy link
Member

Would it be possible to reuse _Py_normalize_encoding() in codecs.c normalizestring()?

@qigangxu
Copy link
Contributor Author

Would it be possible to reuse _Py_normalize_encoding() in codecs.c normalizestring()?

I went through two functions and found that they do have similar functions. At the same time, I tried to modify the code and the test cases passed.

The code can be modified just like 'check_force_ascii‘ calls ‘_Py_normalize_encoding‘ . And I think it's better to call _Py_normalize_encoding as an external function to other modules.

There is also a process problem. I am not quite sure whether to submit another issue to discuss this modification, or can I directly modify it in this issue?

@qigangxu
Copy link
Contributor Author

Would it be possible to reuse _Py_normalize_encoding() in codecs.c normalizestring()?

I will do more test for reusing _Py_normalize_encoding() in codecs.c normalizestring(). Thank you for your helpful suggestions。

@vstinner
Copy link
Member

You can create a new PR, this one can be closed when the new one is merged.

@qigangxu
Copy link
Contributor Author

You can create a new PR, this one can be closed when the new one is merged.

Let me try it.

@qigangxu qigangxu changed the title bpo-37751: Fix normalizestring() with hyphens and spaces converted to… bpo-37751: Fix normalizestring() with hyphens and spaces converted to underscores Aug 17, 2019
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

I think use a regular exception is better. Thanks.

Co-Authored-By: Victor Stinner <vstinner@redhat.com>
@vstinner
Copy link
Member

Can you please try to add a NEWS entry using the blurb tool? (install it using: python3 -m pip install --user blurb)

@qigangxu
Copy link
Contributor Author

Can you please try to add a NEWS entry using the blurb tool? (install it using: python3 -m pip install --user blurb)

Thank you for your careful guidance. I need to take a moment to familiarize myself with the blurb tool.

@qigangxu
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

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. Thanks for the update.

@vstinner vstinner merged commit 20f59fe into python:master Aug 21, 2019
@qigangxu qigangxu deleted the fix-issue-37751 branch August 21, 2019 14:24
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
Fix codecs.lookup() to normalize the encoding name the same way
than encodings.normalize_encoding(), except that codecs.lookup()
also converts the name to lower case.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Fix codecs.lookup() to normalize the encoding name the same way
than encodings.normalize_encoding(), except that codecs.lookup()
also converts the name to lower case.
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
Fix codecs.lookup() to normalize the encoding name the same way
than encodings.normalize_encoding(), except that codecs.lookup()
also converts the name to lower case.
eight04 added a commit to eight04/pyUAO that referenced this pull request Feb 22, 2021
* Fix running with Python 3.9

Since Python 3.9 [1], codecs names are normalized in a different way.

[1] python/cpython#15092

* Add: github action, bump dependencies

Co-authored-by: eight04 <eight04@gmail.com>
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.

5 participants