Use of functools.wraps
unintentionally updates _GapicCallable class attributes
#579
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
We got a CBF after we imported a PR in grpc Python to g3 (stack trace listed below).
After some digging, we found that it's because the use of
functools.wraps
unintentionally updates_GapicCallable
class attributes_target
.In the PR, we introduced a new attribute
_target
to grpc multi callables, but the implementation offunctools.wraps
did more than what's intended, it changed_target
attribute of_GapicCallable
to the ones from multi callables, causing_GapicCallable._target
to change from a function to a byte string, I also provided an example below.Code example
Stack trace
Suggested Fix
__slot__
to our multi-callable class. In the meantime, we suggest addingupdated
tofunctools.wraps
to prevent similar issues from happening in the future.The text was updated successfully, but these errors were encountered: