summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-02-11 15:19:12 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-02-11 15:19:12 (GMT)
commite18e787e70fecb39789140489a33bbc3eaba36da (patch)
treef415a6c780236cbd12407873ff5916c1698a2013
parent40be9e5100b652f93d6dcc2724615c8e57530e47 (diff)
parent932bba33f2d9131b7e9bb1e9b45529d0b4550657 (diff)
downloadcpython-e18e787e70fecb39789140489a33bbc3eaba36da.zip
cpython-e18e787e70fecb39789140489a33bbc3eaba36da.tar.gz
cpython-e18e787e70fecb39789140489a33bbc3eaba36da.tar.bz2
merge 3.3 (#20594)
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/posixmodule.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index e36e4b8..06001da 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@ Core and Builtins
Library
-------
+- Issue #20594: Avoid name clash with the libc function posix_close.
+
- Issue #19856: shutil.move() failed to move a directory to other directory
on Windows if source name ends with os.altsep.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 71abc98..6cbc78f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7763,8 +7763,12 @@ PyDoc_STRVAR(posix_close__doc__,
"close(fd)\n\n\
Close a file descriptor (for low level IO).");
+/*
+The underscore at end of function name avoids a name clash with the libc
+function posix_close.
+*/
static PyObject *
-posix_close(PyObject *self, PyObject *args)
+posix_close_(PyObject *self, PyObject *args)
{
int fd, res;
if (!PyArg_ParseTuple(args, "i:close", &fd))
@@ -11422,7 +11426,7 @@ static PyMethodDef posix_methods[] = {
{"open", (PyCFunction)posix_open,\
METH_VARARGS | METH_KEYWORDS,
posix_open__doc__},
- {"close", posix_close, METH_VARARGS, posix_close__doc__},
+ {"close", posix_close_, METH_VARARGS, posix_close__doc__},
{"closerange", posix_closerange, METH_VARARGS, posix_closerange__doc__},
{"device_encoding", device_encoding, METH_VARARGS, device_encoding__doc__},
{"dup", posix_dup, METH_VARARGS, posix_dup__doc__},