Skip to content

Commit

Permalink
BUG: Add a new flag to nditer to indicate when op uses buffering
Browse files Browse the repository at this point in the history
Thouis tracked down an intermittently occurring bug in
ticket numpy#2144, where a reduction under certain situations
would produce wrong results. This occurs when the array
data and the nditer's buffer happen to be adjacent in
memory.

This fixes it by replacing the "clever" trick of checking if
the iterator's pointer is in the buffer with an explicit
flag to signal buffer usage. The reason this can't be reliably
handled via the pointer/buffer check is that the pointer updates
are handled by the consumer of the iterator, who may update
them in place or may use local variables instead. Thus, the
pointer could still point to the beginning of the buffer, or
could point at the byte immediately after the buffer. Using
a flag avoids all of this and should be reliable.
  • Loading branch information
mwiebe committed May 28, 2012
1 parent dabe9ab commit 4542c43
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 147 deletions.
Loading

0 comments on commit 4542c43

Please sign in to comment.