]> granicus.if.org Git - python/commitdiff
avoid name clash with posix_close (closes #20594)
authorBenjamin Peterson <benjamin@python.org>
Tue, 11 Feb 2014 15:16:16 +0000 (10:16 -0500)
committerBenjamin Peterson <benjamin@python.org>
Tue, 11 Feb 2014 15:16:16 +0000 (10:16 -0500)
Misc/NEWS
Modules/posixmodule.c

index 647cedf34e41e8f933d02adfbc90eecf6a1a0543..bf0bc0c2a24005505e94f2d1de3286ec5095bdcc 100644 (file)
--- 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.
 
index e72fbcf11b4d4845cd195f302f526c8f0012dac8..767a6653c41aaaed7b1ed3e14dc3ab67d6095206 100644 (file)
@@ -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__},