Files
loongoffice/external/python3/init-sys-streams-cant-initialize-stdin.patch.0
Xisco Fauli 19e9e49bda python3: upgrade to 3.9.19
Downloaded from https://www.python.org/ftp/python/3.9.19/Python-3.9.19.tar.xz

* python-3.8-msvc-sdk.patch.1 is no longer needed

* Comment out deprecated warnings for now:
C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/pyuno/source/module/pyuno_util.cxx(42): error C2220: the following warning is treated as an error
C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/pyuno/source/module/pyuno_util.cxx(42): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3
C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/pyuno/source/module/pyuno_util.cxx(64): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3

Change-Id: Iaa358ffaaea63cf6ec47914759d0469e70e1cc65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168551
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2024-06-11 11:48:44 +02:00

44 lines
1.8 KiB
Plaintext

--- Python/pylifecycle.c 2024-03-27 14:34:43.905367358 +0000
+++ Python/pylifecycle.c 2024-03-27 14:40:16.339134322 +0000
@@ -1789,6 +1789,20 @@
if (!is_valid_fd(fd))
Py_RETURN_NONE;
+ /* Check that stdin, etc is not a directory
+ Using shell redirection, you can redirect stdin to a directory,
+ crashing the Python interpreter. Catch this common mistake here
+ and output a useful error message. Note that under MS Windows,
+ the shell already prevents that. */
+#ifndef MS_WINDOWS
+ struct _Py_stat_struct sb;
+ if (_Py_fstat_noraise(fd, &sb) == 0 &&
+ S_ISDIR(sb.st_mode)) {
+ // "name" is a directory, cannot continue
+ Py_RETURN_NONE;
+ }
+#endif
+
/* stdin is always opened in buffered mode, first because it shouldn't
make a difference in common use cases, second because TextIOWrapper
depends on the presence of a read1() method which only exists on
@@ -1971,19 +1971,6 @@
PyStatus res = _PyStatus_OK();
const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
- /* Check that stdin is not a directory
- Using shell redirection, you can redirect stdin to a directory,
- crashing the Python interpreter. Catch this common mistake here
- and output a useful error message. Note that under MS Windows,
- the shell already prevents that. */
-#ifndef MS_WINDOWS
- struct _Py_stat_struct sb;
- if (_Py_fstat_noraise(fileno(stdin), &sb) == 0 &&
- S_ISDIR(sb.st_mode)) {
- return _PyStatus_ERR("<stdin> is a directory, cannot continue");
- }
-#endif
-
/* Hack to avoid a nasty recursion issue when Python is invoked
in verbose mode: pre-import the Latin-1 and UTF-8 codecs */
if ((m = PyImport_ImportModule("encodings.utf_8")) == NULL) {