diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-08-22 14:31:18 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-08-24 11:57:42 -0700 |
| commit | 523a3bc7733b13cbfb4b702739cd26d0c29b05f7 (patch) | |
| tree | d2293ddd9c03e29696f9a0bf6aeb2b2d87fb3ba4 /python/ovs/daemon.py | |
| parent | 57d6a4c71bd0b4ed477ec273d4d4f84c5e4ed465 (diff) | |
| download | openvswitch-523a3bc7733b13cbfb4b702739cd26d0c29b05f7.tar.gz | |
python: Use getattr() and setattr() instead of __dict__.
This leaves one use of __dict__ used for iterating through attributes.
I could use dir() instead, but I was put off by this note in its
documentation in the Python Library Reference:
Because dir() is supplied primarily as a convenience for use at an
interactive prompt, it tries to supply an interesting set of names more
than it tries to supply a rigorously or consistently defined set of names,
and its detailed behavior may change across releases. For example,
metaclass attributes are not in the result list when the argument is a
class.
Suggested-by: Reid Price <reid@nicira.com>
Diffstat (limited to 'python/ovs/daemon.py')
| -rw-r--r-- | python/ovs/daemon.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py index 3d46deb75..149c8a1d8 100644 --- a/python/ovs/daemon.py +++ b/python/ovs/daemon.py @@ -266,8 +266,7 @@ def _should_restart(status): if os.WIFSIGNALED(status): for signame in ("SIGABRT", "SIGALRM", "SIGBUS", "SIGFPE", "SIGILL", "SIGPIPE", "SIGSEGV", "SIGXCPU", "SIGXFSZ"): - if (signame in signal.__dict__ and - os.WTERMSIG(status) == signal.__dict__[signame]): + if os.WTERMSIG(status) == getattr(signal, signame, None): return True return False |
