bpo-30806 netrc.__repr__() is broken for writing to file#2491
bpo-30806 netrc.__repr__() is broken for writing to file#2491methane merged 4 commits intopython:masterfrom
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Lib/netrc.py
Outdated
| for host in self.hosts.keys(): | ||
| attrs = self.hosts[host] | ||
| rep = rep + "machine "+ host + "\n\tlogin " + repr(attrs[0]) + "\n" | ||
| rep = rep + "machine "+ host + "\n\tlogin " + str(attrs[0]) + "\n" |
There was a problem hiding this comment.
rep += f"machine {host}\n\tlogin {attrs[0]}\n"
Lib/netrc.py
Outdated
| rep = rep + "account " + repr(attrs[1]) | ||
| rep = rep + "\tpassword " + repr(attrs[2]) + "\n" | ||
| rep = rep + "\taccount " + str(attrs[1]) + "\n" | ||
| rep = rep + "\tpassword " + str(attrs[2]) + "\n" |
There was a problem hiding this comment.
rep += f"\taccount {attrs[1]}\n"
rep += f"\tpassword {attrs[2]}\n"
|
@methane, I updated this to use f-strings. Is there anything else that needs to be done for this to be merged? |
|
Sorry for delay. |
|
See https://devguide.python.org/committing/#what-s-new-and-news-entries for how to create NEWS entry file. |
|
@methane This is done. Let me know if it looks good! |
|
Thanks. |
|
Will this fix be backported to python 2.7? The issue exists there as well. |
netrc file format doesn't support quotes and escapes. See https://linux.die.net/man/5/netrc (cherry picked from commit b24cd05)
|
GH-4244 is a backport of this pull request to the 3.6 branch. |
|
@sloria Will and will not. |
|
I needed this fix, so I released a library that addresses this issue (and also adds write functionality): https://github.com/sloria/tinynetrc . I can't make any promises, but if I get some time, I'll look into backporting to 2.7. |
netrc file format doesn't support quotes and escapes. See https://linux.die.net/man/5/netrc (cherry picked from commit b24cd05)
netrc file format doesn't support quotes and escapes. See https://linux.die.net/man/5/netrc
netrc file format doesn't support quotes and escapes. See https://linux.die.net/man/5/netrc
https://bugs.python.org/issue30806