[Python-Dev] Compiling 2.7.2 on OS/2

Terry Reedy tjreedy at udel.edu
Fri Jan 6 00:55:58 CET 2012

On 1/5/2012 3:01 PM, Paul Smedley wrote:

>> File "./setup.py", line 1154, in detect_modules
>> for arg in sysconfig.get_config_var("__CONFIG_ARGS").split()]
>> AttributeError: 'NoneType' object has no attribute 'split'
>> make: *** [sharedmods] Error 1

> File "./setup.py", line 1368, in detect_modules
> if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
> TypeError: argument of type 'NoneType' is not iterable
> make: *** [sharedmods] Error 1
> Which again points to problems with
> sysconfig.get_config_var("CONFIG_ARGS"):

[The earlier call was with "__CONFIG_ARGS", for whatever difference that 
makes.] It appears to be returning None instead of [] (or a populated list).

In 3.2.2, at line 579 of sysconfig.py is
def get_config_var(name):
    return get_config_vars().get(name)

That defaults to None if name is not a key in the dict returned by 
get_config_vars(). My guess is that it always is and and the the value 
is always a list for tested win/*nix/mac systems. So either setup.py has 
the bug of assuming that there is always a list value for "CONFIG_ARGS" 
or sysconfig.py has the bug of not setting it for os2, perhaps because 
of a bug elsewhere.

At line 440 of sysconfig.py is
def get_config_var(*args):
     global _CONFIG_VARS
     if _CONFIG_VARS is None:
          _CONFIG_VARS = {}
          <code to populate _CONFIG_VARS, including>
          if os.name in ('nt', 'os2'):
     if args:
          vals = []
          for name in args:
          return vals
         return _CONFIG_VARS

At 456 is
def _init_non_posix(vars):
     """Initialize the module as appropriate for NT"""
     # set basic install directories

"CONFIG_ARGS" is not set explicitly for any system anywhere in the file, 
so I do not know how the call ever works.

Terry Jan Reedy

More information about the Python-Dev mailing list