ARM-software / trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Apache License 2.0
60 stars 39 forks source link

ftrace: fix __getattr__ implementation #284

Closed douglas-raillard-arm closed 5 years ago

douglas-raillard-arm commented 5 years ago

Since __getattr__ can be called on uninitialized instances (i.e. with no attributes), it can enter an infinite recursion while trying to access some instance attributes.

Fix that by ignoring requests for dunder names (__XXX__), since they are resolved without __getattr__ when needed by a builtin, and are mostly supposed to be class attributes in other cases. That means __getattr__ is not supposed to receive requests to such names often, and these will (almost) surely not be anything the API can offer since usage of such names is reserved for future expansion of the language.

JaviMerino commented 5 years ago

Tests pass on my machin, so I ignoring travis' test failure