Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-35389: platform.libc_ver() uses os.confstr()#10891

Merged
vstinner merged 2 commits into
python:masterpython/cpython:masterfrom
vstinner:platform_confstrCopy head branch name to clipboard
Dec 5, 2018
Merged

bpo-35389: platform.libc_ver() uses os.confstr()#10891
vstinner merged 2 commits into
python:masterpython/cpython:masterfrom
vstinner:platform_confstrCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented Dec 4, 2018

Copy link
Copy Markdown
Member

platform.libc_ver() now uses os.confstr('CS_GNU_LIBC_VERSION') if
available.

Quick benchmark on Fedora 29:

python3 -m perf command ./python -S -c 'import platform; platform.libc_ver()'
94.9 ms +- 4.3 ms -> 33.2 ms +- 1.4 ms: 2.86x faster (-65%)

https://bugs.python.org/issue35389

Comment thread Lib/platform.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On some systems (IIRC using musl libc) os.confstr('CS_GNU_LIBC_VERSION') fails with OSError, so that should be caught too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know. It's now fixed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should add that it's only used if the executable parameter is not set.

@vstinner

vstinner commented Dec 5, 2018

Copy link
Copy Markdown
Member Author

Travis CI failed because of https://bugs.python.org/issue35411 :-( I just fixed this issue, this PR should be rebase (or merged with master).

platform.libc_ver() now uses os.confstr('CS_GNU_LIBC_VERSION') if
available and the *executable* parameter is not set. The default
value of the libc_ver() *executable* parameter becomes None.

Quick benchmark on Fedora 29:

python3 -m perf command ./python -S -c 'import platform; platform.libc_ver()'
94.9 ms +- 4.3 ms -> 33.2 ms +- 1.4 ms: 2.86x faster (-65%)
@vstinner

vstinner commented Dec 5, 2018

Copy link
Copy Markdown
Member Author

I squashed my commits and rebased my PR.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test overrides the existing test test_libc_ver.

@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

And if you don't make the requested changes, you will be put in the comfy chair!

@vstinner

vstinner commented Dec 5, 2018

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@serhiy-storchaka: please review the changes made to this pull request.

@vstinner

vstinner commented Dec 5, 2018

Copy link
Copy Markdown
Member Author

The test overrides the existing test test_libc_ver.

Oops, I missed these tests! It's now fixed.

@vstinner vstinner merged commit 476b113 into python:master Dec 5, 2018
@vstinner vstinner deleted the platform_confstr branch December 5, 2018 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.