Skip to content

Commit f1ab711

Browse files
committed
Fix np.pad() casting
1 parent b58b1ee commit f1ab711

File tree

3 files changed

+399
-5
lines changed

3 files changed

+399
-5
lines changed

stdlib/numpy/format.codon

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class FloatingFormat:
5757
self.__init__()
5858
return
5959

60-
min_val = None
61-
max_val = None
60+
min_val: Optional[a.dtype] = None
61+
max_val: Optional[a.dtype] = None
6262
finite = 0
6363
abs_non_zero = 0
6464
exp_format = False

stdlib/numpy/routines.codon

+2-2
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,7 @@ def pad(array, pad_width, mode = 'constant', **kwargs):
26612661
if dtype is int or isinstance(dtype, Int) or isinstance(dtype, UInt):
26622662
return util.cast(util.rint(x), dtype)
26632663
else:
2664-
return x
2664+
return util.cast(x, dtype)
26652665

26662666
def pad_from_function(a: ndarray, pw, padding_func, kwargs, extra = None):
26672667
shape = a.shape
@@ -2915,7 +2915,7 @@ def pad(array, pad_width, mode = 'constant', **kwargs):
29152915
fill_linear(vector,
29162916
offset=(n - p2),
29172917
start=util.cast(end2, float),
2918-
stop=util.cast(start1, float),
2918+
stop=util.cast(start2, float),
29192919
num=p2,
29202920
rev=True)
29212921

0 commit comments

Comments
 (0)