42 |
if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|s:__init__", kwlist, |
if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|s:__init__", kwlist, |
43 |
Py_FileSystemDefaultEncoding, &file, &mode)) return -1; |
Py_FileSystemDefaultEncoding, &file, &mode)) return -1; |
44 |
|
|
45 |
self->handle = DBFOpen(file, mode); |
self->handle = DBFOpen(file, mode); |
46 |
|
if (!self->handle) |
47 |
|
{ |
48 |
|
PyErr_SetFromErrnoWithFilename(PyExc_IOError, file); |
49 |
|
} |
50 |
|
|
51 |
PyMem_Free(file); |
PyMem_Free(file); |
|
|
|
52 |
return self->handle ? 0 : -1; |
return self->handle ? 0 : -1; |
53 |
} |
} |
54 |
|
|
457 |
"Record can either be a dictionary in which case the keys are used as field names, " |
"Record can either be a dictionary in which case the keys are used as field names, " |
458 |
"or a sequence that must have an item for every field (length = field_count())"}, |
"or a sequence that must have an item for every field (length = field_count())"}, |
459 |
#if HAVE_UPDATE_HEADER |
#if HAVE_UPDATE_HEADER |
460 |
{"commit", (PyCFunction)dbffile_read_record, METH_NOARGS, |
{"commit", (PyCFunction)dbffile_commit, METH_NOARGS, |
461 |
"commit() -> None"}, |
"commit() -> None"}, |
462 |
#endif |
#endif |
463 |
{NULL} |
{NULL} |