Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c8d2fb41
Kaydet (Commit)
c8d2fb41
authored
Ock 28, 2016
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5: Issue #26227
üst
68df6869
7240030c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
NEWS
Misc/NEWS
+4
-0
socketmodule.c
Modules/socketmodule.c
+24
-2
No files found.
Misc/NEWS
Dosyayı görüntüle @
c8d2fb41
...
...
@@ -159,6 +159,10 @@ Core and Builtins
Library
-------
- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and
gethostbyname_ex() functions of the socket module now decode the hostname
from the ANSI code page rather than UTF-8.
- Issue #26099: The site module now writes an error into stderr if
sitecustomize module can be imported but executing the module raise an
ImportError. Same change for usercustomize.
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
c8d2fb41
...
...
@@ -4519,6 +4519,19 @@ PyDoc_STRVAR(gethostbyname_doc,
Return the IP address (a string of the form '255.255.255.255') for a host."
);
static
PyObject
*
sock_decode_hostname
(
const
char
*
name
)
{
#ifdef MS_WINDOWS
/* Issue #26227: gethostbyaddr() returns a string encoded
* to the ANSI code page */
return
PyUnicode_DecodeFSDefault
(
name
);
#else
/* Decode from UTF-8 */
return
PyUnicode_FromString
(
name
);
#endif
}
/* Convenience function common to gethostbyname_ex and gethostbyaddr */
static
PyObject
*
...
...
@@ -4529,6 +4542,7 @@ gethost_common(struct hostent *h, struct sockaddr *addr, size_t alen, int af)
PyObject
*
name_list
=
(
PyObject
*
)
NULL
;
PyObject
*
addr_list
=
(
PyObject
*
)
NULL
;
PyObject
*
tmp
;
PyObject
*
name
;
if
(
h
==
NULL
)
{
/* Let's get real error message to return */
...
...
@@ -4637,7 +4651,10 @@ gethost_common(struct hostent *h, struct sockaddr *addr, size_t alen, int af)
goto
err
;
}
rtn_tuple
=
Py_BuildValue
(
"sOO"
,
h
->
h_name
,
name_list
,
addr_list
);
name
=
sock_decode_hostname
(
h
->
h_name
);
if
(
name
==
NULL
)
goto
err
;
rtn_tuple
=
Py_BuildValue
(
"NOO"
,
name
,
name_list
,
addr_list
);
err:
Py_XDECREF
(
name_list
);
...
...
@@ -5619,6 +5636,7 @@ socket_getnameinfo(PyObject *self, PyObject *args)
struct
addrinfo
hints
,
*
res
=
NULL
;
int
error
;
PyObject
*
ret
=
(
PyObject
*
)
NULL
;
PyObject
*
name
;
flags
=
flowinfo
=
scope_id
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"Oi:getnameinfo"
,
&
sa
,
&
flags
))
...
...
@@ -5682,7 +5700,11 @@ socket_getnameinfo(PyObject *self, PyObject *args)
set_gaierror
(
error
);
goto
fail
;
}
ret
=
Py_BuildValue
(
"ss"
,
hbuf
,
pbuf
);
name
=
sock_decode_hostname
(
hbuf
);
if
(
name
==
NULL
)
goto
fail
;
ret
=
Py_BuildValue
(
"Ns"
,
name
,
pbuf
);
fail:
if
(
res
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment