-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure get_contents() method of Node objects return 'bytes' and fix decoding errors in Value.get_csig() #3738
base: master
Are you sure you want to change the base?
Changes from 3 commits
d6ea1ba
479caf9
18194cf
4e79f07
5e65d14
8530029
428e225
9861322
bbb0fab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,12 +152,10 @@ def get_contents(self): | |
Get contents for signature calculations. | ||
:return: bytes | ||
""" | ||
text_contents = self.get_text_contents() | ||
try: | ||
return text_contents.encode() | ||
except UnicodeDecodeError: | ||
# Already encoded as python2 str are bytes | ||
return text_contents | ||
contents = str(self.value).encode('utf-8') | ||
for kid in self.children(None): | ||
contents = contents + kid.get_contents() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you change this to contents = contents + kid.get_csig()? Otherwise the memory usage of Value targets gets out of control. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made a few extra commits, first changing I'm not sure where the 'contents' of a
The first change passes existing tests (after they've been modified to expect bytes from I am running tests with Python 3.8.2 on Ubuntu 20.04 in a virtual environment. |
||
return contents | ||
|
||
def changed_since_last_build(self, target, prev_ni): | ||
cur_csig = self.get_csig() | ||
|
@@ -178,7 +176,7 @@ def get_csig(self, calc=None): | |
except AttributeError: | ||
pass | ||
|
||
contents = self.get_text_contents() | ||
contents = self.get_contents().decode(errors='backslashreplace') | ||
|
||
self.get_ninfo().csig = contents | ||
return contents | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
child
seems to be in use everywhere elseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer
child
as well but it looks likekid
is still used frequently in SCons/Node/*.