mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529)
This commit is contained in:
parent
cfbd48bc56
commit
cc16be85c0
18 changed files with 618 additions and 836 deletions
|
|
@ -973,28 +973,28 @@ Overlapped_AcceptEx(OverlappedObject *self, PyObject *args)
|
|||
static int
|
||||
parse_address(PyObject *obj, SOCKADDR *Address, int Length)
|
||||
{
|
||||
char *Host;
|
||||
Py_UNICODE *Host;
|
||||
unsigned short Port;
|
||||
unsigned long FlowInfo;
|
||||
unsigned long ScopeId;
|
||||
|
||||
memset(Address, 0, Length);
|
||||
|
||||
if (PyArg_ParseTuple(obj, "sH", &Host, &Port))
|
||||
if (PyArg_ParseTuple(obj, "uH", &Host, &Port))
|
||||
{
|
||||
Address->sa_family = AF_INET;
|
||||
if (WSAStringToAddressA(Host, AF_INET, NULL, Address, &Length) < 0) {
|
||||
if (WSAStringToAddressW(Host, AF_INET, NULL, Address, &Length) < 0) {
|
||||
SetFromWindowsErr(WSAGetLastError());
|
||||
return -1;
|
||||
}
|
||||
((SOCKADDR_IN*)Address)->sin_port = htons(Port);
|
||||
return Length;
|
||||
}
|
||||
else if (PyArg_ParseTuple(obj, "sHkk", &Host, &Port, &FlowInfo, &ScopeId))
|
||||
else if (PyArg_ParseTuple(obj, "uHkk", &Host, &Port, &FlowInfo, &ScopeId))
|
||||
{
|
||||
PyErr_Clear();
|
||||
Address->sa_family = AF_INET6;
|
||||
if (WSAStringToAddressA(Host, AF_INET6, NULL, Address, &Length) < 0) {
|
||||
if (WSAStringToAddressW(Host, AF_INET6, NULL, Address, &Length) < 0) {
|
||||
SetFromWindowsErr(WSAGetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue