Fix for #3970 cache invalidation bug
Also fixed stable sorting test failure that presents on some platforms

@jreback can you review and merge pls? also
- PEP8, man (especially line length) =) 
- Can you configure your text editor to strip trailing whitespace? in emacs i have

`(add-hook 'before-save-hook 'delete-trailing-whitespace)`

thanks!
 sure...no prob

when BlockManager is revisited....easiest prob to move the cache inside BM, then consolidate can just invalidate easily
 merged in...thanks for the debug..
