diff options
author | Zachary Tessler <ztessler@gmail.com> | 2018-12-22 22:02:03 (GMT) |
---|---|---|
committer | Zachary Tessler <ztessler@gmail.com> | 2018-12-22 22:59:48 (GMT) |
commit | f70796424d9ffd476396235932fc659818daa39f (patch) | |
tree | 7cea417ede515bf12b2658d833d4dffa473b6390 /src/engine | |
parent | 4daeb49e6ee69ffd8e3d1228da9df80a9c6954ce (diff) | |
download | SCons-f70796424d9ffd476396235932fc659818daa39f.zip SCons-f70796424d9ffd476396235932fc659818daa39f.tar.gz SCons-f70796424d9ffd476396235932fc659818daa39f.tar.bz2 |
fix missing code contents that should be included in signature of a function action
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Action.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/ActionTests.py | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 78fb7d0..bff6003 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -258,8 +258,7 @@ def _code_contents(code, docstring=None): # function. Note that we have to call _object_contents on each # constants because the code object of nested functions can # show-up among the constants. - - z = [_object_contents(cc) for cc in code.co_consts[1:]] + z = [_object_contents(cc) for cc in code.co_consts if cc != docstring] contents.extend(b',(') contents.extend(bytearray(',', 'utf-8').join(z)) contents.extend(b')') diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index b9cc00b..a27f598 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -2252,14 +2252,14 @@ class ObjectContentsTestCase(unittest.TestCase): # Since the python bytecode has per version differences, we need different expected results per version expected = { - (2, 7): bytearray(b'0, 0, 0, 0,(N.),(),(d\x00\x00GHd\x01\x00S)'), - (3, 5): bytearray(b'0, 0, 0, 0,(N.),(print),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)'), - (3, 6): bytearray(b'0, 0, 0, 0,(N.),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), - (3, 7): bytearray(b'0, 0, 0, 0,(N.),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), + (2, 7): bytearray(b'0, 0, 0, 0,(Hello, World!),(),(d\x00\x00GHd\x01\x00S)'), + (3, 5): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)'), + (3, 6): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), + (3, 7): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), } - assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + expected[ - sys.version_info[:2]] + assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr(expected[ + sys.version_info[:2]]) if __name__ == "__main__": |