◐ Shell
clean mode source ↗

bpo-35348: Fix platform.architecture() on macOS by vstinner · Pull Request #11186 · python/cpython

serhiy-storchaka


# bpo-35348: For Python executable, don't use the file command
if executable is None or executable == sys.executable:
if sys.platform == 'win32':

Choose a reason for hiding this comment

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

Why not use _default_architecture?

Choose a reason for hiding this comment

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

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.

Choose a reason for hiding this comment

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

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?

Choose a reason for hiding this comment

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

Please ignore the last sentence. I missed that the definition of _default_architecture was removed in the original commit.

Choose a reason for hiding this comment

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

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.