Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed May 16, 2021
1 parent af10281 commit 8e88c1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lab/types.py
Expand Up @@ -269,7 +269,7 @@ def issubdtype(dtype1: DType, dtype2: DType):


@dispatch
def promote_dtypes(dtype: DType, *dtypes: DType):
def promote_dtypes(first_dtype: DType, *dtypes: DType):
"""Find the smallest data type to which safely a number of the given data types can
be cast.
Expand All @@ -284,14 +284,14 @@ def promote_dtypes(dtype: DType, *dtypes: DType):
"""
if len(dtypes) == 0:
# There is just one data type given.
return dtype
return first_dtype
# Perform promotion.
common_dtype = np.promote_types(
convert(dtype, NPDType), convert(dtypes[0], NPDType)
convert(first_dtype, NPDType), convert(dtypes[0], NPDType)
)
for dtype in dtypes[1:]:
common_dtype = np.promote_types(common_dtype, convert(dtype, NPDType))
return _convert_back(common_dtype.type, dtype)
return _convert_back(common_dtype.type, first_dtype)


@dispatch
Expand Down

0 comments on commit 8e88c1a

Please sign in to comment.