Fix platform.architecture() for macOS universal binaries: it no longer uses the system's "file" command if the executable parameter is not set.
|
|
||
| # bpo-35348: For Python executable, don't use the file command | ||
| if executable is None or executable == sys.executable: | ||
| if sys.platform == 'win32': |
There was a problem hiding this comment.
Why not use _default_architecture?
There was a problem hiding this comment.
I think that it's time to drop MS-DOS and 16-bit Windows. I don't see the point of keeping a _default_architecture = {'win32': ('', 'WindowsPE')} dictionary.
There was a problem hiding this comment.
Using _default_architecture can make supporting new non-standard architectures easier.
But if you think than it is unlikely that new special cases will be added in future, perhaps remove _default_architecture?
There was a problem hiding this comment.
Please ignore the last sentence. I missed that the definition of _default_architecture was removed in the original commit.
There was a problem hiding this comment.
I pushed a new commit "Add platform._DEFAULT_LINKAGE". I dislike _default_architecture: it was documented whereas it's a private attribute, it's lower-case whereas PEP 8 suggests upper-case for constants, and it requires to check if bits or linkage are empty.
|
Technically LGTM, but I do not know whether the behavior change is desirable. |
Me neither :-) I would like to get a review of a macOS expert. It seems like @ronaldoussoren dislike the change: |
|
@ronaldoussoren dislike this approach: @malemburg also seems to dislike this change: So I abandon this change. |
|
See PR #11208 which update the doc instead. |
Fix platform.architecture() for macOS universal binaries: it no
longer uses the system's "file" command if the executable parameter
is not set.
https://bugs.python.org/issue35348