[Numpy-discussion] Merge of date-time branch completed

Robert Kern robert.kern@gmail....
Fri Aug 28 15:23:20 CDT 2009

On Fri, Aug 28, 2009 at 10:39, Charles R
Harris<charlesr.harris@gmail.com> wrote:

> What does UFUNC_OBJ_NEEDS_API do?

It specifies that the ufunc loops need access to the Python C API, so
the dispatcher should not release the GIL before running the loop.

> Hmm, "can also have an additional key called "metadata" which can be any
> dictionary", is this new functionality? What does it do?

It adds a dictionary to the dtype. This can potentially be used for a
couple of applications, but here is used to hold the datetime
frequency information.

> There are a lot of changes like this : !(loop->obj & UFUNC_OBJ_ISOBJECT).
> What is the meaning of UFUNC_OBJ_ISOBJECT and why is this test necessary?

Previously, loop->obj was an int, but only took 0 or 1 to specify that
the ufunc loop was for object dtypes. This was used for two distinct
things: reference counting and keeping hold of the GIL. The datetime
loops require the latter but not the former. loop->obj is now a bitset
UFUNC_OBJ_ISOBJECT|UFUNC_OBJ_NEEDS_API. The tests were modified to
test for the most specific required flag(s) for the particular
operation it was going to do.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the NumPy-Discussion mailing list