bpo-26544: Fixed implementation of platform.libc_ver().#7684
bpo-26544: Fixed implementation of platform.libc_ver().#7684serhiy-storchaka merged 4 commits intopython:masterpython/cpython:masterfrom serhiy-storchaka:platform-libc_verserhiy-storchaka/cpython:platform-libc_verCopy head branch name to clipboard
Conversation
| if not m: | ||
| break | ||
| eof = True | ||
| binary = binary[max(pos, len(binary) - 1000):] + chunk |
There was a problem hiding this comment.
IIUC, the added logic is to fix the bug the version info might just appear around the boundary of chunks. But according to the documentation and comment, it seems the original intention is to let the user choose an appropriate chunk size. If we change the logic, the parameter chunksize looks somewhat unnecessary.
BTW, the default argument of chunksize in doc conflicts with implementation. (2048 vs 16384)
There was a problem hiding this comment.
What are the documentation and comment about the original intention? I can't find anything.
There was a problem hiding this comment.
I just infer from it. Otherwise I don't understand what's chunksize for. Anyway, it doesn't matter. I just think after this change, exposing chunksize seems somewhat superfluous.
| if not m: | ||
| break | ||
| eof = True | ||
| binary = binary[max(pos, len(binary) - 1000):] + chunk |
There was a problem hiding this comment.
Maybe it's better to put this line in an else block. No meaning to concatenate an empty bytes.
zhangyangyu
left a comment
There was a problem hiding this comment.
LGTM. Only one tiny suggestion.
|
Thank you for you review and suggestion @zhangyangyu! It has helped me to rewrite the code in more efficient and clear way. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
GH-8193 is a backport of this pull request to the 3.7 branch. |
…GH-7684). (pythonGH-8193) (cherry picked from commit 2a9b8ba) (cherry picked from commit 7c43b80) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ythonGH-7684). (pythonGH-8193) (cherry picked from commit 2a9b8ba). (cherry picked from commit 7c43b80) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-8196 is a backport of this pull request to the 2.7 branch. |
|
GH-8195 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue26544