﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22330	Model.__reduce__() includes cached lookups	Patryk Zawadzki	nobody	"If you try to pickle an object after accessing any of its related instances, its `__dict__` will contain references to those instances and will cause them to be pickled as part of your object.

Pickling them can cause additional instances to be traversed and can result in an unexpectedly large number of objects being included. These will be pickled/unpickled as a single chunk and I assume the unpickled instance will continue to use its cached instances which may lead to surprising results (values not reflecting current DB state).

Pickling additional instances can cause relation traversal to cache additional reverse lookups thus modifying an instance's `__dict__` while it is being pickled. This results in:

{{{
RuntimeError: dictionary changed size during iteration
}}}"	Cleanup/optimization	closed	Database layer (models, ORM)	1.6	Normal	needsinfo			Accepted	0	0	0	0	0	0
