File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,7 @@ cdef class ConnectParamsImpl:
568568 cdef bytes _get_password(self )
569569 cdef str _get_private_key(self )
570570 cdef str _get_token(self )
571+ cdef object _get_public_instance(self )
571572 cdef object _get_token_expires(self , str token)
572573 cdef str _get_wallet_password(self )
573574 cdef int _parse_connect_string(self , str connect_string) except - 1
Original file line number Diff line number Diff line change @@ -257,6 +257,19 @@ cdef class ConnectParamsImpl:
257257 errors._raise_err(errors.ERR_EXPIRED_ACCESS_TOKEN)
258258 return self ._xor_bytes(self ._token, self ._token_obfuscator).decode()
259259
260+ cdef object _get_public_instance(self ):
261+ """
262+ Returns the public instance to use when making calls out to user
263+ defined code.
264+ """
265+ cdef object inst
266+ if isinstance (self , PoolParamsImpl):
267+ inst = PY_TYPE_POOL_PARAMS.__new__ (PY_TYPE_POOL_PARAMS)
268+ else :
269+ inst = PY_TYPE_CONNECT_PARAMS.__new__ (PY_TYPE_CONNECT_PARAMS)
270+ inst._impl = self
271+ return inst
272+
260273 cdef object _get_token_expires(self , str token):
261274 """
262275 Gets the expiry date from the token.
Original file line number Diff line number Diff line change @@ -383,14 +383,8 @@ cdef class ConnectStringParser(BaseParser):
383383 if protocol is not None :
384384 fn = REGISTERED_PROTOCOLS.get(protocol)
385385 if fn is not None :
386- if isinstance (self .params_impl, PoolParamsImpl):
387- params = PY_TYPE_POOL_PARAMS.__new__ (PY_TYPE_POOL_PARAMS)
388- else :
389- params = PY_TYPE_CONNECT_PARAMS.__new__ (
390- PY_TYPE_CONNECT_PARAMS
391- )
392- params._impl = self .params_impl
393386 arg = self .data_as_str[self .temp_pos:]
387+ params = self .params_impl._get_public_instance()
394388 try :
395389 fn(protocol, arg, params)
396390 except Exception as e:
You can’t perform that action at this time.
0 commit comments