Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
699e616
bpo-36346: Prepare for removing the legacy Unicode C API.
serhiy-storchaka Oct 26, 2018
60b89c9
Fix winreg.SetValue().
serhiy-storchaka Mar 19, 2019
f386b63
Clean up some ifdefs in _testcapimodule.
serhiy-storchaka Mar 19, 2019
11e0e0c
Make path_cleanup() paranoidally safer.
serhiy-storchaka Mar 19, 2019
236f608
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Mar 19, 2019
8750d48
Fix os.scandir().
serhiy-storchaka Mar 20, 2019
431e71f
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Mar 20, 2019
545c7a9
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Mar 28, 2019
3c1ab31
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Mar 13, 2020
54b0561
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jun 15, 2020
2c62d96
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jun 29, 2020
6d89775
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jun 30, 2020
3b5294a
Silence compiler warnings.
serhiy-storchaka Jun 30, 2020
e7898fa
Fix PyUnicode_IsIdentifier for the cache-less build.
serhiy-storchaka Jun 30, 2020
fd641c6
Silence compiler warnings on Windows.
serhiy-storchaka Jun 30, 2020
a79d935
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jun 30, 2020
ed14aa9
Fix compiler warning in _testcapi.
serhiy-storchaka Jun 30, 2020
c5eb102
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 1, 2020
d529224
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 1, 2020
6102b4b
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 5, 2020
74695b3
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 5, 2020
97b5228
Use HAVE_UNICODE_WCHAR_CACHE instead of USE_UNICODE_WCHAR_CACHE in _P…
serhiy-storchaka Jul 5, 2020
d6ba6b7
Set HAVE_UNICODE_WCHAR_CACHE and USE_UNICODE_WCHAR_CACHE only if they…
serhiy-storchaka Jul 9, 2020
0da4146
Remove Py_UNICODE_MATCH.
serhiy-storchaka Jul 9, 2020
51365fb
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 10, 2020
e425908
Fix unterminated #if.
serhiy-storchaka Jul 10, 2020
8a9259b
Reset arraymodule.c.
serhiy-storchaka Jul 10, 2020
76ba4b6
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 10, 2020
16ac7fd
Temporary disable the wchar_t cache by default.
serhiy-storchaka Jul 10, 2020
5e90bf8
Fix unicode_result().
serhiy-storchaka Jul 10, 2020
09675ab
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Jul 10, 2020
6915ce3
Merge branch 'master' into disable-wchar-cache
serhiy-storchaka Apr 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Silence compiler warnings on Windows.
  • Loading branch information
serhiy-storchaka committed Jun 30, 2020
commit fd641c69a44883fc54a9bae1c474d949806392f2
3 changes: 3 additions & 0 deletions Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,10 @@ static PyObject *load_library(PyObject *self, PyObject *args)
return NULL;

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const WCHAR *name = _PyUnicode_AsUnicode(nameobj);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
WCHAR *name = PyUnicode_AsWideCharString(nameobj, NULL);
Comment thread
serhiy-storchaka marked this conversation as resolved.
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
3 changes: 3 additions & 0 deletions Modules/_io/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
return -1;
}
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
widename = PyUnicode_AsUnicode(stringobj);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
widename = PyUnicode_AsWideCharString(stringobj, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
11 changes: 10 additions & 1 deletion Modules/overlapped.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ overlapped_CreateEvent(PyObject *self, PyObject *args)
}
else if (PyUnicode_Check(Name_obj)) {
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
Name = (wchar_t *)_PyUnicode_AsUnicode(Name_obj);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
Name = PyUnicode_AsWideCharString(Name_obj, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand All @@ -395,7 +398,7 @@ overlapped_CreateEvent(PyObject *self, PyObject *args)
}
}
else {
_PyArg_BadArgument("CreateEvent", 4, "str or None", Name_obj);
_PyArg_BadArgument("CreateEvent", "argument 4", "str or None", Name_obj);
return NULL;
}

Expand Down Expand Up @@ -1256,7 +1259,10 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
return -1;
}
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
Host = (wchar_t *)_PyUnicode_AsUnicode(Host_obj);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
Host = PyUnicode_AsWideCharString(Host_obj, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down Expand Up @@ -1284,7 +1290,10 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
return -1;
}
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
Host = (wchar_t *)_PyUnicode_AsUnicode(Host_obj);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
Host = PyUnicode_AsWideCharString(Host_obj, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
12 changes: 12 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,10 @@ path_converter(PyObject *o, void *p)
if (is_unicode) {
#ifdef MS_WINDOWS
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
wide = PyUnicode_AsUnicodeAndSize(o, &length);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wide = PyUnicode_AsWideCharString(o, &length);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down Expand Up @@ -1179,7 +1182,10 @@ path_converter(PyObject *o, void *p)
}

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
wide = PyUnicode_AsUnicodeAndSize(wo, &length);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wide = PyUnicode_AsWideCharString(wo, &length);
Py_DECREF(wo);
Expand Down Expand Up @@ -12850,7 +12856,10 @@ DirEntry_fetch_stat(PyObject *module, DirEntry *self, int follow_symlinks)
if (!PyUnicode_FSDecoder(self->path, &ub))
return NULL;
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *path = PyUnicode_AsUnicode(ub);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *path = PyUnicode_AsWideCharString(ub, NULL);
Py_DECREF(ub);
Expand Down Expand Up @@ -13076,9 +13085,12 @@ os_DirEntry_inode_impl(DirEntry *self)
if (!PyUnicode_FSDecoder(self->path, &unicode))
return NULL;
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *path = PyUnicode_AsUnicode(unicode);
result = LSTAT(path, &stat);
Py_DECREF(unicode);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *path = PyUnicode_AsWideCharString(unicode, NULL);
Py_DECREF(unicode);
Expand Down
6 changes: 6 additions & 0 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4468,9 +4468,12 @@ unicode_decode_call_errorhandler_wchar(
}

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
repwlen = PyUnicode_GetSize(repunicode);
if (repwlen < 0)
goto onError;
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
repwlen = PyUnicode_AsWideChar(repunicode, NULL, 0);
if (repwlen < 0)
Expand Down Expand Up @@ -7811,11 +7814,14 @@ encode_code_page_strict(UINT code_page, PyObject **outbytes,
if (substring == NULL)
return -1;
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
p = PyUnicode_AsUnicodeAndSize(substring, &size);
if (p == NULL) {
Py_DECREF(substring);
return -1;
}
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
p = PyUnicode_AsWideCharString(substring, &size);
Py_CLEAR(substring);
Expand Down
6 changes: 6 additions & 0 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ record_setstring(msiobj* record, PyObject *args)
return NULL;

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
data = (wchar_t *)_PyUnicode_AsUnicode(data_obj);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
data = PyUnicode_AsWideCharString(data_obj, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down Expand Up @@ -636,7 +639,10 @@ summary_setproperty(msiobj* si, PyObject *args)

if (PyUnicode_Check(data)) {
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const WCHAR *value = _PyUnicode_AsUnicode(data);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
WCHAR *value = PyUnicode_AsWideCharString(data, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
6 changes: 6 additions & 0 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,13 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
if (!PyUnicode_Check(t))
return FALSE;
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
len = PyUnicode_GetSize(t);
if (len < 0)
return FALSE;
len++;
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
len = PyUnicode_AsWideChar(t, NULL, 0);
if (len < 0)
Expand Down Expand Up @@ -1707,7 +1710,10 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
}

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *value = PyUnicode_AsUnicodeAndSize(value_obj, &value_length);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *value = PyUnicode_AsWideCharString(value_obj, &value_length);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
3 changes: 3 additions & 0 deletions Python/dynload_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
#endif

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *wpathname = _PyUnicode_AsUnicode(pathname);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *wpathname = PyUnicode_AsWideCharString(pathname, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
6 changes: 6 additions & 0 deletions Python/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,10 @@ _Py_stat(PyObject *path, struct stat *statbuf)
struct _stat wstatbuf;

#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *wpath = _PyUnicode_AsUnicode(path);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *wpath = PyUnicode_AsWideCharString(path, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down Expand Up @@ -1454,7 +1457,10 @@ _Py_fopen_obj(PyObject *path, const char *mode)
return NULL;
}
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *wpath = _PyUnicode_AsUnicode(path);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *wpath = PyUnicode_AsWideCharString(path, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down