-
Notifications
You must be signed in to change notification settings - Fork 804
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
Make chisel compatible with Python 3 #266
Conversation
Xcode 11 shipped with Python 3 now. Unfortunately, chisel was written in Python 2 style and will fail load for lldb. This PR fixed the Python 3 compatibility issues.
Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired. Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status. |
@@ -423,9 +423,9 @@ def isHeap(addr): | |||
|
|||
allocations = (addr for addr in pointers if isHeap(addr)) | |||
for addr in allocations: | |||
print >>self.result, '0x{addr:x} {path}'.format(addr=addr, path=pointers[addr]) |
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.
I need some advice on this.
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.
This might help.
https://stackoverflow.com/questions/34385674/what-does-print-do-in-python
I suspect this means we should write it as
print('0x{addr:x} {path}'.format(addr=addr, path=pointers[addr]), file=self.result)
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.
Yep
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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.
Thanks a bunch for fixing this up, really appreciate it! Will give Dave a chance to look, but looks good to me!
Do you want chisel to remain compatible with python 2 going forward? Or should there by a tagged or branch that people can checkout if the want Python 2 support? |
I believe the update itself is still compatible with Python 2 (I need to double check). Going forward, we will update our dev machines pretty aggressively to Xcode 11, thus, ongoing Python 2 support is not important to us. It is up to you guys to decide when you want to remove Python 2 support (considering macOS will stop shipping Python 2.7 in next major OS update and EOL is 2020). |
Yeah, I think based on the changes we made we're still (temporarily) Python 2 compatible. I'm okay with us becoming non-compatible though eventually, since both Apple and Facebook are moving pretty aggressively towards 3. |
I think the use of |
LMK if there is anything else you need to update. |
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.
Really sorry for the delay – thought I'd already approved. Looks great, just looks like there are some conflicts that've accrued! Thanks again for doing this!
Doesn't seem like any conflicts, not sure if any other changes required after this merged in though given the latest tip. How to initiate merge from here? |
Oh I see, it's because there were conflict resolutions across multiple commits – if I squash, which is what I wanted to do anyways, it's all good! |
Xcode 11 shipped with Python 3 now. Unfortunately, chisel was written in
Python 2 style and will fail load for lldb. This PR fixed the Python 3
compatibility issues.