summaryrefslogtreecommitdiff
path: root/test/aaa_profiling
diff options
context:
space:
mode:
authorCarson Ip <carsonip715@gmail.com>2020-01-03 17:09:20 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-01-04 13:01:26 -0500
commit5ecb7732fb62d80adb4434bdd0e606e43aa14a98 (patch)
tree62f4110b11eda3228dd01d935535480c18276a01 /test/aaa_profiling
parent5881fd274015af3de37f2ff0f91ff6a7c61c1540 (diff)
downloadsqlalchemy-5ecb7732fb62d80adb4434bdd0e606e43aa14a98.tar.gz
Fix QueryContext ref cycle on joinedload
Avoid storing a reference to itself when dealing with create_eager_joins. Also fix a cheating test. Fixes: #5071 Closes: #5072 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5072 Pull-request-sha: 75ebaf7c91e96d7567eb5760be713dc134c58763 Change-Id: I511ddc0979b46f7928217347199eca4b1d0b4a49
Diffstat (limited to 'test/aaa_profiling')
-rw-r--r--test/aaa_profiling/test_memusage.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py
index 301724509..94d16517e 100644
--- a/test/aaa_profiling/test_memusage.py
+++ b/test/aaa_profiling/test_memusage.py
@@ -1269,6 +1269,21 @@ class CycleTest(_fixtures.FixtureTest):
go()
+ def test_query_joinedload(self):
+ User, Address = self.classes("User", "Address")
+
+ s = Session()
+
+ def generate():
+ s.query(User).options(joinedload(User.addresses)).all()
+
+ # cycles here are due to ClauseElement._cloned_set and Load.context
+ @assert_cycles(28)
+ def go():
+ generate()
+
+ go()
+
def test_plain_join(self):
users, addresses = self.tables("users", "addresses")