@@ -1330,14 +1330,18 @@ def qualname_from_function(func):
1330
1330
1331
1331
prefix , suffix = "" , ""
1332
1332
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__" ):
1339
1334
prefix , suffix = "partial(<function " , ">)"
1340
1335
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
1341
1345
1342
1346
if hasattr (func , "__qualname__" ):
1343
1347
func_qualname = func .__qualname__
0 commit comments