diff --git a/Basic/lib/PDL/Core/pdlapi.c b/Basic/lib/PDL/Core/pdlapi.c index d0a90258f..617c09ad5 100644 --- a/Basic/lib/PDL/Core/pdlapi.c +++ b/Basic/lib/PDL/Core/pdlapi.c @@ -131,13 +131,16 @@ pdl *pdl_scalar(PDL_Anyval anyval) { } pdl *pdl_get_convertedpdl(pdl *old,int type) { - PDLDEBUG_f(printf("pdl_get_convertedpdl\n")); - if(old->datatype == type) return old; - pdl *it = pdl_pdlnew(); - if (!it) return it; - pdl_error PDL_err = pdl_converttypei_new(old,it,type); - if (PDL_err.error) { pdl_destroy(it); return NULL; } - return it; + PDLDEBUG_f(printf("pdl_get_convertedpdl\n")); + if(old->datatype == type) return old; + char was_flowing = (old->state & PDL_DATAFLOW_F); + pdl *it = pdl_pdlnew(); + if (!it) return it; + pdl_error PDL_err = pdl_converttypei_new(old,it,type); + if (PDL_err.error) { pdl_destroy(it); return NULL; } + if (was_flowing) + it->state |= PDL_DATAFLOW_F; + return it; } pdl_error pdl_allocdata(pdl *it) { diff --git a/Basic/t/core.t b/Basic/t/core.t index ad1de999d..b78772745 100644 --- a/Basic/t/core.t +++ b/Basic/t/core.t @@ -803,6 +803,8 @@ my $oneway_slice = $y->slice('0:1'); is "$oneway_slice", '[4 5]'; eval {$oneway_slice .= 11}; isnt $@, '', 'error on assigning into one-way slice'; +my $c = $y->flowing->_convert_int(cdouble->enum); +ok $c->fflows, 'flowing -> converted has "flowing" on'; } my $notouch = sequence(4);