On a second read - are you saying that pickled might not be defined because code does not enter the with block and then the ' if exp is None or exp > time.time() ' becomes true? I guess I can apply the NameError thing in this case too. Sorry for the confusion.
Fixed 20613 - moved pickle loads/dumps outside with self._lock.reader…
Additionaly added pickled=None initially and check for none before
returning in get
Looks good, I have to admit that I was wrong about my undefined variable concern. I parsed the code wrong in my head. In my defense, this way makes it more comprehensible anyway ;) Thank you!