Staging
v0.5.1
https://github.com/python/cpython
Revision c26a666e6751a9fad766ef83432b893f9b15ecaf authored by Łukasz Langa on 24 September 2020, 14:34:21 UTC, committed by Łukasz Langa on 04 October 2020, 16:40:36 UTC
Closes bpo issue 41602.
(cherry picked from commit a68a2ad19c891faa891904b3da537911cc77df21)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
1 parent bd55c46
Raw File
Tip revision: c26a666e6751a9fad766ef83432b893f9b15ecaf authored by Łukasz Langa on 24 September 2020, 14:34:21 UTC
[3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22397)
Tip revision: c26a666
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