commit | 48a5ce1b914f3a56c77b599316a1c50f675b3212 | [log] [tgz] |
---|---|---|
author | Guillaume Galeazzi <guillaume.g@leazzi.ch> | Wed Jun 28 16:21:46 2017 +0200 |
committer | AmberAussie <amberaussie@leazzi.ch> | Wed Jun 28 16:27:43 2017 +0200 |
tree | 440e9e4100fa93e1056897df8f8166d76eb64fe2 | |
parent | 13c8f6da4539b7c4ca8372fe614560cfe0e4eddd [diff] [blame] |
serial: SerialBase with is idempotent
diff --git a/serial/serialutil.py b/serial/serialutil.py index e4df90f..7d51752 100644 --- a/serial/serialutil.py +++ b/serial/serialutil.py
@@ -557,6 +557,8 @@ # context manager def __enter__(self): + if not self.is_open: + self.open() return self def __exit__(self, *args, **kwargs):