[Scons-users] TryRun with CacheDir crashes on Python 3

Hector Martin 'marcan' marcan at marcan.st
Tue Jun 26 07:36:34 EDT 2018


Minimal reproducer:

=========================
CacheDir('objects')

env = Environment()

def CompilerCheck(context):
    context.Message("Checking for a working C compiler ")
    ret = context.TryRun("int a;\n", '.c' )[0]
    context.Result(ret)
    if ret == 0:
        return False

conf = Configure(Environment(),
                 custom_tests = {"CompilerCheck" : CompilerCheck})

conf.CompilerCheck()
=========================

Output:
scons: Reading SConscript files ...
Checking for a working C compiler TypeError : sequence item 0: expected
str instance, bytes found

I traced it down with a bunch of prints. The crash is in
Node.FS.File.get_cachedir_bsig. sigs ends up looking like this:

[b'int a;\n', '79ff7357d2d39b785bcdf4305604fa0c',
'.sconf_temp/conftest_0.c']

And Util.MD5collect cannot deal with the mixed bytes/str. Not sure what
the right fix is here; either everything has to be str or bytes, or
MD5collect needs to automatically convert when necessary.

SCons by Steven Knight et al.:
        script: v3.0.1.74b2c53bc42290e911b334a6b44f187da698a668,
2017/11/14 13:16:53, by bdbaddog on hpmicrodog
        engine: v3.0.1.74b2c53bc42290e911b334a6b44f187da698a668,
2017/11/14 13:16:53, by bdbaddog on hpmicrodog
        engine path: ['/usr/lib64/python3.5/site-packages/SCons']
Copyright (c) 2001 - 2017 The SCons Foundation

-- 
Hector Martin "marcan" (marcan at marcan.st)
Public Key: https://mrcn.st/pub


More information about the Scons-users mailing list