Message202394
| Author |
vstinner |
| Recipients |
Arfrever, christian.heimes, doko, elixir, eric.araujo, ezio.melotti, lemburg, vajrasky, vstinner |
| Date |
2013年11月07日.23:15:52 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1383866152.38.0.93184898006.issue17762@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Comments on add_os_release_support_2.patch:
- You should not write a huge try/except OSError block. I would prefer something like:
try:
f = open(...)
except OSError:
return None
with f:
...
- I'm not sure about that, but you might use errors='surrogateescape', just in case if the file is not correctly encoded. Surrogate characters are maybe less annoying than a huge UnicodeDecodeError
- You use /etc/os-release even if the file is empty. Do you know if there is a standard, or something like that explaining if some keys are mandatory? For example, we can ignore os-release if 'ID' or 'VERSION_ID' key is missing
- For the unit test, you should write at least a test on linux_distribution() to check that your private function is used correctly
- You add unit tests for all escaped characters (', ", \), for comments, and maybe also for maformated lines (to have a well defined behaviour, ignore them or raise an error)
- _UNIXCONFDIR looks to be dedicated to unit tests, can't you patch builtin open() instead? It would avoid the need of a temporary directory |
|