Skip to content

Commit e089c72

Browse files
committed
More robust test for the _partialmethod attribute.
The asyncio tests pass in a mock.Mock() instance and it always has any attribute, so the test enters an infinite loop. This change avoids that trap.
1 parent 4fecb83 commit e089c72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/functools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ def _unwrap_partialmethod(func):
417417
prev = None
418418
while func is not prev:
419419
prev = func
420-
while hasattr(func, "_partialmethod"):
421-
func = getattr(func, '_partialmethod')
420+
while isinstance(getattr(func, "_partialmethod", None), partialmethod):
421+
func = func._partialmethod
422422
while isinstance(func, partialmethod):
423423
func = getattr(func, 'func')
424424
func = _unwrap_partial(func)

0 commit comments

Comments
 (0)