Ticket #798: `piecewise` exposes raw memory

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ticket #798: `piecewise` exposes raw memory

Stéfan van der Walt
Referring to
http://scipy.org/scipy/numpy/ticket/798

`piecewise` uses `empty` to allocate output memory.  If the conditions
do not sufficiently cover the output, then raw memory is returned,
e.g.,

{{{
import numpy as np
np.piecewise([0,1,2],[True,False,False],[1])
}}}

A patch which addresses the issue is available here for review:

http://codereview.appspot.com/1105

Documentation is being updated on the wiki.
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Ticket #798: `piecewise` exposes raw memory

Ondrej Certik
On Wed, May 21, 2008 at 11:30 AM, Stéfan van der Walt <[hidden email]> wrote:

> Referring to
> http://scipy.org/scipy/numpy/ticket/798
>
> `piecewise` uses `empty` to allocate output memory.  If the conditions
> do not sufficiently cover the output, then raw memory is returned,
> e.g.,
>
> {{{
> import numpy as np
> np.piecewise([0,1,2],[True,False,False],[1])
> }}}
>
> A patch which addresses the issue is available here for review:
>
> http://codereview.appspot.com/1105
>
> Documentation is being updated on the wiki.

I'd like to invite everyone to take part in the review. It's fun, it's
just talking, no coding. :)

Ondrej
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Ticket #798: `piecewise` exposes raw memory

Ondrej Certik
On Wed, May 21, 2008 at 11:53 AM, Ondrej Certik <[hidden email]> wrote:

> On Wed, May 21, 2008 at 11:30 AM, Stéfan van der Walt <[hidden email]> wrote:
>> Referring to
>> http://scipy.org/scipy/numpy/ticket/798
>>
>> `piecewise` uses `empty` to allocate output memory.  If the conditions
>> do not sufficiently cover the output, then raw memory is returned,
>> e.g.,
>>
>> {{{
>> import numpy as np
>> np.piecewise([0,1,2],[True,False,False],[1])
>> }}}
>>
>> A patch which addresses the issue is available here for review:
>>
>> http://codereview.appspot.com/1105
>>
>> Documentation is being updated on the wiki.
>
> I'd like to invite everyone to take part in the review. It's fun, it's
> just talking, no coding. :)

Thanks Robert for taking part in the review:

http://codereview.appspot.com/1105/diff/22/122#newcode566

That's the way to go.

Ondrej
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion