mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
fix: workaround method calls on attributes set to None
(#4812)
This commit is contained in:
parent
57f1e4bcbd
commit
400d2d6c56
2 changed files with 27 additions and 2 deletions
23
news/fix_exit_error.rst
Normal file
23
news/fix_exit_error.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Silence spurious errors on exit due to out-of-order cleanup
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -191,8 +191,10 @@ class _TeeStd(io.TextIOBase):
|
|||
|
||||
def flush(self):
|
||||
"""Flushes both the original stdout and the buffer."""
|
||||
self.std.flush()
|
||||
self.mem.flush()
|
||||
# In certain cases, `std` or `mem` may already be `None` when we're
|
||||
# cleaning up in which case we don't care whether `flush` does anything
|
||||
getattr(getattr(self, "std", lambda: None), "flush", lambda: None)()
|
||||
getattr(getattr(self, "mem", lambda: None), "flush", lambda: None)()
|
||||
|
||||
def fileno(self):
|
||||
"""Tunnel fileno() calls to the std stream."""
|
||||
|
|
Loading…
Add table
Reference in a new issue