@@ -1330,14 +1330,18 @@ def qualname_from_function(func):
13301330
13311331 prefix , suffix = "" , ""
13321332
1333- if hasattr (func , "_partialmethod" ) and isinstance (
1334- func ._partialmethod , partialmethod
1335- ):
1336- prefix , suffix = "partialmethod(<function " , ">)"
1337- func = func ._partialmethod .func
1338- elif isinstance (func , partial ) and hasattr (func .func , "__name__" ):
1333+ if isinstance (func , partial ) and hasattr (func .func , "__name__" ):
13391334 prefix , suffix = "partial(<function " , ">)"
13401335 func = func .func
1336+ else :
1337+ # The _partialmethod attribute of methods wrapped with partialmethod() was renamed to __partialmethod__ in CPython 3.13:
1338+ # https://github.com/python/cpython/pull/16600
1339+ partial_method = getattr (func , "_partialmethod" , None ) or getattr (
1340+ func , "__partialmethod__" , None
1341+ )
1342+ if isinstance (partial_method , partialmethod ):
1343+ prefix , suffix = "partialmethod(<function " , ">)"
1344+ func = partial_method .func
13411345
13421346 if hasattr (func , "__qualname__" ):
13431347 func_qualname = func .__qualname__
0 commit comments