-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Support context management protocol in bkfile #67015
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
Comments
Proposed patch makes bkfile (file-like class used in freeze) support the context management protocol. This makes bkfile more file-like and makes the use of it simpler and more robust. |
This looks correct and it improves readability. One nit, please put the doubled with on a single line instead of using the awkward line break (which looks weird with respect to the indentation of the with-block): + with open(config_c_in) as infp, bkfile.open(config_c, 'w') as outfp: |
Thank you Raymond. I found my old patch written 5 months ago. It drastically simplifies bkfile by using monkey-patching. What approach looks better to you? |
The second patch raises "RuntimeError: maximum recursion depth exceeded" if the target file is exist.
|
Good catch Berker. Updated patch fixes recursion issue. |
New changeset ea8c3166d1c2 by Serhiy Storchaka in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: