mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
inline ~PyObject
This commit is contained in:
parent
3edd4aca67
commit
206685a3f6
@ -111,7 +111,11 @@ struct PyObject{
|
|||||||
|
|
||||||
PyObject(Type type) : gc_enabled(true), gc_marked(false), type(type), _attr(nullptr) {}
|
PyObject(Type type) : gc_enabled(true), gc_marked(false), type(type), _attr(nullptr) {}
|
||||||
|
|
||||||
virtual ~PyObject();
|
virtual ~PyObject(){
|
||||||
|
if(_attr == nullptr) return;
|
||||||
|
_attr->~NameDict();
|
||||||
|
pool128_dealloc(_attr);
|
||||||
|
}
|
||||||
|
|
||||||
void _enable_instance_dict() {
|
void _enable_instance_dict() {
|
||||||
_attr = new(pool128_alloc<NameDict>()) NameDict();
|
_attr = new(pool128_alloc<NameDict>()) NameDict();
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
#include "pocketpy/obj.h"
|
#include "pocketpy/obj.h"
|
||||||
|
|
||||||
namespace pkpy{
|
namespace pkpy{
|
||||||
PyObject::~PyObject() {
|
|
||||||
if(_attr == nullptr) return;
|
|
||||||
_attr->~NameDict();
|
|
||||||
pool128_dealloc(_attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Bytes::operator==(const Bytes& rhs) const{
|
bool Bytes::operator==(const Bytes& rhs) const{
|
||||||
if(_size != rhs._size) return false;
|
if(_size != rhs._size) return false;
|
||||||
for(int i=0; i<_size; i++) if(_data[i] != rhs._data[i]) return false;
|
for(int i=0; i<_size; i++) if(_data[i] != rhs._data[i]) return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user