mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #28226: compileall now supports pathlib
This commit is contained in:
parent
b4b55eb582
commit
812a2b65af
4 changed files with 35 additions and 0 deletions
|
@ -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::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue