Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
heitzmann committed Dec 17, 2022
2 parents 8dd6770 + 798a34c commit aa3f133
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 21 deletions.
15 changes: 9 additions & 6 deletions python/cell_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ static void cell_object_dealloc(CellObject* self) {
Cell* cell = self->cell;
if (cell) {
for (uint64_t i = 0; i < cell->polygon_array.count; i++)
Py_DECREF(cell->polygon_array[i]->owner);
Py_XDECREF(cell->polygon_array[i]->owner);
for (uint64_t i = 0; i < cell->reference_array.count; i++)
Py_DECREF(cell->reference_array[i]->owner);
Py_XDECREF(cell->reference_array[i]->owner);
for (uint64_t i = 0; i < cell->flexpath_array.count; i++)
Py_DECREF(cell->flexpath_array[i]->owner);
Py_XDECREF(cell->flexpath_array[i]->owner);
for (uint64_t i = 0; i < cell->robustpath_array.count; i++)
Py_DECREF(cell->robustpath_array[i]->owner);
Py_XDECREF(cell->robustpath_array[i]->owner);
for (uint64_t i = 0; i < cell->label_array.count; i++)
Py_DECREF(cell->label_array[i]->owner);
Py_XDECREF(cell->label_array[i]->owner);
cell->clear();
free_allocation(cell);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int cell_object_init(CellObject* self, PyObject* args, PyObject* kwds) {
Expand Down Expand Up @@ -60,6 +60,9 @@ static int cell_object_init(CellObject* self, PyObject* args, PyObject* kwds) {
cell->name = copy_string(name, &len);
cell->owner = self;
if (len <= 1) {
free_allocation(cell->name);
free_allocation(cell);
self->cell = NULL;
PyErr_SetString(PyExc_ValueError, "Empty cell name.");
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion python/curve_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void curve_object_dealloc(CurveObject* self) {
self->curve->clear();
free_allocation(self->curve);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int curve_object_init(CurveObject* self, PyObject* args, PyObject* kwds) {
Expand Down
2 changes: 1 addition & 1 deletion python/flexpath_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void flexpath_cleanup(FlexPathObject* self) {

static void flexpath_object_dealloc(FlexPathObject* self) {
if (self->flexpath) flexpath_cleanup(self);
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int flexpath_object_init(FlexPathObject* self, PyObject* args, PyObject* kwds) {
Expand Down
2 changes: 1 addition & 1 deletion python/gdswriter_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static PyObject* gdswriter_object_str(GdsWriterObject* self) {

static void gdswriter_object_dealloc(GdsWriterObject* self) {
free_allocation(self->gdswriter);
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int gdswriter_object_init(GdsWriterObject* self, PyObject* args, PyObject* kwds) {
Expand Down
2 changes: 1 addition & 1 deletion python/label_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void label_object_dealloc(LabelObject* self) {
self->label->clear();
free_allocation(self->label);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int label_object_init(LabelObject* self, PyObject* args, PyObject* kwds) {
Expand Down
6 changes: 3 additions & 3 deletions python/library_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ static void library_object_dealloc(LibraryObject* self) {
Library* library = self->library;
if (library) {
for (uint64_t i = 0; i < library->cell_array.count; i++)
Py_DECREF(library->cell_array[i]->owner);
Py_XDECREF(library->cell_array[i]->owner);
for (uint64_t i = 0; i < library->rawcell_array.count; i++)
Py_DECREF(library->rawcell_array[i]->owner);
Py_XDECREF(library->rawcell_array[i]->owner);
library->clear();
free_allocation(library);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int library_object_init(LibraryObject* self, PyObject* args, PyObject* kwds) {
Expand Down
2 changes: 1 addition & 1 deletion python/polygon_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static void polygon_object_dealloc(PolygonObject* self) {
self->polygon->clear();
free_allocation(self->polygon);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int polygon_object_init(PolygonObject* self, PyObject* args, PyObject* kwds) {
Expand Down
2 changes: 1 addition & 1 deletion python/rawcell_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static void rawcell_object_dealloc(RawCellObject* self) {
rawcell->clear();
free_allocation(rawcell);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int rawcell_object_init(RawCellObject* self, PyObject* args, PyObject* kwds) {
Expand Down
8 changes: 5 additions & 3 deletions python/reference_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ static void reference_object_dealloc(ReferenceObject* self) {
Reference* reference = self->reference;
if (reference) {
if (reference->type == ReferenceType::Cell) {
Py_DECREF(reference->cell->owner);
Py_XDECREF(reference->cell->owner);
} else if (reference->type == ReferenceType::RawCell) {
Py_DECREF(reference->rawcell->owner);
Py_XDECREF(reference->rawcell->owner);
}
reference->clear();
free_allocation(reference);
}
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int reference_object_init(ReferenceObject* self, PyObject* args, PyObject* kwds) {
Expand Down Expand Up @@ -79,6 +79,8 @@ static int reference_object_init(ReferenceObject* self, PyObject* args, PyObject
reference->name = (char*)allocate(++len);
memcpy(reference->name, name, len);
} else {
free_allocation(reference);
self->reference = NULL;
PyErr_SetString(PyExc_TypeError, "Argument cell must be a Cell, RawCell, or string.");
return -1;
}
Expand Down
3 changes: 1 addition & 2 deletions python/repetition_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ static PyObject* repetition_object_str(RepetitionObject* self) {
static void repetition_object_dealloc(RepetitionObject* self) {
Repetition repetition = self->repetition;
repetition.clear();

PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int repetition_object_init(RepetitionObject* self, PyObject* args, PyObject* kwds) {
Expand Down
2 changes: 1 addition & 1 deletion python/robustpath_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static void robustpath_cleanup(RobustPathObject* self) {

static void robustpath_object_dealloc(RobustPathObject* self) {
if (self->robustpath) robustpath_cleanup(self);
PyObject_Del(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static int robustpath_object_init(RobustPathObject* self, PyObject* args, PyObject* kwds) {
Expand Down

0 comments on commit aa3f133

Please sign in to comment.