mathomatic: fix path in TMP_FILE
[termux-packages] / packages / python / posixmodule.c.patch
index ff00333..afbce08 100644 (file)
-diff -u -r ../Python-3.4.1/Modules/posixmodule.c ./Modules/posixmodule.c
---- ../Python-3.4.1/Modules/posixmodule.c      2014-05-19 07:19:39.000000000 +0200
-+++ ./Modules/posixmodule.c    2014-06-25 21:42:11.191524129 +0200
-@@ -6048,7 +6048,7 @@
-     if (_Py_set_inheritable(master_fd, 0, NULL) < 0)
-         goto posix_error;
--#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC)
-+#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) && !defined(__ANDROID__)
-     ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
-     ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
- #ifndef __hpux
-@@ -9162,7 +9162,12 @@
-    needed definitions in sys/statvfs.h */
- #define _SVID3
- #endif
--#include <sys/statvfs.h>
-+#ifdef __ANDROID__
-+# include <sys/vfs.h>
-+# define statvfs statfs
-+#else
-+# include <sys/statvfs.h>
-+#endif
+https://github.com/python/cpython/commit/50e86033de85294d87b7e942701d456342abde8e
+
+diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
+index e8c15a9473c..5c739180ea6 100644
+--- a/Modules/posixmodule.c
++++ b/Modules/posixmodule.c
+@@ -1927,14 +1927,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
+         return NULL;
  
- static PyObject*
- _pystatvfs_fromstructstatvfs(struct statvfs st) {
-@@ -9178,9 +9183,15 @@
-     PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long) st.f_bavail));
-     PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long) st.f_files));
-     PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong((long) st.f_ffree));
-+#ifdef __ANDROID__
-+    PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_bavail));
-+    PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flags));
-+    PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namelen));
-+#else
-     PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_favail));
-     PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag));
-     PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax));
-+#endif
+     PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));
+-#if defined(HAVE_LARGEFILE_SUPPORT) || defined(MS_WINDOWS)
+     Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(st->st_ino));
+-    PyStructSequence_SET_ITEM(v, 1,
+-                              PyLong_FromUnsignedLongLong(st->st_ino));
+-#else
+-    Py_BUILD_ASSERT(sizeof(unsigned long) >= sizeof(st->st_ino));
+-    PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLong(st->st_ino));
+-#endif
++    PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLongLong(st->st_ino));
+ #ifdef MS_WINDOWS
+     PyStructSequence_SET_ITEM(v, 2, PyLong_FromUnsignedLong(st->st_dev));
  #else
-     PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize));
-     PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize));
-@@ -9194,11 +9205,18 @@
-                               PyLong_FromLongLong((PY_LONG_LONG) st.f_files));
-     PyStructSequence_SET_ITEM(v, 6,
-                               PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree));
-+#ifdef __ANDROID__
-+    PyStructSequence_SET_ITEM(v, 7,
-+                              PyLong_FromLongLong((PY_LONG_LONG) st.b_favail));
-+    PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flags));
-+    PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namelen));
-+#else
-     PyStructSequence_SET_ITEM(v, 7,
-                               PyLong_FromLongLong((PY_LONG_LONG) st.f_favail));
-     PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag));
-     PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax));
+@@ -1948,12 +1942,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
+     PyStructSequence_SET_ITEM(v, 4, _PyLong_FromUid(st->st_uid));
+     PyStructSequence_SET_ITEM(v, 5, _PyLong_FromGid(st->st_gid));
  #endif
-+#endif
-     if (PyErr_Occurred()) {
-         Py_DECREF(v);
-         return NULL;
-@@ -9221,7 +9239,11 @@
-     if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd))
-         return NULL;
-     Py_BEGIN_ALLOW_THREADS
-+#ifdef __ANDROID__
-+    res = fstatfs(fd, &st);
-+#else
-     res = fstatvfs(fd, &st);
-+#endif
-     Py_END_ALLOW_THREADS
-     if (res != 0)
-         return posix_error();
-@@ -9232,7 +9254,13 @@
+-#ifdef HAVE_LARGEFILE_SUPPORT
+-    PyStructSequence_SET_ITEM(v, 6,
+-                              PyLong_FromLongLong((long long)st->st_size));
+-#else
+-    PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong(st->st_size));
+-#endif
++    Py_BUILD_ASSERT(sizeof(long long) >= sizeof(st->st_size));
++    PyStructSequence_SET_ITEM(v, 6, PyLong_FromLongLong(st->st_size));
  
- #if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H)
--#include <sys/statvfs.h>
-+#ifdef __ANDROID__
-+# include <sys/vfs.h>
-+# define statvfs statfs
-+#else
-+# include <sys/statvfs.h>
-+#endif
-+
- PyDoc_STRVAR(posix_statvfs__doc__,
- "statvfs(path)\n\n\
-@@ -9271,7 +9299,11 @@
-             goto exit;
-         }
- #endif
-+#ifdef __ANDROID__
-+        result = fstatfs(path.fd, &st);
-+#else
-         result = fstatvfs(path.fd, &st);
-+#endif
-     }
-     else
+ #if defined(HAVE_STAT_TV_NSEC)
+     ansec = st->st_atim.tv_nsec;
+@@ -11451,11 +11441,8 @@ os_DirEntry_inode_impl(DirEntry *self)
+     Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(self->win32_file_index));
+     return PyLong_FromUnsignedLongLong(self->win32_file_index);
+ #else /* POSIX */
+-#ifdef HAVE_LARGEFILE_SUPPORT
+-    return PyLong_FromLongLong((long long)self->d_ino);
+-#else
+-    return PyLong_FromLong((long)self->d_ino);
+-#endif
++    Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(self->d_ino));
++    return PyLong_FromUnsignedLongLong(self->d_ino);
  #endif
+ }