diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-10-01 00:54:18 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-10-01 00:54:18 +0300 |
commit | 812a2b65af1897aa9694ff65fc62516a4e10269c (patch) | |
tree | 5cb56a40cbef3dda1cc42953d8fae00ae7562df6 /Lib/compileall.py | |
parent | b4b55eb582e5a7c71bac90030ab3c46b5cd6d429 (diff) | |
download | cpython-git-812a2b65af1897aa9694ff65fc62516a4e10269c.tar.gz |
Issue #28226: compileall now supports pathlib
Diffstat (limited to 'Lib/compileall.py')
-rw-r--r-- | Lib/compileall.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py index 67c5f5ac72..3e45785a66 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -25,6 +25,8 @@ from functools import partial __all__ = ["compile_dir","compile_file","compile_path"] def _walk_dir(dir, ddir=None, maxlevels=10, quiet=0): + if quiet < 2 and isinstance(dir, os.PathLike): + dir = os.fspath(dir) if not quiet: print('Listing {!r}...'.format(dir)) try: @@ -105,6 +107,8 @@ def compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, optimize: optimization level or -1 for level of the interpreter """ success = True + if quiet < 2 and isinstance(fullname, os.PathLike): + fullname = os.fspath(fullname) name = os.path.basename(fullname) if ddir is not None: dfile = os.path.join(ddir, name) |