Return a `WeakMethod` wrapping *func* if possible, else a `_StrongRef`.
(func, callback)
| 135 | |
| 136 | |
| 137 | def _weak_or_strong_ref(func, callback): |
| 138 | """ |
| 139 | Return a `WeakMethod` wrapping *func* if possible, else a `_StrongRef`. |
| 140 | """ |
| 141 | try: |
| 142 | return weakref.WeakMethod(func, callback) |
| 143 | except TypeError: |
| 144 | return _StrongRef(func) |
| 145 | |
| 146 | |
| 147 | class _UnhashDict: |
no test coverage detected
searching dependent graphs…