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: _sysconfigdata broken with universal builds on OSX
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2013-04-11 05:59 by ronaldoussoren, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg186547 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-04-11 05:59
The _sysconfig module contains the definitions for sysconfig.get_config_var and is created during python's build.

The definitions in for #define macros redefined in pymacconfig.h are wrong when building a universal build of Python (fat binaries) on OSX.

In particular the definitions for the various SIZEOF_ definitions are wrong and are the values for the default architecture of the build machine instead of reflecting the architecture for the code that is actually executing.
msg223133 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-15 18:10
Can our OSX gurus comment on this please.
msg223567 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2014-07-21 09:36
Sure... The issue is still present. To demonstrate the problem:

arch -i386 ./python.exe
Python 3.5.0a0 (default:9b450b19aa11+, Jul 21 2014, 10:03:38) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxsize
>>> import sysconfig
>>> sysconfig.get_config_var('SIZEOF_LONG')

This is on a machine that can run 64-bit code and uses a fat binary with i386 and x86_64 support. The script generating used the x86_64 code and hence created data that's only valid for the x86_64 binary.

It's easy enough to to create a patch that reproduces the preprocessor code in pymacconfig.h in, but I'm not sure if that is the right fix in particular due to the vagueness of the sysconfig API.  

A short rant:

IMHO the current API of sysconfig is underspecified and tied way to much the arbitrary details of the CPython build system (not the actual function keys, but the set of information that can be retrieved). There is no documentation at all on which keys are present and what there meaning is. As an example, there have been a number of issues in the past where users tried to use the value for key that's only meant to be used at CPython build time and users complained that the value didn't work for them with an installed CPython.
msg381548 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-11-21 11:27
This only affects universal builds where the CPU architectures are sufficiently different. In particular binaries with both 32-bit and 64-bit alternatives.

The current installers and the upcoming Universal2 installers only contain 64-bit code. That's likely to be the case going forward.

I'm closing this as "won't fix", this is a low priority issue that I'll never work on.
Date User Action Args
2022-04-11 14:57:44adminsetgithub: 61895
2020-11-21 11:27:27ronaldoussorensetstatus: open -> closed
resolution: wont fix
messages: + msg381548

stage: needs patch -> resolved
2019-04-26 20:06:14BreamoreBoysetnosy: - BreamoreBoy
2014-07-21 09:36:01ronaldoussorensetmessages: + msg223567
stage: needs patch
2014-07-15 18:10:47BreamoreBoysetnosy: + BreamoreBoy, ned.deily

messages: + msg223133
versions: + Python 3.5, - Python 3.3
2013-04-11 05:59:08ronaldoussorencreate