Staging
v0.5.1
https://github.com/python/cpython
Revision 9781e5d97e4648453b6b4d011b7252c1cb05656c authored by Andrew M. Kuchling on 05 October 2006, 18:22:02 UTC, committed by Andrew M. Kuchling on 05 October 2006, 18:22:02 UTC
 applied to pyarena.c, compile.c, and symtable.c, which were different in 2.4.]

Fix more memory allocation issues found with failmalloc.
1 parent 8a28c16
Raw File
Tip revision: 9781e5d97e4648453b6b4d011b7252c1cb05656c authored by Andrew M. Kuchling on 05 October 2006, 18:22:02 UTC
[Partial backport of r50773 | neal.norwitz -- other parts of this patch
Tip revision: 9781e5d
rmpyc.py
# Remove all the .pyc and .pyo files under ../Lib.


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

    npyc = npyo = 0
    for root, dirs, files in os.walk(root):
        for name in files:
            delete = False
            if name.endswith('.pyc'):
                delete = True
                npyc += 1
            elif name.endswith('.pyo'):
                delete = True
                npyo += 1

            if delete:
                os.remove(join(root, name))

    return npyc, npyo

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