[New-bugs-announce] [issue30493] Increase coverage of base64

Lee Cannon report at bugs.python.org
Sat May 27 16:45:48 EDT 2017


New submission from Lee Cannon:

Added tests to ensure a85decode correctly handles the 'y' character within the byte like object when foldspaces is true.


While attempting to increase coverage I found two lines of code within base64.py that appear to never execute:
  - line 472
  - line 501


Line 472:
The only time the TypeError except block (line 467) executes is when _b85dec[c] resolves to None for one of the c (characters) in chunk.

Then within the except block the c (characters) within chunk are iterated through until the None is hit then a ValueError is raised (line 470). Making it impossible for line 472 to execute.


Line 501:
s is assigned a value in the expression `s = input.read(MAXBINSIZE)` (line 494), due to this len(s) is only ever not equal to MAXBINSIZE if the end of input has been reached and nothing was read or the last chunk of data was read from input which has a len less than MAXBINSIZE but non-zero.

Therefore the only way to enter into the while loop (line 497) is if there are no more characters left to be read from input, yet all that happens in the while loop is the read function is called on input with a non zero parameter (`MAXBINSIZE-len(s)` must be greater than zero for the while to have executed) then when it returns nothing (it always will) execution breaks out of the while loop without modifiying s.

----------
components: Tests
messages: 294611
nosy: leecannon
priority: normal
severity: normal
status: open
title: Increase coverage of base64
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30493>
_______________________________________


More information about the New-bugs-announce mailing list