- # this can raise, but the native side checks the exception
- results = cls._query(query_exec, obj, params, log_level)
+ try:
+ # this can raise, but the native side checks the exception
+ results = cls._user_query(priv_query_exec, obj, params)
+ finally:
+ # the private query executor is a private view on the query
+ # executor; it's not a shared object (the library does not
+ # offer an API to get/put a reference, just like "self"
+ # objects) from this query's point of view, so invalidate
+ # the object in case the user kept a reference and uses it
+ # later
+ priv_query_exec._invalidate()