python: Fix for comments starting or ending with double quotes. Fixes #1239
… #1239
Description
This fix handles both the cases where the comments might or end with a double quote ".
Related Issue
#1239
Motivation and Context
The code earlier was replacing only the ending double quote, but the starting double quote was left unhandled. Moreover, while handling ending double quote, there was no whitespace to separating it at the end.
Previous Behaviour / Output
Same as above 👆
New Behaviour / Output
If the line starts or end with double quote, both the cases are prepended and appended with whitespace accordingly.
I think, with these changes, it should fix potential issues, when the comment starts with a double-quote too (actually, the problem with the previous implementation would have been, when comment would itself start with three double-quotes).
The escaping of all double-quotes in the comment-string should also take care of cases, when the comment contains three (or more) consecutive double-quotes which would be problematic in python.
so I would say, this should fix any potential issues for invalid comments in python due to double-quotes
(I tested these changes with the input that previously raised the issues with invalid python code for me, and the new output was in fact valid now)
@russaa thank you for your feedback! Can you please guide me on how do to get approval from a maintainer in order to complete the above workflow?
sorry, I don't have any additional insight on how to best contribute to this project