mirror of
https://github.com/python/cpython.git
synced 2025-08-16 14:50:43 +00:00
Merged revisions 74943 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74943 | georg.brandl | 2009-09-19 09:35:07 +0200 (Sa, 19 Sep 2009) | 1 line #6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple. ........
This commit is contained in:
parent
52197062b0
commit
3ad2847c01
3 changed files with 12 additions and 6 deletions
|
@ -281,7 +281,7 @@ class GeneralModuleTests(unittest.TestCase):
|
||||||
# On some versions, this loses a reference
|
# On some versions, this loses a reference
|
||||||
orig = sys.getrefcount(__name__)
|
orig = sys.getrefcount(__name__)
|
||||||
socket.getnameinfo(__name__,0)
|
socket.getnameinfo(__name__,0)
|
||||||
except SystemError:
|
except TypeError:
|
||||||
if sys.getrefcount(__name__) <> orig:
|
if sys.getrefcount(__name__) <> orig:
|
||||||
self.fail("socket.getnameinfo loses a reference")
|
self.fail("socket.getnameinfo loses a reference")
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,9 @@ Library
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #6944: Fix a SystemError when socket.getnameinfo() was called
|
||||||
|
with something other than a tuple as first argument.
|
||||||
|
|
||||||
- Issue #6848: Fix curses module build failure on OS X 10.6.
|
- Issue #6848: Fix curses module build failure on OS X 10.6.
|
||||||
|
|
||||||
- Fix expat to not segfault with specially crafted input.
|
- Fix expat to not segfault with specially crafted input.
|
||||||
|
|
|
@ -4060,6 +4060,11 @@ socket_getnameinfo(PyObject *self, PyObject *args)
|
||||||
flags = flowinfo = scope_id = 0;
|
flags = flowinfo = scope_id = 0;
|
||||||
if (!PyArg_ParseTuple(args, "Oi:getnameinfo", &sa, &flags))
|
if (!PyArg_ParseTuple(args, "Oi:getnameinfo", &sa, &flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (!PyTuple_Check(sa)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
"getnameinfo() argument 1 must be a tuple");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (!PyArg_ParseTuple(sa, "si|ii",
|
if (!PyArg_ParseTuple(sa, "si|ii",
|
||||||
&hostp, &port, &flowinfo, &scope_id))
|
&hostp, &port, &flowinfo, &scope_id))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4084,9 +4089,7 @@ socket_getnameinfo(PyObject *self, PyObject *args)
|
||||||
switch (res->ai_family) {
|
switch (res->ai_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
{
|
{
|
||||||
char *t1;
|
if (PyTuple_GET_SIZE(sa) != 2) {
|
||||||
int t2;
|
|
||||||
if (PyArg_ParseTuple(sa, "si", &t1, &t2) == 0) {
|
|
||||||
PyErr_SetString(socket_error,
|
PyErr_SetString(socket_error,
|
||||||
"IPv4 sockaddr must be 2 tuple");
|
"IPv4 sockaddr must be 2 tuple");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue