Staging
v0.5.1
https://github.com/python/cpython
Revision 30c2ae4dcfd19acbdfb7045151c73d5700eec7b4 authored by Miss Islington (bot) on 25 June 2019, 10:29:18 UTC, committed by Ned Deily on 02 July 2019, 02:21:22 UTC
* bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304)

* The UTF-8 incremental decoders fails now fast if encounter
  a sequence that can't be handled by the error handler.
* The UTF-16 incremental decoders with the surrogatepass error
  handler decodes now a lone low surrogate with final=False.
(cherry picked from commit 894263ba80af4b7733c2df95b527e96953922656)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent c58fc3a
Raw File
Tip revision: 30c2ae4dcfd19acbdfb7045151c73d5700eec7b4 authored by Miss Islington (bot) on 25 June 2019, 10:29:18 UTC
[3.7] bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304) (GH-14369)
Tip revision: 30c2ae4
generrmap.c
#include <windows.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <errno.h>

/* Extract the mapping of Win32 error codes to errno */

int main()
{
    int i;
    _setmode(fileno(stdout), O_BINARY);
    printf("/* Generated file. Do not edit. */\n");
    printf("int winerror_to_errno(int winerror)\n");
    printf("{\n    switch(winerror) {\n");
    for(i=1; i < 65000; i++) {
        _dosmaperr(i);
        if (errno == EINVAL) {
            /* Issue #12802 */
            if (i == ERROR_DIRECTORY)
                errno = ENOTDIR;
            /* Issue #13063 */
            else if (i == ERROR_NO_DATA)
                errno = EPIPE;
            else
                continue;
        }
        printf("        case %d: return %d;\n", i, errno);
    }
    printf("        default: return EINVAL;\n");
    printf("    }\n}\n");
}
back to top