When running a Python universal binary (x86_64, arm64), how can I check from within Python whether it is running the x86_64 or arm64 executable? It seems that os.uname() and platform.machine() would always give the actual system architecture (i.e. "arm64"), and sysconfig.get_platform() would always give "universal2" (also not helping).
So how to tell the difference between Python being run as python3 or arch -x86_64 python3?
Okay, I think the following function should report the correct machine architectures (i.e. that of the running interpreter, not that of the system), also for other OS:
I unfortunately don't have access to a M1 Mac to double check. If someone could confirm that this works, that would be great.