[issue34446] ambiguous _max_size parameter in SpooledTemporaryFile

2018-08-21 Thread jcc2220


jcc2220  added the comment:

Here's an example of the inconsistency - if SpooledTemporaryFile is 
instantiated with max_size set to 0, it will not rollover, EXCEPT when truncate 
method is called.  Both write and writelines (public methods) call _check, 
which deals with rollover, but _check will never rollover if max_size is set to 
0.

--

___
Python tracker 
<https://bugs.python.org/issue34446>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34446] ambiguous _max_size parameter in SpooledTemporaryFile

2018-08-20 Thread jcc2220


New submission from jcc2220 :

When _max_size is set to 0, the _check method will never call rollover, as the 
conditional for a rollover is never satisfied.  However, in the truncate 
method, the _max_size is not checked against 0, and so a rollover could be 
called when it is 0.  This is more of an issue of consistency - should 0 mean 
that it will never rollover?  If so, truncate should be modified.  Should 0 be 
interpreted as 'always rollover'?  If so, the _check should be modified.  
Personally, I'd rather have something like -1 mean never, 0 mean always, and >0 
mean only when greater than specified size.


John

--
components: Library (Lib)
messages: 323809
nosy: jcc2220
priority: normal
severity: normal
status: open
title: ambiguous _max_size parameter in SpooledTemporaryFile
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue34446>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com