Staging
v0.5.1
https://github.com/python/cpython
Revision b316c44b0105d11a80ff971636143735f3655bbf authored by Miss Islington (bot) on 09 March 2018, 20:35:14 UTC, committed by Brett Cannon on 09 March 2018, 20:35:14 UTC
(cherry picked from commit 7a7f100eb352d08938ee0f5ba59c18f56dc4a7b5)

Co-authored-by: Brett Cannon <brettcannon@users.noreply.github.com>
1 parent 3f7d0b6
Raw File
Tip revision: b316c44b0105d11a80ff971636143735f3655bbf authored by Miss Islington (bot) on 09 March 2018, 20:35:14 UTC
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the interpreter (GH-5960) (GH-6042)
Tip revision: b316c44
rmpyc.py
# Remove all the .pyc files under ../Lib.


def deltree(root):
    import os
    from os.path import join

    npyc = 0
    for root, dirs, files in os.walk(root):
        for name in files:
            # to be thorough
            if name.endswith(('.pyc', '.pyo')):
                npyc += 1
                os.remove(join(root, name))

    return npyc

npyc = deltree("../Lib")
print(npyc, ".pyc deleted")
back to top