This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [PATCH] fail to compile posixmodule due to name clash with posix_close
Type: compile error Stage: resolved
Components: Build Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: benjamin.peterson, georg.brandl, larry, ncopa, pitrou, python-dev, vstinner
Priority: release blocker Keywords: patch

Created on 2014-02-11 12:20 by ncopa, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
posix_close.patch ncopa, 2014-02-11 13:26 review
Messages (6)
msg210930 - (view) Author: Natanael Copa (ncopa) * Date: 2014-02-11 12:20
This happens when building with musl libc:

./Modules/posixmodule.c:7849:1: error: conflicting types for 'posix_close'
 posix_close(PyObject *self, PyObject *args)
 ^
In file included from Include/Python.h:36:0,
                 from ./Modules/posixmodule.c:28:
/usr/include/unistd.h:38:5: note: previous declaration of 'posix_close' was here
 int posix_close(int, int);
     ^
Makefile:1511: recipe for target 'Modules/posixmodule.o' failed
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....


Apparently 'posix_close' has made it to the POSIX standard so that name should be avoided in python's posix module.c.
https://sourceware.org/ml/glibc-bugs/2013-12/msg00099.html

Fix is trivial:
--- ./Modules/posixmodule.c.orig
+++ ./Modules/posixmodule.c
@@ -7846,7 +7846,7 @@
 Close a file descriptor (for low level IO).");
 
 static PyObject *
-posix_close(PyObject *self, PyObject *args)
+posix_closex(PyObject *self, PyObject *args)
 {
     int fd, res;
     if (!PyArg_ParseTuple(args, "i:close", &fd))
@@ -11262,7 +11262,7 @@
     {"open",            (PyCFunction)posix_open,\
                         METH_VARARGS | METH_KEYWORDS,
                         posix_open__doc__},
-    {"close",           posix_close, METH_VARARGS, posix_close__doc__},
+    {"close",           posix_closex, 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__},
msg210941 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-11 15:00
Thanks for the report! I think this should also make it into 3.4 final.
msg210942 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-02-11 15:02
Yes, this can go in.
msg210948 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-11 15:19
New changeset 1d253360d5a6 by Benjamin Peterson in branch '2.7':
avoid name clash with posix_close (closes #20594)
http://hg.python.org/cpython/rev/1d253360d5a6

New changeset 021dd3c65198 by Benjamin Peterson in branch '3.3':
avoid name clash with posix_close (closes #20594)
http://hg.python.org/cpython/rev/021dd3c65198

New changeset 400a8e4599d9 by Benjamin Peterson in branch 'default':
merge 3.3 (#20594)
http://hg.python.org/cpython/rev/400a8e4599d9
msg211440 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-02-17 21:24
I created a cherry-pick issue (#20665) to track that separately.
msg213812 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-17 06:30
New changeset fd49c1d2fd6c by Benjamin Peterson in branch '3.4':
merge 3.3 (#20594)
http://hg.python.org/cpython/rev/fd49c1d2fd6c
History
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64793
2014-03-17 06:30:54python-devsetmessages: + msg213812
2014-02-17 21:24:52larrysetstatus: open -> closed
resolution: fixed
messages: + msg211440
2014-02-17 16:42:02benjamin.petersonsetassignee: larry
2014-02-17 16:41:53benjamin.petersonsetpriority: high -> release blocker
status: closed -> open

resolution: fixed -> (no value)
nosy: + benjamin.peterson, georg.brandl
2014-02-11 15:19:22python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg210948

resolution: fixed
stage: patch review -> resolved
2014-02-11 15:02:45larrysetmessages: + msg210942
2014-02-11 15:00:57pitrousetpriority: normal -> high
versions: + Python 3.4
nosy: + larry, pitrou

messages: + msg210941

stage: patch review
2014-02-11 13:26:07ncopasetfiles: + posix_close.patch
keywords: + patch
title: fail to compile posixmodule due to name clash with posix_close -> [PATCH] fail to compile posixmodule due to name clash with posix_close
2014-02-11 12:22:20vstinnersetnosy: + vstinner
2014-02-11 12:20:08ncopacreate