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.

Title: Error message displayed on stderr when no C compiler is present with ctypes
Type: Stage: resolved
Components: ctypes Versions: Python 2.7
Status: closed Resolution: out of date
Dependencies: 22636 Superseder:
Assigned To: theller Nosy List: ehuss, martin.panter, meador.inge, theller
Priority: normal Keywords: patch

Created on 2009-06-24 21:08 by ehuss, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
ctypes_util.patch ehuss, 2009-06-24 21:08 Patch to squelch error review
Messages (4)
msg89681 - (view) Author: Eric Huss (ehuss) Date: 2009-06-24 21:08
Importing the "uuid" module on a posix system (FreeBSD in my case) that
does not have a C compiler causes "cc: not found" to be sent to stderr.
 This is because it imports ctypes and calls ctypes.util.find_library
which attempts to determine if the C compiler is called "gcc" or "cc"
using a shell command.
msg112299 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-01 09:34
The patch simply sends the error message to os.devnull.  I can't test it as posix, but can it be committed as is?
msg264142 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-04-25 01:46
It would be good to close the file when it’s no longer needed. Also, if this bug is relevant to Python 3, I would use open() rather than file().
msg265245 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-05-10 13:05
I presume the problem is that Free BSD’s “type” command outputs the error to the shell’s original stderr, rather than the one given on the “type” command line. If so, the Python 3 patches for Issue 22636 should avoid it by using shutil.which() instead.

However that function does not exist in Python 2, so a different solution needs to be found. Probably an improved version of Eric’s patch would be good.
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50587
2021-05-28 19:16:31iritkatrielsetstatus: open -> closed
resolution: out of date
stage: needs patch -> resolved
2016-05-10 13:05:16martin.pantersetdependencies: + avoid using a shell in ctypes.util: replace os.popen with subprocess
messages: + msg265245
stage: patch review -> needs patch
versions: + Python 2.7, - Python 2.6
2016-05-09 23:06:17meador.ingesetnosy: + meador.inge
2016-04-25 01:46:39martin.pantersetnosy: + martin.panter

messages: + msg264142
stage: patch review
2014-02-03 19:51:21BreamoreBoysetnosy: - BreamoreBoy
2010-08-01 09:34:16BreamoreBoysetnosy: + BreamoreBoy
messages: + msg112299
2009-06-24 21:08:28ehusscreate