-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprod.h
More file actions
33 lines (29 loc) · 852 Bytes
/
prod.h
File metadata and controls
33 lines (29 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: Apache-2.0
#ifndef ATOM_PROD_H
#define ATOM_PROD_H
#include "common.h"
#include "non_elementwise_full_dom.h"
static PyObject *py_make_prod(PyObject *self, PyObject *args)
{
(void) self;
PyObject *child_capsule;
if (!PyArg_ParseTuple(args, "O", &child_capsule))
{
return NULL;
}
expr *child = (expr *) PyCapsule_GetPointer(child_capsule, EXPR_CAPSULE_NAME);
if (!child)
{
PyErr_SetString(PyExc_ValueError, "invalid child capsule");
return NULL;
}
expr *node = new_prod(child);
if (!node)
{
PyErr_SetString(PyExc_RuntimeError, "failed to create prod node");
return NULL;
}
expr_retain(node); /* Capsule owns a reference */
return PyCapsule_New(node, EXPR_CAPSULE_NAME, expr_capsule_destructor);
}
#endif /* ATOM_PROD_H */