From 008c426d4a560e63e9a5c56491de91c72417c68b Mon Sep 17 00:00:00 2001 From: doko Date: Tue, 14 Jun 2016 08:55:19 +0200 Subject: - Issue #23968: Rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from config-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORM_TRIPLET). Install the platform specifc _sysconfigdata module into the platform directory and rename it to include the ABIFLAGS. --- Python/sysmodule.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index b5199125a5..56175d9544 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1693,6 +1693,16 @@ make_impl_info(PyObject *version_info) if (res < 0) goto error; +#ifdef MULTIARCH + value = PyUnicode_FromString(MULTIARCH); + if (value == NULL) + goto error; + res = PyDict_SetItemString(impl_info, "_multiarch", value); + Py_DECREF(value); + if (res < 0) + goto error; +#endif + /* dict ready */ ns = _PyNamespace_New(impl_info); -- cgit v1.2.1 From f1390f308e25c22f553ef9c720842b2c537d831a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 20 Aug 2016 01:22:57 +0200 Subject: call_trampoline() now uses fast call Issue #27128. --- Python/sysmodule.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 56175d9544..74b8560ae8 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -368,34 +368,25 @@ static PyObject * call_trampoline(PyObject* callback, PyFrameObject *frame, int what, PyObject *arg) { - PyObject *args; - PyObject *whatstr; PyObject *result; + PyObject *stack[3]; - args = PyTuple_New(3); - if (args == NULL) - return NULL; - if (PyFrame_FastToLocalsWithError(frame) < 0) + if (PyFrame_FastToLocalsWithError(frame) < 0) { return NULL; + } - Py_INCREF(frame); - whatstr = whatstrings[what]; - Py_INCREF(whatstr); - if (arg == NULL) - arg = Py_None; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, (PyObject *)frame); - PyTuple_SET_ITEM(args, 1, whatstr); - PyTuple_SET_ITEM(args, 2, arg); + stack[0] = (PyObject *)frame; + stack[1] = whatstrings[what]; + stack[2] = (arg != NULL) ? arg : Py_None; /* call the Python-level function */ - result = PyEval_CallObject(callback, args); + result = _PyObject_FastCall(callback, stack, 3, NULL); + PyFrame_LocalsToFast(frame, 1); - if (result == NULL) + if (result == NULL) { PyTraceBack_Here(frame); + } - /* cleanup */ - Py_DECREF(args); return result; } -- cgit v1.2.1 From b0d6074700270d6c57fac1354c7b701210f2bbea Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 20 Aug 2016 01:24:22 +0200 Subject: sys_pyfile_write_unicode() now uses fast call Issue #27128. --- Python/sysmodule.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 74b8560ae8..be8e164bba 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2112,7 +2112,7 @@ PySys_SetArgv(int argc, wchar_t **argv) static int sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) { - PyObject *writer = NULL, *args = NULL, *result = NULL; + PyObject *writer = NULL, *result = NULL; int err; if (file == NULL) @@ -2122,11 +2122,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) if (writer == NULL) goto error; - args = PyTuple_Pack(1, unicode); - if (args == NULL) - goto error; - - result = PyEval_CallObject(writer, args); + result = _PyObject_FastCall(writer, &unicode, 1, NULL); if (result == NULL) { goto error; } else { @@ -2138,7 +2134,6 @@ error: err = -1; finally: Py_XDECREF(writer); - Py_XDECREF(args); Py_XDECREF(result); return err; } -- cgit v1.2.1 From de03c6d8066496680a1ea99ff9e67e28852b0007 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 22 Aug 2016 22:48:54 +0200 Subject: Rename _PyObject_FastCall() to _PyObject_FastCallDict() Issue #27809: * Rename _PyObject_FastCall() function to _PyObject_FastCallDict() * Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1() macros calling _PyObject_FastCallDict() --- Python/sysmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index be8e164bba..c170bd5889 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -380,7 +380,7 @@ call_trampoline(PyObject* callback, stack[2] = (arg != NULL) ? arg : Py_None; /* call the Python-level function */ - result = _PyObject_FastCall(callback, stack, 3, NULL); + result = _PyObject_FastCall(callback, stack, 3); PyFrame_LocalsToFast(frame, 1); if (result == NULL) { @@ -2122,7 +2122,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) if (writer == NULL) goto error; - result = _PyObject_FastCall(writer, &unicode, 1, NULL); + result = _PyObject_CallArg1(writer, unicode); if (result == NULL) { goto error; } else { -- cgit v1.2.1 From bb0ec1fc07628252f17d66a58a4a4b3654e571c3 Mon Sep 17 00:00:00 2001 From: Larry Hastings Date: Mon, 5 Sep 2016 15:11:23 -0700 Subject: Issue #27355: Removed support for Windows CE. It was never finished, and Windows CE is no longer a relevant platform for Python. --- Python/sysmodule.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index c170bd5889..a54f266030 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2000,7 +2000,7 @@ sys_update_path(int argc, wchar_t **argv) #endif #if defined(HAVE_REALPATH) wchar_t fullpath[MAXPATHLEN]; -#elif defined(MS_WINDOWS) && !defined(MS_WINCE) +#elif defined(MS_WINDOWS) wchar_t fullpath[MAX_PATH]; #endif @@ -2039,10 +2039,8 @@ sys_update_path(int argc, wchar_t **argv) #if SEP == '\\' /* Special case for MS filename syntax */ if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) { wchar_t *q; -#if defined(MS_WINDOWS) && !defined(MS_WINCE) - /* This code here replaces the first element in argv with the full - path that it represents. Under CE, there are no relative paths so - the argument must be the full path anyway. */ +#if defined(MS_WINDOWS) + /* Replace the first element in argv with the full path. */ wchar_t *ptemp; if (GetFullPathNameW(argv0, Py_ARRAY_LENGTH(fullpath), -- cgit v1.2.1 From 9c9a45c1f0a264d3006971b8211d948d6883a05b Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 8 Sep 2016 10:35:16 -0700 Subject: Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) --- Python/sysmodule.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index a54f266030..0fe76b7a74 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -310,6 +310,23 @@ Return the encoding used to convert Unicode filenames in\n\ operating system filenames." ); +static PyObject * +sys_getfilesystemencodeerrors(PyObject *self) +{ + if (Py_FileSystemDefaultEncodeErrors) + return PyUnicode_FromString(Py_FileSystemDefaultEncodeErrors); + PyErr_SetString(PyExc_RuntimeError, + "filesystem encoding is not initialized"); + return NULL; +} + +PyDoc_STRVAR(getfilesystemencodeerrors_doc, + "getfilesystemencodeerrors() -> string\n\ +\n\ +Return the error mode used to convert Unicode filenames in\n\ +operating system filenames." +); + static PyObject * sys_intern(PyObject *self, PyObject *args) { @@ -866,6 +883,24 @@ sys_getwindowsversion(PyObject *self) #pragma warning(pop) +PyDoc_STRVAR(enablelegacywindowsfsencoding_doc, +"_enablelegacywindowsfsencoding()\n\ +\n\ +Changes the default filesystem encoding to mbcs:replace for consistency\n\ +with earlier versions of Python. See PEP 529 for more information.\n\ +\n\ +This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING \n\ +environment variable before launching Python." +); + +static PyObject * +sys_enablelegacywindowsfsencoding(PyObject *self) +{ + Py_FileSystemDefaultEncoding = "mbcs"; + Py_FileSystemDefaultEncodeErrors = "replace"; + Py_RETURN_NONE; +} + #endif /* MS_WINDOWS */ #ifdef HAVE_DLOPEN @@ -1225,6 +1260,8 @@ static PyMethodDef sys_methods[] = { #endif {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, METH_NOARGS, getfilesystemencoding_doc}, + { "getfilesystemencodeerrors", (PyCFunction)sys_getfilesystemencodeerrors, + METH_NOARGS, getfilesystemencodeerrors_doc }, #ifdef Py_TRACE_REFS {"getobjects", _Py_GetObjects, METH_VARARGS}, #endif @@ -1240,6 +1277,8 @@ static PyMethodDef sys_methods[] = { #ifdef MS_WINDOWS {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, getwindowsversion_doc}, + {"_enablelegacywindowsfsencoding", (PyCFunction)sys_enablelegacywindowsfsencoding, + METH_NOARGS, enablelegacywindowsfsencoding_doc }, #endif /* MS_WINDOWS */ {"intern", sys_intern, METH_VARARGS, intern_doc}, {"is_finalizing", sys_is_finalizing, METH_NOARGS, is_finalizing_doc}, @@ -1456,14 +1495,21 @@ version -- the version of this interpreter as a string\n\ version_info -- version information as a named tuple\n\ " ) -#ifdef MS_WINDOWS +#ifdef MS_COREDLL /* concatenating string here */ PyDoc_STR( "dllhandle -- [Windows only] integer handle of the Python DLL\n\ winver -- [Windows only] version number of the Python DLL\n\ " ) -#endif /* MS_WINDOWS */ +#endif /* MS_COREDLL */ +#ifdef MS_WINDOWS +/* concatenating string here */ +PyDoc_STR( +"_enablelegacywindowsfsencoding -- [Windows only] \n\ +" +) +#endif PyDoc_STR( "__stdin__ -- the original stdin; don't touch!\n\ __stdout__ -- the original stdout; don't touch!\n\ -- cgit v1.2.1 From 17668cfa5e0e6f50376cc233d9b063b908a19845 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 8 Sep 2016 22:01:51 -0700 Subject: Issue #28003: Implement PEP 525 -- Asynchronous Generators. --- Python/sysmodule.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 0fe76b7a74..3a02ae9eaf 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -717,6 +717,113 @@ Return the wrapper for coroutine objects set by sys.set_coroutine_wrapper." ); +static PyTypeObject AsyncGenHooksType; + +PyDoc_STRVAR(asyncgen_hooks_doc, +"asyncgen_hooks\n\ +\n\ +A struct sequence providing information about asynhronous\n\ +generators hooks. The attributes are read only."); + +static PyStructSequence_Field asyncgen_hooks_fields[] = { + {"firstiter", "Hook to intercept first iteration"}, + {"finalizer", "Hook to intercept finalization"}, + {0} +}; + +static PyStructSequence_Desc asyncgen_hooks_desc = { + "asyncgen_hooks", /* name */ + asyncgen_hooks_doc, /* doc */ + asyncgen_hooks_fields , /* fields */ + 2 +}; + + +static PyObject * +sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw) +{ + static char *keywords[] = {"firstiter", "finalizer", NULL}; + PyObject *firstiter = NULL; + PyObject *finalizer = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kw, "|OO", keywords, + &firstiter, &finalizer)) { + return NULL; + } + + if (finalizer && finalizer != Py_None) { + if (!PyCallable_Check(finalizer)) { + PyErr_Format(PyExc_TypeError, + "callable finalizer expected, got %.50s", + Py_TYPE(finalizer)->tp_name); + return NULL; + } + _PyEval_SetAsyncGenFinalizer(finalizer); + } + else if (finalizer == Py_None) { + _PyEval_SetAsyncGenFinalizer(NULL); + } + + if (firstiter && firstiter != Py_None) { + if (!PyCallable_Check(firstiter)) { + PyErr_Format(PyExc_TypeError, + "callable firstiter expected, got %.50s", + Py_TYPE(firstiter)->tp_name); + return NULL; + } + _PyEval_SetAsyncGenFirstiter(firstiter); + } + else if (firstiter == Py_None) { + _PyEval_SetAsyncGenFirstiter(NULL); + } + + Py_RETURN_NONE; +} + +PyDoc_STRVAR(set_asyncgen_hooks_doc, +"set_asyncgen_hooks(*, firstiter=None, finalizer=None)\n\ +\n\ +Set a finalizer for async generators objects." +); + +static PyObject * +sys_get_asyncgen_hooks(PyObject *self, PyObject *args) +{ + PyObject *res; + PyObject *firstiter = _PyEval_GetAsyncGenFirstiter(); + PyObject *finalizer = _PyEval_GetAsyncGenFinalizer(); + + res = PyStructSequence_New(&AsyncGenHooksType); + if (res == NULL) { + return NULL; + } + + if (firstiter == NULL) { + firstiter = Py_None; + } + + if (finalizer == NULL) { + finalizer = Py_None; + } + + Py_INCREF(firstiter); + PyStructSequence_SET_ITEM(res, 0, firstiter); + + Py_INCREF(finalizer); + PyStructSequence_SET_ITEM(res, 1, finalizer); + + return res; +} + +PyDoc_STRVAR(get_asyncgen_hooks_doc, +"get_asyncgen_hooks()\n\ +\n\ +Return a namedtuple of installed asynchronous generators hooks \ +(firstiter, finalizer)." +); + + static PyTypeObject Hash_InfoType; PyDoc_STRVAR(hash_info_doc, @@ -1315,6 +1422,10 @@ static PyMethodDef sys_methods[] = { set_coroutine_wrapper_doc}, {"get_coroutine_wrapper", sys_get_coroutine_wrapper, METH_NOARGS, get_coroutine_wrapper_doc}, + {"set_asyncgen_hooks", sys_set_asyncgen_hooks, + METH_VARARGS | METH_KEYWORDS, set_asyncgen_hooks_doc}, + {"get_asyncgen_hooks", sys_get_asyncgen_hooks, METH_NOARGS, + get_asyncgen_hooks_doc}, {NULL, NULL} /* sentinel */ }; @@ -1950,6 +2061,14 @@ _PySys_Init(void) SET_SYS_FROM_STRING("thread_info", PyThread_GetInfo()); #endif + /* initialize asyncgen_hooks */ + if (AsyncGenHooksType.tp_name == NULL) { + if (PyStructSequence_InitType2( + &AsyncGenHooksType, &asyncgen_hooks_desc) < 0) { + return NULL; + } + } + #undef SET_SYS_FROM_STRING #undef SET_SYS_FROM_STRING_BORROW if (PyErr_Occurred()) -- cgit v1.2.1 From d6f6b39aecf494e88eba6b33c82a66cf150fb9f2 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 9 Sep 2016 00:05:42 -0700 Subject: Issue #28003: Fix a compiler warning --- Python/sysmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 3a02ae9eaf..44191fcb47 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1422,7 +1422,7 @@ static PyMethodDef sys_methods[] = { set_coroutine_wrapper_doc}, {"get_coroutine_wrapper", sys_get_coroutine_wrapper, METH_NOARGS, get_coroutine_wrapper_doc}, - {"set_asyncgen_hooks", sys_set_asyncgen_hooks, + {"set_asyncgen_hooks", (PyCFunction)sys_set_asyncgen_hooks, METH_VARARGS | METH_KEYWORDS, set_asyncgen_hooks_doc}, {"get_asyncgen_hooks", sys_get_asyncgen_hooks, METH_NOARGS, get_asyncgen_hooks_doc}, -- cgit v1.2.1 From 831deb2ea3f31f273438acc797ae12d183a21422 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 9 Sep 2016 14:57:58 -0700 Subject: remove ceval timestamp support --- Python/sysmodule.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 44191fcb47..b7afe93ca5 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -609,33 +609,6 @@ PyDoc_STRVAR(getswitchinterval_doc, #endif /* WITH_THREAD */ -#ifdef WITH_TSC -static PyObject * -sys_settscdump(PyObject *self, PyObject *args) -{ - int bool; - PyThreadState *tstate = PyThreadState_Get(); - - if (!PyArg_ParseTuple(args, "i:settscdump", &bool)) - return NULL; - if (bool) - tstate->interp->tscdump = 1; - else - tstate->interp->tscdump = 0; - Py_INCREF(Py_None); - return Py_None; - -} - -PyDoc_STRVAR(settscdump_doc, -"settscdump(bool)\n\ -\n\ -If true, tell the Python interpreter to dump VM measurements to\n\ -stderr. If false, turn off dump. The measurements are based on the\n\ -processor's time-stamp counter." -); -#endif /* TSC */ - static PyObject * sys_setrecursionlimit(PyObject *self, PyObject *args) { @@ -1410,9 +1383,6 @@ static PyMethodDef sys_methods[] = { {"getprofile", sys_getprofile, METH_NOARGS, getprofile_doc}, {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, setrecursionlimit_doc}, -#ifdef WITH_TSC - {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc}, -#endif {"settrace", sys_settrace, METH_O, settrace_doc}, {"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc}, {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, -- cgit v1.2.1 From acffd14de543f9752af1ee29c36739c14b05767c Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 17 Sep 2016 17:27:48 -0700 Subject: Issue #27932: Prevent memory leak in win32_ver(). --- Python/sysmodule.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index b7afe93ca5..5dd0d10834 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -894,10 +894,11 @@ Return information about the running version of Windows as a named tuple.\n\ The members are named: major, minor, build, platform, service_pack,\n\ service_pack_major, service_pack_minor, suite_mask, and product_type. For\n\ backward compatibility, only the first 5 items are available by indexing.\n\ -All elements are numbers, except service_pack which is a string. Platform\n\ -may be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n\ -3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\n\ -controller, 3 for a server." +All elements are numbers, except service_pack and platform_type which are\n\ +strings, and platform_version which is a 3-tuple. Platform is always 2.\n\ +Product_type may be 1 for a workstation, 2 for a domain controller, 3 for a\n\ +server. Platform_version is a 3-tuple containing a version number that is\n\ +intended for identifying the OS rather than feature detection." ); static PyTypeObject WindowsVersionType = {0, 0, 0, 0, 0, 0}; @@ -912,6 +913,7 @@ static PyStructSequence_Field windows_version_fields[] = { {"service_pack_minor", "Service Pack minor version number"}, {"suite_mask", "Bit mask identifying available product suites"}, {"product_type", "System product type"}, + {"platform_version", "Diagnostic version number"}, {0} }; @@ -936,6 +938,12 @@ sys_getwindowsversion(PyObject *self) PyObject *version; int pos = 0; OSVERSIONINFOEX ver; + DWORD realMajor, realMinor, realBuild; + HANDLE hKernel32; + wchar_t kernel32_path[MAX_PATH]; + LPVOID verblock; + DWORD verblock_size; + ver.dwOSVersionInfoSize = sizeof(ver); if (!GetVersionEx((OSVERSIONINFO*) &ver)) return PyErr_SetFromWindowsErr(0); @@ -954,10 +962,40 @@ sys_getwindowsversion(PyObject *self) PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wSuiteMask)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wProductType)); + realMajor = ver.dwMajorVersion; + realMinor = ver.dwMinorVersion; + realBuild = ver.dwBuildNumber; + + // GetVersion will lie if we are running in a compatibility mode. + // We need to read the version info from a system file resource + // to accurately identify the OS version. If we fail for any reason, + // just return whatever GetVersion said. + hKernel32 = GetModuleHandleW(L"kernel32.dll"); + if (hKernel32 && GetModuleFileNameW(hKernel32, kernel32_path, MAX_PATH) && + (verblock_size = GetFileVersionInfoSizeW(kernel32_path, NULL)) && + (verblock = PyMem_RawMalloc(verblock_size))) { + VS_FIXEDFILEINFO *ffi; + UINT ffi_len; + + if (GetFileVersionInfoW(kernel32_path, 0, verblock_size, verblock) && + VerQueryValueW(verblock, L"", (LPVOID)&ffi, &ffi_len)) { + realMajor = HIWORD(ffi->dwProductVersionMS); + realMinor = LOWORD(ffi->dwProductVersionMS); + realBuild = HIWORD(ffi->dwProductVersionLS); + } + PyMem_RawFree(verblock); + } + PyStructSequence_SET_ITEM(version, pos++, PyTuple_Pack(3, + PyLong_FromLong(realMajor), + PyLong_FromLong(realMinor), + PyLong_FromLong(realBuild) + )); + if (PyErr_Occurred()) { Py_DECREF(version); return NULL; } + return version; } -- cgit v1.2.1 From 57c0f2e61c8a5893c37e576a3a03ba5e57c1132c Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 20 Nov 2016 09:13:07 +0200 Subject: Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize. --- Python/sysmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e348b3873e..52034ff7fb 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -114,7 +114,7 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o) stdout_encoding = _PyObject_GetAttrId(outf, &PyId_encoding); if (stdout_encoding == NULL) goto error; - stdout_encoding_str = _PyUnicode_AsString(stdout_encoding); + stdout_encoding_str = PyUnicode_AsUTF8(stdout_encoding); if (stdout_encoding_str == NULL) goto error; @@ -2411,7 +2411,7 @@ sys_format(_Py_Identifier *key, FILE *fp, const char *format, va_list va) if (message != NULL) { if (sys_pyfile_write_unicode(message, file) != 0) { PyErr_Clear(); - utf8 = _PyUnicode_AsString(message); + utf8 = PyUnicode_AsUTF8(message); if (utf8 != NULL) fputs(utf8, fp); } -- cgit v1.2.1