File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,18 @@ Local<Unsupported> Local<Value>::asUnsupported() const {
178
178
throw Exception (" can't cast value as Unsupported" );
179
179
}
180
180
181
- bool Local<Value>::operator ==(const script::Local<script::Value>& other) const { return false ; }
181
+ bool Local<Value>::operator ==(const script::Local<script::Value>& other) const {
182
+ // TODO: nullptr vs None
183
+ auto lhs = val_;
184
+ auto rhs = other.val_ ;
185
+
186
+ // nullptr == nullptr
187
+ if (lhs == nullptr || rhs == nullptr ) {
188
+ return lhs == rhs;
189
+ }
190
+
191
+ return PyObject_RichCompareBool (lhs, rhs, Py_EQ);
192
+ }
182
193
183
194
Local<String> Local<Value>::describe() const { TEMPLATE_NOT_IMPLEMENTED (); }
184
195
Original file line number Diff line number Diff line change 22
22
23
23
namespace script ::py_backend {
24
24
25
- EngineScopeImpl::EngineScopeImpl (PyEngine &, PyEngine *) { gilState_ = PyGILState_Ensure (); }
25
+ EngineScopeImpl::EngineScopeImpl (PyEngine &, PyEngine *) : gilState_( PyGILState_Ensure()) { }
26
26
EngineScopeImpl::~EngineScopeImpl () { PyGILState_Release (gilState_); }
27
27
28
- ExitEngineScopeImpl::ExitEngineScopeImpl (PyEngine &) { threadState = PyEval_SaveThread (); }
28
+ ExitEngineScopeImpl::ExitEngineScopeImpl (PyEngine &) : threadState( PyEval_SaveThread()) { }
29
29
ExitEngineScopeImpl::~ExitEngineScopeImpl () { PyEval_RestoreThread (threadState); }
30
30
31
31
} // namespace script::py_backend
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ namespace script::py_backend {
24
24
class PyEngine ;
25
25
26
26
class EngineScopeImpl {
27
- PyGILState_STATE gilState_ = PyGILState_UNLOCKED ;
27
+ PyGILState_STATE gilState_;
28
28
29
29
public:
30
30
explicit EngineScopeImpl (PyEngine &, PyEngine *);
@@ -33,7 +33,7 @@ class EngineScopeImpl {
33
33
};
34
34
35
35
class ExitEngineScopeImpl {
36
- PyThreadState *threadState = nullptr ;
36
+ PyThreadState *threadState;
37
37
38
38
public:
39
39
explicit ExitEngineScopeImpl (PyEngine &);
You can’t perform that action at this time.
0 commit comments