Fixed #21487 -- Session cannot store tzinfo instances anymore.

Thanks filipp for the report.

Forward-port of 1eddca0a from stable/1.6.x.