mirror of
https://github.com/python/cpython.git
synced 2025-10-05 14:41:07 +00:00
bpo-43499: Silence compiler warnings about using legacy C API on Windows (GH-24873)
This commit is contained in:
parent
a838e477a0
commit
651fc30af7
8 changed files with 42 additions and 0 deletions
|
@ -1358,7 +1358,10 @@ static PyObject *load_library(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "U|i:LoadLibrary", &nameobj, &load_flags))
|
if (!PyArg_ParseTuple(args, "U|i:LoadLibrary", &nameobj, &load_flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
name = _PyUnicode_AsUnicode(nameobj);
|
name = _PyUnicode_AsUnicode(nameobj);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (!name)
|
if (!name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,10 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
|
||||||
if (!PyUnicode_FSDecoder(nameobj, &stringobj)) {
|
if (!PyUnicode_FSDecoder(nameobj, &stringobj)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
widename = PyUnicode_AsUnicode(stringobj);
|
widename = PyUnicode_AsUnicode(stringobj);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (widename == NULL)
|
if (widename == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1159,7 +1159,10 @@ path_converter(PyObject *o, void *p)
|
||||||
|
|
||||||
if (is_unicode) {
|
if (is_unicode) {
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wide = PyUnicode_AsUnicodeAndSize(o, &length);
|
wide = PyUnicode_AsUnicodeAndSize(o, &length);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (!wide) {
|
if (!wide) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
@ -1250,7 +1253,10 @@ path_converter(PyObject *o, void *p)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wide = PyUnicode_AsUnicodeAndSize(wo, &length);
|
wide = PyUnicode_AsUnicodeAndSize(wo, &length);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (!wide) {
|
if (!wide) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
@ -13238,7 +13244,10 @@ DirEntry_fetch_stat(PyObject *module, DirEntry *self, int follow_symlinks)
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
if (!PyUnicode_FSDecoder(self->path, &ub))
|
if (!PyUnicode_FSDecoder(self->path, &ub))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
const wchar_t *path = PyUnicode_AsUnicode(ub);
|
const wchar_t *path = PyUnicode_AsUnicode(ub);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
#else /* POSIX */
|
#else /* POSIX */
|
||||||
if (!PyUnicode_FSConverter(self->path, &ub))
|
if (!PyUnicode_FSConverter(self->path, &ub))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -13460,7 +13469,10 @@ os_DirEntry_inode_impl(DirEntry *self)
|
||||||
|
|
||||||
if (!PyUnicode_FSDecoder(self->path, &unicode))
|
if (!PyUnicode_FSDecoder(self->path, &unicode))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
path = PyUnicode_AsUnicode(unicode);
|
path = PyUnicode_AsUnicode(unicode);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
result = LSTAT(path, &stat);
|
result = LSTAT(path, &stat);
|
||||||
Py_DECREF(unicode);
|
Py_DECREF(unicode);
|
||||||
|
|
||||||
|
|
|
@ -4321,7 +4321,10 @@ unicode_decode_call_errorhandler_wchar(
|
||||||
goto onError;
|
goto onError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
repwstr = PyUnicode_AsUnicodeAndSize(repunicode, &repwlen);
|
repwstr = PyUnicode_AsUnicodeAndSize(repunicode, &repwlen);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (repwstr == NULL)
|
if (repwstr == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
/* need more space? (at least enough for what we
|
/* need more space? (at least enough for what we
|
||||||
|
@ -7654,7 +7657,10 @@ encode_code_page_strict(UINT code_page, PyObject **outbytes,
|
||||||
substring = PyUnicode_Substring(unicode, offset, offset+len);
|
substring = PyUnicode_Substring(unicode, offset, offset+len);
|
||||||
if (substring == NULL)
|
if (substring == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
p = PyUnicode_AsUnicodeAndSize(substring, &size);
|
p = PyUnicode_AsUnicodeAndSize(substring, &size);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
Py_DECREF(substring);
|
Py_DECREF(substring);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -625,7 +625,10 @@ summary_setproperty(msiobj* si, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (PyUnicode_Check(data)) {
|
if (PyUnicode_Check(data)) {
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
const WCHAR *value = _PyUnicode_AsUnicode(data);
|
const WCHAR *value = _PyUnicode_AsUnicode(data);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
|
||||||
t = PyList_GET_ITEM(value, j);
|
t = PyList_GET_ITEM(value, j);
|
||||||
if (!PyUnicode_Check(t))
|
if (!PyUnicode_Check(t))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wstr = PyUnicode_AsUnicodeAndSize(t, &len);
|
wstr = PyUnicode_AsUnicodeAndSize(t, &len);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (wstr == NULL)
|
if (wstr == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
size += Py_SAFE_DOWNCAST((len + 1) * sizeof(wchar_t),
|
size += Py_SAFE_DOWNCAST((len + 1) * sizeof(wchar_t),
|
||||||
|
@ -669,7 +672,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
|
||||||
Py_ssize_t len;
|
Py_ssize_t len;
|
||||||
|
|
||||||
t = PyList_GET_ITEM(value, j);
|
t = PyList_GET_ITEM(value, j);
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wstr = PyUnicode_AsUnicodeAndSize(t, &len);
|
wstr = PyUnicode_AsUnicodeAndSize(t, &len);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
assert(wstr);
|
assert(wstr);
|
||||||
wcscpy(P, wstr);
|
wcscpy(P, wstr);
|
||||||
P += (len + 1);
|
P += (len + 1);
|
||||||
|
|
|
@ -170,7 +170,10 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
||||||
|
|
||||||
_Py_CheckPython3();
|
_Py_CheckPython3();
|
||||||
|
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wpathname = _PyUnicode_AsUnicode(pathname);
|
wpathname = _PyUnicode_AsUnicode(pathname);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (wpathname == NULL)
|
if (wpathname == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -1010,7 +1010,10 @@ _Py_stat(PyObject *path, struct stat *statbuf)
|
||||||
struct _stat wstatbuf;
|
struct _stat wstatbuf;
|
||||||
const wchar_t *wpath;
|
const wchar_t *wpath;
|
||||||
|
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wpath = _PyUnicode_AsUnicode(path);
|
wpath = _PyUnicode_AsUnicode(path);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (wpath == NULL)
|
if (wpath == NULL)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
|
@ -1455,7 +1458,10 @@ _Py_fopen_obj(PyObject *path, const char *mode)
|
||||||
Py_TYPE(path));
|
Py_TYPE(path));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
_Py_COMP_DIAG_PUSH
|
||||||
|
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||||
wpath = _PyUnicode_AsUnicode(path);
|
wpath = _PyUnicode_AsUnicode(path);
|
||||||
|
_Py_COMP_DIAG_POP
|
||||||
if (wpath == NULL)
|
if (wpath == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue