Fix spying on methods on old-style classes.

Review Request #10199 — Created Oct. 6, 2018 and submitted

Information

kgb
master
d65f131...

Reviewers

kgb

On Python 2.6 and early versions of 2.7, object.__setattr__ can't be
used on old-style classes (those not inheriting from object), which
meant that some spies would succeed on some versions of Python and fail
on others.

We now fall back to simply modifying the dictionary in these cases.

Unit tests pass on all supported versions of Python.

Description From Last Updated

Should we explicitly check for the version here?

brenniebrennie
brennie
  1. 
      
  2. kgb/spies.py (Diff revision 1)
     
     

    Should we explicitly check for the version here?

    1. No, because it's not clear when this behavior was changed. I'd rather test the result rather than assume anything about versions.

  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (352ec95)
Loading...