forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListType.cc
More file actions
25 lines (20 loc) · 735 Bytes
/
ListType.cc
File metadata and controls
25 lines (20 loc) · 735 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
/**
* @file ListType.cc
* @author Caleb Aikens (caleb@distributive.network), Giovanni Tedesco (giovanni@distributive.network) and Philippe Laporte (philippe@distributive.network)
* @brief Struct for representing python lists
* @date 2022-08-18
*
* @copyright Copyright (c) 2022, 2023, 2024 Distributive Corp
*
*/
#include "include/ListType.hh"
#include "include/JSArrayProxy.hh"
PyObject *ListType::getPyObject(JSContext *cx, JS::HandleObject jsArrayObj) {
JSArrayProxy *proxy = (JSArrayProxy *)PyObject_CallObject((PyObject *)&JSArrayProxyType, NULL);
if (proxy != NULL) {
proxy->jsArray = new JS::PersistentRootedObject(cx);
proxy->jsArray->set(jsArrayObj);
return (PyObject *)proxy;
}
return NULL;
}