8000 1.10 deprecated removal by charris · Pull Request #5990 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
Next Next commit
DEP,MAINT: Remove deprecated functions from npy_3kcompat.h
These functions npy_PyFile_Dup and npy_PyFile_DupClose do not work
correctly in Python 3. Deprecation messages have been raised in
npy_PyFile_Dup since 1.9 and it is probably best to smoke out any
remaining uses by simply removing the function.
  • Loading branch information
charris committed Jun 21, 2015
commit 5b8ec8915ef5e2fa58824411be4ea1e17736d08a
1 change: 1 addition & 0 deletions doc/release/1.10.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Dropped Support:
* The polytemplate.py file has been removed.
* The _dotblas module is no longer available.
* The testcalcs.py file has been removed.
* npy_PyFile_Dup and npy_PyFile_DupClose have been removed from npy_3kcompat.h.

Future Changes:

Expand Down
45 changes: 0 additions & 45 deletions numpy/core/include/numpy/npy_3kcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,35 +272,8 @@ npy_PyFile_Check(PyObject *file)
return 1;
}

/*
* DEPRECATED DO NOT USE
* use npy_PyFile_DupClose2 instead
* this function will mess ups python3 internal file object buffering
* Close the dup-ed file handle, and seek the Python one to the current position
*/
static NPY_INLINE int
npy_PyFile_DupClose(PyObject *file, FILE* handle)
{
PyObject *ret;
Py_ssize_t position;
position = npy_ftell(handle);
fclose(handle);

ret = PyObject_CallMethod(file, "seek", NPY_SSIZE_T_PYFMT "i", position, 0);
if (ret == NULL) {
return -1;
}
Py_DECREF(ret);
return 0;
}


#else

/* DEPRECATED, DO NOT USE */
#define npy_PyFile_DupClose(f, h) npy_PyFile_DupClose2((f), (h), 0)

/* use these */
static NPY_INLINE FILE *
npy_PyFile_Dup2(PyObject *file,
const char *NPY_UNUSED(mode), npy_off_t *NPY_UNUSED(orig_pos))
Expand All @@ -319,24 +292,6 @@ npy_PyFile_DupClose2(PyObject *NPY_UNUSED(file), FILE* NPY_UNUSED(handle),

#endif

/*
* DEPRECATED, DO NOT USE
* Use npy_PyFile_Dup2 instead.
* This function will mess up python3 internal file object buffering.
* Get a FILE* handle to the file represented by the Python object.
*/
static NPY_INLINE FILE*
npy_PyFile_Dup(PyObject *file, char *mode)
{
npy_off_t orig;
if (DEPRECATE("npy_PyFile_Dup is deprecated, use "
"npy_PyFile_Dup2") < 0) {
return NULL;
}

return npy_PyFile_Dup2(file, mode, &orig);
}

static NPY_INLINE PyObject*
npy_PyFile_OpenFile(PyObject *filename, const char *mode)
{
Expand Down
0