Skip to content

Commit 359f2eb

Browse files
committed
Fix file handling
1 parent 01b72ad commit 359f2eb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/file.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ FILE *ftpy_PyFile_Dup(PyObject *file, char *mode, ftpy_offset_t *orig_pos)
4848
{
4949
int fd, fd2;
5050
PyObject *ret, *os;
51-
Py_ssize_t pos;
51+
ftpy_offset_t pos;
5252
FILE *handle;
5353
/* Flush first to ensure things end up in the file in the correct order */
5454
ret = PyObject_CallMethod(file, (char *)"flush", (char *)"");
@@ -121,7 +121,7 @@ int ftpy_PyFile_DupClose(PyObject *file, FILE* handle, ftpy_offset_t orig_pos)
121121
{
122122
int fd;
123123
PyObject *ret;
124-
Py_ssize_t position;
124+
ftpy_offset_t position;
125125

126126
position = ftpy_ftell(handle);
127127
fclose(handle);
@@ -195,12 +195,10 @@ PyObject* ftpy_PyFile_OpenFile(PyObject *filename, const char *mode)
195195

196196
open = PyDict_GetItemString(builtins, "open");
197197
if (open == NULL) {
198-
Py_DECREF(builtins);
199198
PyErr_SetString(PyExc_AttributeError,
200199
"Internal error: could not get open function");
201200
return NULL;
202201
}
203-
Py_DECREF(builtins);
204202

205203
return PyObject_CallFunction(open, "Os", filename, mode);
206204
}

0 commit comments

Comments
 (0)