From 7aab54e92d8d0ef137d1dca782bba739f4d3d424 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sat, 1 Oct 2016 00:54:18 +0300 Subject: Issue #28226: compileall now supports pathlib --- Doc/library/compileall.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Doc/library/compileall.rst') diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst index 91bdd18d70..c1af02b0d8 100644 --- a/Doc/library/compileall.rst +++ b/Doc/library/compileall.rst @@ -153,6 +153,9 @@ Public functions The *legacy* parameter only writes out ``.pyc`` files, not ``.pyo`` files no matter what the value of *optimize* is. + .. versionchanged:: 3.6 + Accepts a :term:`path-like object`. + .. function:: compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1) Compile the file with path *fullname*. Return a true value if the file @@ -221,6 +224,9 @@ subdirectory and all its subdirectories:: import re compileall.compile_dir('Lib/', rx=re.compile(r'[/\\][.]svn'), force=True) + # pathlib.Path objects can also be used. + import pathlib + compileall.compile_dir(pathlib.Path('Lib/'), force=True) .. seealso:: -- cgit v1.2.1