[Scons-users] Subst should not stringify a callable if it didn't match the arguments

Mathew Robinson chasinglogic at gmail.com
Mon Mar 4 14:43:43 EST 2019


I was going to file a bug but then saw I should post this here first to
confirm.

In this branch:
https://github.com/SCons/scons/blob/master/src/engine/SCons/Subst.py#L712

during substitution if the callable throws a TypeError and the ListSubber
(or StringSubber it has the same logic) is not in SUBST_RAW mode it assumes
that it should convert it to a string. This causes hard to debug errors as
a user if my callable throws a TypeError.

As an example when MongoDB was going through our Python 3 upgrade we had a
variant dir generator for the subst '$BUILD_DIR' generate the following:

"build/<function default_variant_dir_generator at
0x103f17840>/mongo/base/error_codes.h"

If a TypeError occurs in a callable and mode != SUBST_RAW I would expect
scons to error and report this to me. If there is some use case where it
should continue then I would expect scons to inspect the TypeError to make
sure it's an argument failure (I could find no way to do this by reading
the python language docs other than error message string inspection).

Happy to file a bug if this is the recommended course.

-- 
-- Mathew Robinson (chasinglogic)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190304/905d7f52/attachment.html>


More information about the Scons-users mailing list