Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of numexpr.cpu in print_versions()
There are a couple of issues in the way "numexpr.cpu.info" is used in print_versions(): 1) all the subclasses of CPUInfoBase have a class attribute "info", whereas CPUInfoBase does not; this means that, in case there is no CPU implementation for an OS, "self.info" returns a function (because of CPUInfoBase.__getattr__()) which is not subscriptable 2) only few subclasses of CPUInfoBase (e.g. LinuxCPUInfo, Win32CPUInfo) implement "info" as list of dicts for each CPU, whereas the rest of the implementations use a dict with attributes Since "info" seems to be mostly an internal detail, then adapt print_versions() to be a little more flexible: - do not try to query attributes in case the actual CPU implementation is CPUInfoBase: it is not implemented for the current OS, so there is nothing to query anyway (fixes (1)) - get the first element of "info" only in case it is a list (fixes (2)) - drop the catch of KeyError, which should not happen anymore now
- Loading branch information