-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Fix Idea plugin unicode issues with Python 3 #7141
Fix Idea plugin unicode issues with Python 3 #7141
Conversation
It was being returned as bytes, so Mustache would generate a unicode file with `b''` in the prefix, which led to an error of `malformed input`.
@@ -160,7 +163,7 @@ def generate_project(self): | |||
def _generate_to_tempfile(self, generator): | |||
"""Applies the specified generator to a temp file and returns the path to that file. | |||
We generate into a temp file so that we don't lose any manual customizations on error.""" | |||
with temporary_file(cleanup=False) as output: | |||
with temporary_file(cleanup=False, binary_mode=False) as output: |
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.
It feels like we should probably add the deprecation of unspecified binary_mode
for temporary_file()
to #7120?
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 one is tricky. temporary_file
defaults to binary mode in the std lib, but indeed most of our use cases are unicode. We have to decide between consistency with our own (proposed) internal APIs vs. consistency with the standard library. I think I would advocate changing the default to unicode, but am not as convinced as I am with the functions we're changing in #7120.
Also now that I think back to it, I think temporary_file
is why across the board we chose to default to binary, even though it doesn't make sense in most contexts. I didn't yet know the codebase well, so just defaulted to how temporary_file
did things when considering the other functions.
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.
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.
That sounds reasonable to me. If you don't mind, I agree then that temporary_file
would be great to add to #7120!
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.
About to happen! #7120 (comment)
### Problem See #7150. The idea plugin gen integration test became flaky on py3 as of #7141. ### Solution Blacklist test on py3 as per [slack discussion](https://pantsbuild.slack.com/archives/CBNMV1LRH/p1548436157036300).
No description provided.