bpo-35348: Fix platform.architecture()#11159
bpo-35348: Fix platform.architecture()#11159vstinner merged 2 commits intopython:masterfrom vstinner:platform_file
Conversation
|
I'm not sure if the "file" command supports the -b option on all platforms. It seems like platform used file -b in the past and nobody complained. |
|
@serhiy-storchaka: you wrote PR #11160, but I'm confident that it will be fine to use "file -b -- executable" command. I propose to make this change in the master branch and leave stable branches (2.7 and 3.7) unchanged. If something goes wrong, we can easily revert this change. |
|
Could you then borrow other changes from #11160? |
Make platform.architecture() parsing of "file" command output more reliable: * Add the "-b" option to the "file" command to omit the filename; * Force the usage of the C locale; * Search also the "shared object" pattern. Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
|
I removed "--" from "file -b -- target". If target starts with "-", file will fail since the filename miss. Example: This change should prevent portability issue.
Sure. I picked your changes into my PR and I credited you. I replaced env={'LC_ALL': 'C'} with env=dict(os.environ, LC_ALL='C'). Few programs like to run in an (almost) empty environment. I wasn't sure if you preferred to push your changes separately or not. |
|
I propose to not backport this fix. At least not the addition of the -b flag. |
Fix platform.architecture(): add the -b option to the "file" command.
https://bugs.python.org/issue35348