from __future__ import print_function import sqlite3 import pickle with sqlite3.connect(':memory:') as conn: conn.row_factory = sqlite3.Row conn.executescript(''' CREATE TABLE test ( col INTEGER ); INSERT INTO test VALUES ( 4 )''' ) row = conn.execute('SELECT * FROM test').fetchone() dump = pickle.dumps(row) # This works fine load = pickle.loads(dump) # This will cause the crash print('Keys are:', load.keys())