@@ -64,7 +64,7 @@ def get_objs_combined_axis(
6464 objs ,
6565 intersect : bool = False ,
6666 axis : Axis = 0 ,
67- sort : bool = True ,
67+ sort : bool | lib . NoDefault = True ,
6868) -> Index :
6969 """
7070 Extract combined index: return intersection or union (depending on the
@@ -81,7 +81,8 @@ def get_objs_combined_axis(
8181 axis : {0 or 'index', 1 or 'outer'}, default 0
8282 The axis to extract indexes from.
8383 sort : bool, default True
84- Whether the result index should come out sorted or not.
84+ Whether the result index should come out sorted or not. NoDefault
85+ use for deprecation in GH#57335.
8586
8687 Returns
8788 -------
@@ -108,7 +109,7 @@ def _get_distinct_objs(objs: list[Index]) -> list[Index]:
108109def _get_combined_index (
109110 indexes : list [Index ],
110111 intersect : bool = False ,
111- sort : bool = False ,
112+ sort : bool | lib . NoDefault = False ,
112113) -> Index :
113114 """
114115 Return the union or intersection of indexes.
@@ -121,7 +122,8 @@ def _get_combined_index(
121122 If True, calculate the intersection between indexes. Otherwise,
122123 calculate the union.
123124 sort : bool, default False
124- Whether the result index should come out sorted or not.
125+ Whether the result index should come out sorted or not. NoDefault
126+ used for deprecation of GH#57335
125127
126128 Returns
127129 -------
@@ -138,10 +140,10 @@ def _get_combined_index(
138140 for other in indexes [1 :]:
139141 index = index .intersection (other )
140142 else :
141- index = union_indexes (indexes , sort = False )
143+ index = union_indexes (indexes , sort = sort if sort is lib . no_default else False )
142144 index = ensure_index (index )
143145
144- if sort :
146+ if sort and sort is not lib . no_default :
145147 index = safe_sort_index (index )
146148 return index
147149
@@ -180,7 +182,7 @@ def safe_sort_index(index: Index) -> Index:
180182 return index
181183
182184
183- def union_indexes (indexes , sort : bool | None = True ) -> Index :
185+ def union_indexes (indexes , sort : bool | None | lib . NoDefault = True ) -> Index :
184186 """
185187 Return the union of indexes.
186188
@@ -190,7 +192,8 @@ def union_indexes(indexes, sort: bool | None = True) -> Index:
190192 ----------
191193 indexes : list of Index or list objects
192194 sort : bool, default True
193- Whether the result index should come out sorted or not.
195+ Whether the result index should come out sorted or not. NoDefault
196+ used for deprecation of GH#57335.
194197
195198 Returns
196199 -------
@@ -227,7 +230,8 @@ def union_indexes(indexes, sort: bool | None = True) -> Index:
227230 raise TypeError ("Cannot join tz-naive with tz-aware DatetimeIndex" )
228231
229232 if num_dtis == len (indexes ):
230- # sort = True
233+ if sort is lib .no_default :
234+ sort = True
231235 result = indexes [0 ]
232236
233237 elif num_dtis > 1 :
0 commit comments