mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Merge pull request #2922 from laloch/filepath-to-logfile
make $XONSH_TRACEBACK_LOGFILE accept path objects
This commit is contained in:
commit
fc64f31383
2 changed files with 29 additions and 0 deletions
24
news/filepath-to-logfile.rst
Normal file
24
news/filepath-to-logfile.rst
Normal file
|
@ -0,0 +1,24 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* ``$XONSH_TRACEBACK_LOGFILE`` now beside strings also accepts ``os.PathLike``
|
||||
objects.
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -1169,6 +1169,11 @@ def to_logfile_opt(x):
|
|||
the filepath if it is a writable file or None if the filepath is not
|
||||
valid, informing the user on stderr about the invalid choice.
|
||||
"""
|
||||
superclass = pathlib.PurePath
|
||||
if PYTHON_VERSION_INFO >= (3, 6, 0):
|
||||
superclass = os.PathLike
|
||||
if isinstance(x, superclass):
|
||||
x = str(x)
|
||||
if is_logfile_opt(x):
|
||||
return x
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue