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

safety: prevent UnicodeDecodeError on startup under py2 #2103

Merged
merged 1 commit into from
Jun 20, 2021

Conversation

dgw
Copy link
Member

@dgw dgw commented Jun 10, 2021

Description

One single comment in the StevenBlack list contains one single Unicode character that the 'ascii' codec doesn't like.

This will never be necessary on the master branch, which is about to permanently remove support for Python 2; py3 uses utf-8 by default in its str constructor.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches
    • It pained me to run Sopel under py2 again, but I did it for science.

@dgw dgw added the Bugfix Generally, PRs that reference (and fix) one or more issue(s) label Jun 10, 2021
@dgw dgw added this to the 7.1.1 milestone Jun 10, 2021
@dgw dgw requested a review from a team June 10, 2021 18:37
Exirel
Exirel previously approved these changes Jun 10, 2021
dgw added a commit that referenced this pull request Jun 19, 2021
safety: prevent UnicodeDecodeError on startup under py2
@dgw
Copy link
Member Author

dgw commented Jun 19, 2021

This is merged, but GitHub doesn't know about it yet because I merged to a staging branch. Hopefully tomorrow, all items for 7.1.1 will be ready to go and I'll fast-forward the maintenance branch so Travis can test everything at once. (Also hopefully there will be no failed tests, since everything has been fine on master.)

One single comment in the StevenBlack list contains one single Unicode
character that the 'ascii' codec doesn't like.

This will never be necessary on the master branch, which is about to
permanently remove support for Python 2; py3 uses utf-8 by default.
@dgw dgw force-pushed the safety-unicodeerror branch from ae42eda to 1bf2d1b Compare June 19, 2021 06:54
@dgw dgw requested a review from Exirel June 19, 2021 06:55
@dgw dgw dismissed Exirel’s stale review June 19, 2021 06:55

The originally reviewed code has been replaced.

@dgw
Copy link
Member Author

dgw commented Jun 19, 2021

The previous patch actually failed under Python 3, which I'd foolishly never tested, with TypeError: decoding str is not supported. Rather than try to get fancy and write something that will work on both platforms, I just stuck the offending operation in an if/else and called it a day.

@Exirel
Copy link
Contributor

Exirel commented Jun 19, 2021

and called it a day

This will do.

@dgw dgw merged commit 95d030f into 7.1.x Jun 20, 2021
@dgw dgw deleted the safety-unicodeerror branch June 20, 2021 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants