Skip to content

Commit

Permalink
Merge branch 'main-dev' of https://github.com/ashvardanian/Stringzilla
Browse files Browse the repository at this point in the history
…into main-dev
  • Loading branch information
ashvardanian committed Dec 7, 2023
2 parents 1cc9ca0 + ebc873e commit f1b48b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2
2.0.3
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stringzilla",
"version": "2.0.2",
"version": "2.0.3",
"description": "Crunch multi-gigabyte strings with ease",
"author": "Ash Vardanian",
"license": "Apache 2.0",
Expand Down
11 changes: 9 additions & 2 deletions python/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ static void File_dealloc(File *self) {
static PyObject *File_new(PyTypeObject *type, PyObject *positional_args, PyObject *named_args) {
File *self;
self = (File *)type->tp_alloc(type, 0);
if (self == NULL) return NULL;
if (self == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Couldn't allocate the file handle!");
return NULL;
}

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
self->file_handle = NULL;
Expand All @@ -383,6 +386,7 @@ static PyObject *File_new(PyTypeObject *type, PyObject *positional_args, PyObjec
#endif
self->start = NULL;
self->length = 0;
return (PyObject *)self;
}

static int File_init(File *self, PyObject *positional_args, PyObject *named_args) {
Expand Down Expand Up @@ -545,7 +549,10 @@ static int Str_init(Str *self, PyObject *args, PyObject *kwargs) {
static PyObject *Str_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
Str *self;
self = (Str *)type->tp_alloc(type, 0);
if (!self) return NULL;
if (!self) {
PyErr_SetString(PyExc_RuntimeError, "Couldn't allocate a Str handle!");
return NULL;
}

self->parent = NULL;
self->start = NULL;
Expand Down

0 comments on commit f1b48b9

Please sign in to comment.