From 932bba33f2d9131b7e9bb1e9b45529d0b4550657 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 11 Feb 2014 10:16:16 -0500 Subject: [PATCH] avoid name clash with posix_close (closes #20594) --- Misc/NEWS | 2 ++ Modules/posixmodule.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 647cedf34e4..bf0bc0c2a24 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -20,6 +20,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 e72fbcf11b4..767a6653c41 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7844,8 +7844,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)) @@ -11261,7 +11265,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__},