This gives us more context about what pack file is problematic. It's useful
to detect issues like mmapping a 0-sized file.
Details
Details
- Reviewers
durham - Group Reviewers
Restricted Project - Commits
- rFBHGXbf081e811913: cdatapack: print path on error
Make sure the code compiles without warnings. Run related tests.
make local rt test-cstore.t
Make sure setup.py specifies C99 so variable length array is available.
Diff Detail
Diff Detail
- Repository
- rFBHGX Facebook Mercurial Extensions
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
| cstore/py-cdatapack.h | ||
|---|---|---|
| 257 | Wondering if something like this would be cleaner: int ret_code = -1;
if (self->handle == NULL) {
PyErr_NoMemory();
} else {
switch (self->handle->status) {
case DATAPACK_HANDLE_OK:
ret_code = 0;
break;
case DATAPACK_HANDLE_VERSION_MISMATCH:
PyErr_Format(PyExc_RuntimeError, "Unsupported version");
break;
default:
PyErr_Format(
PyExc_ValueError,
"Error setting up datapack %s (status=%d)",
data_path,
self->handle->status);
}
}
free(idx_path);
free(data_path);
free(self->handle);
self->handle = NULL;
return ret_code; | |
| cstore/py-cdatapack.h | ||
|---|---|---|
| 257 | Yes. I was just a bit lazy. I think we can use C99 variable length array here so it does not need to be freed explicitly. | |
| cstore/py-cdatapack.h | ||
|---|---|---|
| 245–246 | That would really clean up a lot of this stuff. Great! | |
That would really clean up a lot of this stuff. Great!