File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,7 +178,18 @@ Local<Unsupported> Local<Value>::asUnsupported() const {
178178 throw Exception (" can't cast value as Unsupported" );
179179}
180180
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+ }
182193
183194Local<String> Local<Value>::describe() const { TEMPLATE_NOT_IMPLEMENTED (); }
184195
Original file line number Diff line number Diff line change 2222
2323namespace script ::py_backend {
2424
25- EngineScopeImpl::EngineScopeImpl (PyEngine &, PyEngine *) { gilState_ = PyGILState_Ensure (); }
25+ EngineScopeImpl::EngineScopeImpl (PyEngine &, PyEngine *) : gilState_( PyGILState_Ensure()) { }
2626EngineScopeImpl::~EngineScopeImpl () { PyGILState_Release (gilState_); }
2727
28- ExitEngineScopeImpl::ExitEngineScopeImpl (PyEngine &) { threadState = PyEval_SaveThread (); }
28+ ExitEngineScopeImpl::ExitEngineScopeImpl (PyEngine &) : threadState( PyEval_SaveThread()) { }
2929ExitEngineScopeImpl::~ExitEngineScopeImpl () { PyEval_RestoreThread (threadState); }
3030
3131} // namespace script::py_backend
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ namespace script::py_backend {
2424class PyEngine ;
2525
2626class EngineScopeImpl {
27- PyGILState_STATE gilState_ = PyGILState_UNLOCKED ;
27+ PyGILState_STATE gilState_;
2828
2929 public:
3030 explicit EngineScopeImpl (PyEngine &, PyEngine *);
@@ -33,7 +33,7 @@ class EngineScopeImpl {
3333};
3434
3535class ExitEngineScopeImpl {
36- PyThreadState *threadState = nullptr ;
36+ PyThreadState *threadState;
3737
3838 public:
3939 explicit ExitEngineScopeImpl (PyEngine &);
You can’t perform that action at this time.
0 commit comments