Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e18e787

Browse files
committed
merge 3.3 (#20594)
2 parents 40be9e5 + 932bba3 commit e18e787

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Core and Builtins
1515
Library
1616
-------
1717

18+
- Issue #20594: Avoid name clash with the libc function posix_close.
19+
1820
- Issue #19856: shutil.move() failed to move a directory to other directory
1921
on Windows if source name ends with os.altsep.
2022

Modules/posixmodule.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7763,8 +7763,12 @@ PyDoc_STRVAR(posix_close__doc__,
77637763
"close(fd)\n\n\
77647764
Close a file descriptor (for low level IO).");
77657765

7766+
/*
7767+
The underscore at end of function name avoids a name clash with the libc
7768+
function posix_close.
7769+
*/
77667770
static PyObject *
7767-
posix_close(PyObject *self, PyObject *args)
7771+
posix_close_(PyObject *self, PyObject *args)
77687772
{
77697773
int fd, res;
77707774
if (!PyArg_ParseTuple(args, "i:close", &fd))
@@ -11422,7 +11426,7 @@ static PyMethodDef posix_methods[] = {
1142211426
{"open", (PyCFunction)posix_open,\
1142311427
METH_VARARGS | METH_KEYWORDS,
1142411428
posix_open__doc__},
11425-
{"close", posix_close, METH_VARARGS, posix_close__doc__},
11429+
{"close", posix_close_, METH_VARARGS, posix_close__doc__},
1142611430
{"closerange", posix_closerange, METH_VARARGS, posix_closerange__doc__},
1142711431
{"device_encoding", device_encoding, METH_VARARGS, device_encoding__doc__},
1142811432
{"dup", posix_dup, METH_VARARGS, posix_dup__doc__},

0 commit comments

Comments
 (0)