Allow specifying a function name for spying on bad decorators.

Review Request #11932 — Created Jan. 18, 2022 and submitted

Information

kgb
master

Reviewers

kgb

If a decorator fails to copy over the function name from the wrapped
function, spying on the decorator can fail, due to the inability to
locate the correct function for the slippery function check.

This situation is now detected and a warning logged. It advises using
a new parameter, func_name=, which enables a spy to specify an
explicit function name. This is rarely needed, but useful when
encountering this sort of situation.

All unit tests pass on all supported versions of Python.

Summary ID
Allow specifying a function name for spying on bad decorators.
If a decorator fails to copy over the function name from the wrapped function, spying on the decorator can fail, due to the inability to locate the correct function for the slippery function check. This situation is now detected and a warning logged. It advises using a new parameter, `func_name=`, which enables a spy to specify an explicit function name. This is rarely needed, but useful when encountering this sort of situation.
073fbce725224d8948e4a627f4a194987deb9d83
david
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (8c2008e)
Loading...