Skip to content

Commit 3cb7ebc

Browse files
no need for cpython GC compatibility for these
1 parent c0a1af8 commit 3cb7ebc

File tree

5 files changed

+2
-66
lines changed

5 files changed

+2
-66
lines changed

include/JSArrayProxy.hh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,6 @@ public:
164164
*/
165165
static PyObject *JSArrayProxy_clear_method(JSArrayProxy *self);
166166

167-
/**
168-
* @brief .tp_clear method
169-
*
170-
* @param self - The JSArrayProxy
171-
* @return 0 on success
172-
*/
173-
static int JSArrayProxy_clear(JSArrayProxy *self);
174-
175-
/**
176-
* @brief .tp_traverse method
177-
*
178-
* @param self - The JSArrayProxy
179-
* @param visitproc - The function to be applied on each element of the list
180-
* @param arg - The argument to the visit function
181-
* @return 0 on success
182-
*/
183-
static int JSArrayProxy_traverse(JSArrayProxy *self, visitproc visit, void *arg);
184-
185167
/**
186168
* @brief copy method
187169
*

include/JSObjectProxy.hh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,6 @@ public:
8484
*/
8585
static int JSObjectProxy_assign(JSObjectProxy *self, PyObject *key, PyObject *value);
8686

87-
/**
88-
* @brief .tp_traverse method
89-
*
90-
* @param self - The JSObjectProxy
91-
* @param visitproc - The function to be applied on each element of the dict
92-
* @param arg - The argument to the visit function
93-
* @return 0 on success
94-
*/
95-
static int JSObjectProxy_traverse(JSObjectProxy *self, visitproc visit, void *arg);
96-
97-
/**
98-
* @brief clear method
99-
*
100-
* @param self - The JSObjectProxy
101-
* @return 0 on success
102-
*/
103-
static int JSObjectProxy_clear(JSObjectProxy *self);
104-
10587
/**
10688
* @brief Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and other pyobject
10789
*

src/JSArrayProxy.cc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ void JSArrayProxyMethodDefinitions::JSArrayProxy_dealloc(JSArrayProxy *self)
2929
{
3030
self->jsArray->set(nullptr);
3131
delete self->jsArray;
32-
PyObject_GC_UnTrack(self);
3332
Py_TYPE(self)->tp_free((PyObject *)self);
3433
}
3534

@@ -736,17 +735,6 @@ PyObject *JSArrayProxyMethodDefinitions::JSArrayProxy_clear_method(JSArrayProxy
736735
Py_RETURN_NONE;
737736
}
738737

739-
int JSArrayProxyMethodDefinitions::JSArrayProxy_clear(JSArrayProxy *self) {
740-
JS::SetArrayLength(GLOBAL_CX, *(self->jsArray), 0);
741-
return 0;
742-
}
743-
744-
int JSArrayProxyMethodDefinitions::JSArrayProxy_traverse(JSArrayProxy *self, visitproc visit, void *arg) {
745-
// Nothing to be done
746-
// TODO do we need to iterate through the list and call traverse on proxied PyObjects?
747-
return 0;
748-
}
749-
750738
PyObject *JSArrayProxyMethodDefinitions::JSArrayProxy_copy(JSArrayProxy *self) {
751739
JS::Rooted<JS::ValueArray<2>> jArgs(GLOBAL_CX);
752740
jArgs[0].setInt32(0);

src/JSObjectProxy.cc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void JSObjectProxyMethodDefinitions::JSObjectProxy_dealloc(JSObjectProxy *self)
4949
{
5050
self->jsObject->set(nullptr);
5151
delete self->jsObject;
52-
PyObject_GC_UnTrack(self);
5352
Py_TYPE(self)->tp_free((PyObject *)self);
5453
}
5554

@@ -183,17 +182,6 @@ int JSObjectProxyMethodDefinitions::JSObjectProxy_assign(JSObjectProxy *self, Py
183182
return 0;
184183
}
185184

186-
int JSObjectProxyMethodDefinitions::JSObjectProxy_traverse(JSObjectProxy *self, visitproc visit, void *arg) {
187-
// Nothing to be done
188-
// TODO do we need to iterate through the dict and call traverse on proxied PyObjects?
189-
return 0;
190-
}
191-
192-
int JSObjectProxyMethodDefinitions::JSObjectProxy_clear(JSObjectProxy *self) {
193-
JSObjectProxyMethodDefinitions::JSObjectProxy_clear_method(self);
194-
return 0;
195-
}
196-
197185
PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_richcompare(JSObjectProxy *self, PyObject *other, int op)
198186
{
199187
if (op != Py_EQ && op != Py_NE) {

src/modules/pythonmonkey/pythonmonkey.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,8 @@ PyTypeObject JSObjectProxyType = {
104104
.tp_as_mapping = &JSObjectProxy_mapping_methods,
105105
.tp_getattro = (getattrofunc)JSObjectProxyMethodDefinitions::JSObjectProxy_get,
106106
.tp_setattro = (setattrofunc)JSObjectProxyMethodDefinitions::JSObjectProxy_assign,
107-
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DICT_SUBCLASS | Py_TPFLAGS_HAVE_GC,
107+
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DICT_SUBCLASS,
108108
.tp_doc = PyDoc_STR("Javascript Object proxy dict"),
109-
.tp_traverse = (traverseproc)JSObjectProxyMethodDefinitions::JSObjectProxy_traverse,
110-
.tp_clear = (inquiry)JSObjectProxyMethodDefinitions::JSObjectProxy_clear,
111109
.tp_richcompare = (richcmpfunc)JSObjectProxyMethodDefinitions::JSObjectProxy_richcompare,
112110
.tp_iter = (getiterfunc)JSObjectProxyMethodDefinitions::JSObjectProxy_iter,
113111
.tp_methods = JSObjectProxy_methods,
@@ -156,10 +154,8 @@ PyTypeObject JSArrayProxyType = {
156154
.tp_as_sequence = &JSArrayProxy_sequence_methods,
157155
.tp_as_mapping = &JSArrayProxy_mapping_methods,
158156
.tp_getattro = (getattrofunc)JSArrayProxyMethodDefinitions::JSArrayProxy_get,
159-
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_LIST_SUBCLASS | Py_TPFLAGS_HAVE_GC,
157+
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_LIST_SUBCLASS,
160158
.tp_doc = PyDoc_STR("Javascript Array proxy list"),
161-
.tp_traverse = (traverseproc)JSArrayProxyMethodDefinitions::JSArrayProxy_traverse,
162-
.tp_clear = (inquiry)JSArrayProxyMethodDefinitions::JSArrayProxy_clear,
163159
.tp_richcompare = (richcmpfunc)JSArrayProxyMethodDefinitions::JSArrayProxy_richcompare,
164160
.tp_iter = (getiterfunc)JSArrayProxyMethodDefinitions::JSArrayProxy_iter,
165161
.tp_methods = JSArrayProxy_methods,

0 commit comments

Comments
 (0)