Skip to content

Commit 717bc39

Browse files
committed
Avoid unnecessary use of saferepr()
saferepr() is only necessary to guard against recursive data structures. However, if you pass a recursive data structure as an SQL query parameter, You're Gonna Have A Bad Time. So just use repr() which is faster.
1 parent 2e3022a commit 717bc39

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

debug_toolbar/panels/sql/panel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from collections import defaultdict
33
from copy import copy
4-
from pprint import saferepr
54

65
from django.db import connections
76
from django.urls import path
@@ -54,10 +53,10 @@ def _similar_query_key(query):
5453

5554
def _duplicate_query_key(query):
5655
raw_params = () if query["raw_params"] is None else tuple(query["raw_params"])
57-
# saferepr() avoids problems because of unhashable types
56+
# repr() avoids problems because of unhashable types
5857
# (e.g. lists) when used as dictionary keys.
5958
# https://github.com/jazzband/django-debug-toolbar/issues/1091
60-
return (query["raw_sql"], saferepr(raw_params))
59+
return (query["raw_sql"], repr(raw_params))
6160

6261

6362
def _process_query_groups(query_groups, databases, colors, name):

0 commit comments

Comments
 (0)