On 6/27/06, Neal Norwitz <[EMAIL PROTECTED]> wrote:
First of all, it would require that the file names have been cleared for writing. Otherwise an exception will be thrown the first time open() is called. Second, the os.unlink() will fail unless you whitelist your platform's OS-specific module that is used by 'os' (e.g., posix).
If I put in any cap, I would make it universal for *all* disk writes (and probably do the same for network sends).
-Brett
On 6/27/06, Brett Cannon <[EMAIL PROTECTED]> wrote:
>
> > (5) I think file creation/writing should be capped rather than
> > binary; it is reasonable to say "You can create a single temp file up
> > to 4K" or "You can create files, but not more than 20Meg total".
>
> That has been suggested before. Anyone else like this idea?
What would this code do:
MAX = 4
for i in xrange(10):
fp = open(str(i), 'w+')
fp.write(' ' * (MAX // 4))
fp.close()
if i % 2:
os.unlink(str(i))
First of all, it would require that the file names have been cleared for writing. Otherwise an exception will be thrown the first time open() is called. Second, the os.unlink() will fail unless you whitelist your platform's OS-specific module that is used by 'os' (e.g., posix).
How many times should this execute, 4 or 8? What about if there is no
if i % 2 and the file is unlinked at the end of each loop? Should
that loop 10 times without error? What would happen if we used the
same file name? What would happen if we did something like:
fp = open(str(i), 'w+')
MAX = 4
for i in xrange(10000):
fp.seek(0)
fp.write(' ' * (MAX // 4))
Should this succeed?
If I put in any cap, I would make it universal for *all* disk writes (and probably do the same for network sends).
-Brett
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com