summaryrefslogtreecommitdiffstats
path: root/Modules/overlapped.c
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2022-05-12 05:48:38 (GMT)
committerGitHub <noreply@github.com>2022-05-12 05:48:38 (GMT)
commitf9c9354a7a173eaca2aa19e667b5cf12167b7fed (patch)
treeeb0fdd3219f53c973f1a7dbbcb9f8b0e0babdf36 /Modules/overlapped.c
parent68fec31364e96d122aae0571c14683b4ddb0ebd0 (diff)
downloadcpython-f9c9354a7a173eaca2aa19e667b5cf12167b7fed.zip
cpython-f9c9354a7a173eaca2aa19e667b5cf12167b7fed.tar.gz
cpython-f9c9354a7a173eaca2aa19e667b5cf12167b7fed.tar.bz2
gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537)
Diffstat (limited to 'Modules/overlapped.c')
-rw-r--r--Modules/overlapped.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index 74fba83..e40a524 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -1346,7 +1346,7 @@ static int
parse_address(PyObject *obj, SOCKADDR *Address, int Length)
{
PyObject *Host_obj;
- Py_UNICODE *Host;
+ wchar_t *Host;
unsigned short Port;
unsigned long FlowInfo;
unsigned long ScopeId;
@@ -1358,11 +1358,7 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
if (!PyArg_ParseTuple(obj, "UH", &Host_obj, &Port)) {
return -1;
}
-#if USE_UNICODE_WCHAR_CACHE
- Host = (wchar_t *)_PyUnicode_AsUnicode(Host_obj);
-#else /* USE_UNICODE_WCHAR_CACHE */
Host = PyUnicode_AsWideCharString(Host_obj, NULL);
-#endif /* USE_UNICODE_WCHAR_CACHE */
if (Host == NULL) {
return -1;
}
@@ -1374,9 +1370,7 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
else {
((SOCKADDR_IN*)Address)->sin_port = htons(Port);
}
-#if !USE_UNICODE_WCHAR_CACHE
PyMem_Free(Host);
-#endif /* USE_UNICODE_WCHAR_CACHE */
return Length;
}
case 4: {
@@ -1386,11 +1380,7 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
{
return -1;
}
-#if USE_UNICODE_WCHAR_CACHE
- Host = (wchar_t *)_PyUnicode_AsUnicode(Host_obj);
-#else /* USE_UNICODE_WCHAR_CACHE */
Host = PyUnicode_AsWideCharString(Host_obj, NULL);
-#endif /* USE_UNICODE_WCHAR_CACHE */
if (Host == NULL) {
return -1;
}
@@ -1404,9 +1394,7 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
((SOCKADDR_IN6*)Address)->sin6_flowinfo = FlowInfo;
((SOCKADDR_IN6*)Address)->sin6_scope_id = ScopeId;
}
-#if !USE_UNICODE_WCHAR_CACHE
PyMem_Free(Host);
-#endif /* USE_UNICODE_WCHAR_CACHE */
return Length;
}
default: