Skip to content

Commit 363a3d8

Browse files
committed
chore(merge): resolve merge conflicts
Co-authored-by: Philippe Laport <[email protected]>
1 parent 6069234 commit 363a3d8

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

include/JSObjectProxy.hh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,25 @@ public:
129129
* @return the string representation (a PyUnicodeObject) on success, NULL on failure
130130
*/
131131
static PyObject *JSObjectProxy_repr(JSObjectProxy *self);
132+
133+
/**
134+
* @brief Set union method
135+
*
136+
* @param self - The JSObjectProxy
137+
* @param other - The other PyObject to be or'd, expected to be dict or JSObjectProxy
138+
* @return PyObject* The resulting new dict
139+
*/
140+
static PyObject *JSObjectProxy_or(JSObjectProxy *self, PyObject *other);
141+
142+
/**
143+
* @brief Set union method, in place
144+
*
145+
* @param self - The JSObjectProxy
146+
* @param other - The other PyObject to be or'd, expected to be dict or JSObjectProxy
147+
* @return PyObject* The resulting new dict, must be same object as self
148+
*/
149+
static PyObject *JSObjectProxy_ior(JSObjectProxy *self, PyObject *other);
150+
132151
};
133152

134153

@@ -146,6 +165,11 @@ static PySequenceMethods JSObjectProxy_sequence_methods = {
146165
.sq_contains = (objobjproc)JSObjectProxyMethodDefinitions::JSObjectProxy_contains
147166
};
148167

168+
static PyNumberMethods JSObjectProxy_number_methods = {
169+
.nb_or = (binaryfunc)JSObjectProxyMethodDefinitions::JSObjectProxy_or,
170+
.nb_inplace_or = (binaryfunc)JSObjectProxyMethodDefinitions::JSObjectProxy_ior
171+
};
172+
149173
/**
150174
* @brief Struct for the JSObjectProxyType, used by all JSObjectProxy objects
151175
*/

src/JSObjectProxy.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include <Python.h>
2323

24+
#include <object.h>
25+
2426
JSContext *GLOBAL_CX; /**< pointer to PythonMonkey's JSContext */
2527

2628
bool keyToId(PyObject *key, JS::MutableHandleId idp) {

src/modules/pythonmonkey/pythonmonkey.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ PyTypeObject JSObjectProxyType = {
7474
.tp_basicsize = sizeof(JSObjectProxy),
7575
.tp_dealloc = (destructor)JSObjectProxyMethodDefinitions::JSObjectProxy_dealloc,
7676
.tp_repr = (reprfunc)JSObjectProxyMethodDefinitions::JSObjectProxy_repr,
77+
.tp_as_number = &JSObjectProxy_number_methods,
7778
.tp_as_sequence = &JSObjectProxy_sequence_methods,
7879
.tp_as_mapping = &JSObjectProxy_mapping_methods,
7980
.tp_getattro = (getattrofunc)JSObjectProxyMethodDefinitions::JSObjectProxy_get,

0 commit comments

Comments
 (0)