@@ -23,11 +23,11 @@ def patch():
2323 _xray_register_type_fix
2424 )
2525
26- # wrapt.wrap_function_wrapper(
27- # 'psycopg2.extras',
28- # 'register_default_jsonb',
29- # _xray_register_default_jsonb_fix
30- # )
26+ wrapt .wrap_function_wrapper (
27+ 'psycopg2.extras' ,
28+ 'register_default_jsonb' ,
29+ _xray_register_default_jsonb_fix
30+ )
3131
3232
3333def _xray_traced_connect (wrapped , instance , args , kwargs ):
@@ -58,12 +58,12 @@ def _xray_register_type_fix(wrapped, instance, args, kwargs):
5858 return wrapped (* our_args , ** kwargs )
5959
6060
61- # def _xray_register_default_jsonb_fix(wrapped, instance, args, kwargs):
62- # our_kwargs = dict()
63- # for key, value in kwargs.items():
64- # if key == "conn_or_curs" and isinstance(value, (XRayTracedConn, XRayTracedCursor)):
65- # # unwrap the connection or cursor to be sent to register_default_jsonb
66- # value = value.__wrapped__
67- # our_kwargs[key] = value
68- #
69- # return wrapped(*args, **our_kwargs)
61+ def _xray_register_default_jsonb_fix (wrapped , instance , args , kwargs ):
62+ our_kwargs = dict ()
63+ for key , value in kwargs .items ():
64+ if key == "conn_or_curs" and isinstance (value , (XRayTracedConn , XRayTracedCursor )):
65+ # unwrap the connection or cursor to be sent to register_default_jsonb
66+ value = value .__wrapped__
67+ our_kwargs [key ] = value
68+
69+ return wrapped (* args , ** our_kwargs )
0 commit comments