Skip to content

Commit

Permalink
accept some review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
nrnhines committed Sep 10, 2024
1 parent c1d7fae commit 0054ed7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/nrnpython/nrn_metaclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PyObject* nrn_type_from_metaclass(PyTypeObject* metaclass,
PyObject* result = PyType_GenericAlloc(metaclass, 0);
if (!temp || !result) {
// fail("nanobind::detail::nb_type_new(\"%s\"): type construction failed!", t->name);
return NULL;
return nullptr;
}
PyHeapTypeObject* ht = (PyHeapTypeObject*) result;
PyTypeObject* tp = &ht->ht_type;
Expand Down Expand Up @@ -66,7 +66,7 @@ PyObject* nrn_type_from_metaclass(PyTypeObject* metaclass,
PyObject* module_name = PyUnicode_FromString("hoc");
if (PyObject_SetAttrString(result, "__module__", module_name) < 0) {
Py_DECREF(module_name);
return NULL;
return nullptr;
}
Py_DECREF(module_name);
#endif
Expand Down
14 changes: 7 additions & 7 deletions src/nrnpython/nrnpy_hoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ static PyType_Slot hocclass_slots[] = {{Py_tp_base, nullptr}, // &PyType_Type :
{Py_sq_item, (void*) hocclass_getitem},
{0, NULL}};

static PyType_Spec hocclass_spec = {.name = "hoc.HocClass",
.basicsize = 0, // sizeof(hocclass) fill later
.itemsize = 0,
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE,
.slots = hocclass_slots};
static PyType_Spec hocclass_spec = {"hoc.HocClass",
0, // .basicsize fill later
0, // .itemsize
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE,
hocclass_slots};


bool nrn_chk_data_handle(const neuron::container::data_handle<double>& pd) {
Expand Down Expand Up @@ -3013,7 +3013,7 @@ static PyObject* hocpickle_reduce_safe(PyObject* self, PyObject* args) {
static PyObject* hocpickle_setstate(PyObject* self, PyObject* args) {
BYTEHEADER
int version = -1;
int size = -1;
int size = 0;
PyObject* rawdata = NULL;
PyObject* endian_data;
PyHocObject* pho = (PyHocObject*) self;
Expand Down Expand Up @@ -3055,7 +3055,7 @@ static PyObject* hocpickle_setstate(PyObject* self, PyObject* args) {
Py_DECREF(rawdata);
return NULL;
}
if (len != size * int(sizeof(double))) {
if (len != Py_ssize_t(size * sizeof(double))) {
PyErr_SetString(PyExc_ValueError, "buffer size does not match array size");
Py_DECREF(rawdata);
return NULL;
Expand Down

0 comments on commit 0054ed7

Please sign in to comment.