Files
libreoffice/external/python3/python-3.3.3-py17797.patch.1
David Ostrovsky 147cb6a2ae Bump python to 3.5
3.5 release is needed for MSVC 14.0 (aka VS 2015) support. Python 3.5
removed build toolchain support for MSVC 2013. Because we still need
to support it, we duplicate the Python directory in externals and
copy old patches and dispatch to this directory for MSVC 2013. Once
the support for MSVC 2013 is dropped on master, this directory can be
removed again.

Change-Id: Idf7bc351239582f583ecbdb53c923cbdcf968089
Reviewed-on: https://gerrit.libreoffice.org/17352
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2015-10-25 08:29:39 +00:00

50 lines
1.5 KiB
Groff

http://bugs.python.org/issue17797
http://connect.microsoft.com/VisualStudio/feedback/details/785119/
Visual Studio 2013 changed return value for fileno function that breaks
when python tries to check/setup stdin/out/err
GetStdHandle on Windows XP behaves contrary to the documentation...
MSVC 14.0 fixed this bug.
diff -ru python3.orig/Python/pylifecycle.c python3/Python/pylifecycle.c
--- python3.orig/Python/pylifecycle.c 2015-07-05 18:50:08.000000000 +0200
+++ python3/Python/pylifecycle.c 2015-07-26 20:01:23.563082638 +0200
@@ -1065,15 +1065,30 @@
static int
is_valid_fd(int fd)
{
- int dummy_fd;
if (fd < 0 || !_PyVerify_fd(fd))
return 0;
- _Py_BEGIN_SUPPRESS_IPH
- dummy_fd = dup(fd);
- if (dummy_fd >= 0)
- close(dummy_fd);
- _Py_END_SUPPRESS_IPH
- return dummy_fd >= 0;
+
+#if defined(MS_WINDOWS) && defined(HAVE_FSTAT) && defined(_MSC_VER) && (_MSC_VER >= 1700 && _MSC_VER < 1900)
+ /* dup (DuplicateHandle) doesn't say fd is a valid *file* handle.
+ * It could be a current thread pseudo-handle.
+ */
+ {
+ struct stat buf;
+ if (fstat(fd, &buf) < 0 && (errno == EBADF || errno == ENOENT))
+ return 0;
+ else
+ return 1;
+ }
+#else
+ {
+ int dummy_fd = dup(fd);
+ _Py_BEGIN_SUPPRESS_IPH
+ if (dummy_fd >= 0)
+ close(dummy_fd);
+ _Py_END_SUPPRESS_IPH
+ return dummy_fd >= 0;
+ }
+#endif
}
/* Initialize sys.stdin, stdout, stderr and builtins.open */