Commit 2748c5c1 authored by Benjamin Peterson's avatar Benjamin Peterson

avoid name clash with posix_close (closes #20594)

parent 79ce12e0
...@@ -44,6 +44,8 @@ Core and Builtins ...@@ -44,6 +44,8 @@ Core and Builtins
Library Library
------- -------
- Issue #20594: Avoid name clash with the libc function posix_close.
- Issue #19856: shutil.move() failed to move a directory to other directory - Issue #19856: shutil.move() failed to move a directory to other directory
on Windows if source name ends with os.altsep. on Windows if source name ends with os.altsep.
......
...@@ -6581,8 +6581,12 @@ PyDoc_STRVAR(posix_close__doc__, ...@@ -6581,8 +6581,12 @@ PyDoc_STRVAR(posix_close__doc__,
"close(fd)\n\n\ "close(fd)\n\n\
Close a file descriptor (for low level IO)."); 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 * static PyObject *
posix_close(PyObject *self, PyObject *args) posix_close_(PyObject *self, PyObject *args)
{ {
int fd, res; int fd, res;
if (!PyArg_ParseTuple(args, "i:close", &fd)) if (!PyArg_ParseTuple(args, "i:close", &fd))
...@@ -8960,7 +8964,7 @@ static PyMethodDef posix_methods[] = { ...@@ -8960,7 +8964,7 @@ static PyMethodDef posix_methods[] = {
{"tcsetpgrp", posix_tcsetpgrp, METH_VARARGS, posix_tcsetpgrp__doc__}, {"tcsetpgrp", posix_tcsetpgrp, METH_VARARGS, posix_tcsetpgrp__doc__},
#endif /* HAVE_TCSETPGRP */ #endif /* HAVE_TCSETPGRP */
{"open", posix_open, METH_VARARGS, posix_open__doc__}, {"open", posix_open, METH_VARARGS, 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__}, {"closerange", posix_closerange, METH_VARARGS, posix_closerange__doc__},
{"dup", posix_dup, METH_VARARGS, posix_dup__doc__}, {"dup", posix_dup, METH_VARARGS, posix_dup__doc__},
{"dup2", posix_dup2, METH_VARARGS, posix_dup2__doc__}, {"dup2", posix_dup2, METH_VARARGS, posix_dup2__doc__},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment