@@ -1118,8 +1118,8 @@ def __get__(self, instance, owner=None):
11181118
11191119    __class_getitem__  =  classmethod (GenericAlias )
11201120
1121- def  _warn_kwargs ( func ):
1122-     @wraps (func ) 
1121+ def  _warn_python_reduce_kwargs ( py_reduce ):
1122+     @wraps (py_reduce ) 
11231123    def  wrapper (* args , ** kwargs ):
11241124        if  'function'  in  kwargs  or  'sequence'  in  kwargs :
11251125            import  os 
@@ -1131,14 +1131,16 @@ def wrapper(*args, **kwargs):
11311131                'forbidden in Python 3.16.' ,
11321132                DeprecationWarning ,
11331133                skip_file_prefixes = (os .path .dirname (__file__ ),))
1134-         return  func (* args , ** kwargs )
1134+         return  py_reduce (* args , ** kwargs )
11351135    return  wrapper 
11361136
1137- reduce  =  _warn_kwargs (reduce )
1137+ reduce  =  _warn_python_reduce_kwargs (reduce )
1138+ del  _warn_python_reduce_kwargs 
11381139
1139- # This import has been moved here due to gh-121676 
1140- # In Python3.16 _warn_kwargs should be removed, and this 
1141- # import should be moved right after the reduce definition 
1140+ # The import of the C accelerated version of reduce() has been moved 
1141+ # here due to gh-121676. In Python 3.16, _warn_python_reduce_kwargs() 
1142+ # should be removed and the import block should be moved back right 
1143+ # after the definition of reduce(). 
11421144try :
11431145    from  _functools  import  reduce 
11441146except  ImportError :
0 commit comments