Skip to content

Correct the documented default encoding #18429

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 1 commit into from
Feb 10, 2020

Conversation

eric-wieser
Copy link
Contributor

@eric-wieser eric-wieser commented Feb 10, 2020

From the source for PyUnicode_Decode, the implementation is:

if (encoding == NULL) {
    return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL);
}

which is pretty clearly not defaulting to ASCII.


I assume this needs neither a news entry nor bpo link.

Automerge-Triggered-By: @gvanrossum

From the source for `PyUnicode_Decode`, the implementation is:
```
if (encoding == NULL) {
    return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL);
}
```
which is pretty clearly not defaulting to ASCII.
@bonitobird
Copy link

bonitobird commented Feb 10, 2020

At PyCascades Sprint, this seems reasonable. @willingc Please review.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

I think it's fine without issue or news.

@miss-islington
Copy link
Contributor

@eric-wieser: Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington
Copy link
Contributor

@eric-wieser: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit bf15d5b into python:master Feb 10, 2020
@miss-islington
Copy link
Contributor

Sorry, I can't merge this PR. Reason: Pull Request is not mergeable.

1 similar comment
@miss-islington
Copy link
Contributor

Sorry, I can't merge this PR. Reason: Pull Request is not mergeable.

@gvanrossum
Copy link
Member

I think miss-islington got triggered multiple times.

@eric-wieser I expect this could be backported to earlier versions (3.8, 3.7) -- but I would want you to do a little research to make sure that the default is the same in those branches. (You can browse the branches online in GitHub.)

@eric-wieser
Copy link
Contributor Author

Even 3.5 defaults to utf-8:

https://github.com/python/cpython/blob/3.5/Objects/unicodeobject.c#L2968-L2974

I suspect this was inherited from python 2 docs, and never updated.

@gvanrossum
Copy link
Member

gvanrossum commented Feb 11, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants