GeezerVison is showing github.com — bpo-34481: Fix surrogate-handling in strftime by pganssle · Pull Request #8983 · python/cpython
Conversation
pganssle
commented
Aug 28, 2018
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…gs in datetime classes
A follow-up of bpo-34454.
Now that the bug is fixed, the try/catch can be removed.
This is now also a more complete fix for bpo-6697.
This will cut down on some of the per-environment variability of this
function.
This passes a backslash-escaped unicode string to strftime in the event
that locale encoding fails. To ensure that the relevant string is
round-trippable, all backslashes in the original string are
double-escaped, and then unescaped when the result is decoded.
|
I have no idea how to reproduce this failure. It works fine on my home computer (Arch Linux), on a debian VPS and a debian WSL. All are succeeding.
I think that this will start succeeding on Linux as well if I re-enable wcsftime, but I'm quite concerned that it's failing in a way that I don't understand and can't reproduce.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I'm able to reproduce this issue only on Ubuntu 14. For some reason with '\ud800', this function is not raising an error in Ubuntu 14. However, a simple POC:
#include <stdlib.h>
#include <stdio.h>
int main() {
const wchar_t str[] = L"\xd800";
char buffer[32];
int rv = wcstombs(NULL, str, 0);
printf("%d\n", rv);
}
Works fine on both Ubuntu 14 and other Linux (returns -1). I am honestly deeply puzzled at this. I also am not sure how to make a minimal triggering example, because I'm not sure what the pure python equivalent of PyUnicode_EncodeLocale is. '\ud800'.encode(errors="surrogateescape") doesn't hit this code path. Anyone have an idea?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This is too annoying for me to continue working on it. Anyone else is free to pick up where I left off.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|