Staging
v0.5.1
https://github.com/python/cpython
Revision 20cc6be1aada880f0267eaca39ebb70d0e790692 authored by Andrew M. Kuchling on 05 October 2006, 19:32:52 UTC, committed by Andrew M. Kuchling on 05 October 2006, 19:32:52 UTC
 you find that Python does print "MemoryError".  There's no traceback
 and no indication of which line of code is responsible, but it's
 better than a segfault.]

Handle NULL nodes while parsing.  I'm not entirely sure this is correct.
There might be something else that needs to be done to setup the error.

Klocwork #295.
1 parent 6d0bc3e
Raw File
Tip revision: 20cc6be1aada880f0267eaca39ebb70d0e790692 authored by Andrew M. Kuchling on 05 October 2006, 19:32:52 UTC
[Backport r51222 | neal.norwitz -- if you hack the code to set r=NULL,
Tip revision: 20cc6be
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