mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
Ports: Add initial Python 3.6 port
This port is experimental and not all pythom modules are working. But this is an initial shot which can be further worked on, as SerenityOS gets more mature. :^) The main limitation is that locales, threading and time related functions are not working.
This commit is contained in:
parent
e7affa24dc
commit
71823a6c49
Notes:
sideshowbarker
2024-07-19 11:15:29 +09:00
Author: https://github.com/lnzero1dev Commit: https://github.com/SerenityOS/serenity/commit/71823a6c497 Pull-request: https://github.com/SerenityOS/serenity/pull/763 Reviewed-by: https://github.com/awesomekling ✅ Reviewed-by: https://github.com/bugaevc
8 changed files with 2349 additions and 0 deletions
26
Ports/python-3.6/README.md
Normal file
26
Ports/python-3.6/README.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Python 3.6 Port
|
||||
|
||||
This port is highly experimental. Python binary can be started with `python3`, but many
|
||||
functionality is expected to not work.
|
||||
|
||||
## Why this version is used
|
||||
|
||||
Python 2.7 will not be supported in future, see e.g. [pythonclock.org]([https://link](https://pythonclock.org/)).
|
||||
Python 3 is a good candidate for porting. Until Python 3.6 it is easily possible to disable
|
||||
multi-threading API via `--without-threads` option. This is needed until SerenityOS provides the
|
||||
pthread APIs.
|
||||
|
||||
## How to improve
|
||||
|
||||
Run the Python test suite via `python3 -m test` to see what fails and start working on that.
|
||||
If functionality in LibC/LibM/Kernel/... is updated, recompile Python with `./package.sh build`.
|
||||
|
||||
## Known limitations
|
||||
|
||||
* No locale support, default locale encoding set to utf-8
|
||||
|
||||
* Instead of `/dev/urandom`, `/dev/random` is being used
|
||||
|
||||
* No multi-threading
|
||||
|
||||
* time module not working due to missing time related functions in LibC/Kernel
|
2
Ports/python-3.6/config.site
Normal file
2
Ports/python-3.6/config.site
Normal file
|
@ -0,0 +1,2 @@
|
|||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
11
Ports/python-3.6/package.sh
Executable file
11
Ports/python-3.6/package.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash ../.port_include.sh
|
||||
port=python-3.6
|
||||
version=3.6
|
||||
workdir=Python-3.6.0
|
||||
useconfigure=true
|
||||
configopts="--build=i686 --without-threads --enable-optimizations"
|
||||
makeopts="-j$(nproc) build_all"
|
||||
installopts="-j$(nproc) build_all"
|
||||
files="https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz Python-3.6.0.tar.xz"
|
||||
|
||||
export CONFIG_SITE=$(pwd)/config.site
|
1948
Ports/python-3.6/patches/0001-Adapt-configuration.patch
Normal file
1948
Ports/python-3.6/patches/0001-Adapt-configuration.patch
Normal file
File diff suppressed because it is too large
Load diff
238
Ports/python-3.6/patches/0002-Remove-not-compiling-asserts.patch
Normal file
238
Ports/python-3.6/patches/0002-Remove-not-compiling-asserts.patch
Normal file
|
@ -0,0 +1,238 @@
|
|||
diff --git a/Include/bytearrayobject.h b/Include/bytearrayobject.h
|
||||
index a757b88..e4bf703 100644
|
||||
--- a/Include/bytearrayobject.h
|
||||
+++ b/Include/bytearrayobject.h
|
||||
@@ -49,9 +49,8 @@ PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
|
||||
/* Macros, trading safety for speed */
|
||||
#ifndef Py_LIMITED_API
|
||||
#define PyByteArray_AS_STRING(self) \
|
||||
- (assert(PyByteArray_Check(self)), \
|
||||
- Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string)
|
||||
-#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self))
|
||||
+ (Py_SIZE(self) ? ((PyByteArrayObject*)(self))->ob_start : _PyByteArray_empty_string)
|
||||
+#define PyByteArray_GET_SIZE(self) (Py_SIZE(self))
|
||||
|
||||
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
||||
#endif
|
||||
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
|
||||
index 98e29b6..7432bcd 100644
|
||||
--- a/Include/bytesobject.h
|
||||
+++ b/Include/bytesobject.h
|
||||
@@ -82,9 +82,8 @@ PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
|
||||
|
||||
/* Macro, trading safety for speed */
|
||||
#ifndef Py_LIMITED_API
|
||||
-#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
|
||||
- (((PyBytesObject *)(op))->ob_sval))
|
||||
-#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
|
||||
+#define PyBytes_AS_STRING(op) ((((PyBytesObject*)(op))->ob_sval))
|
||||
+#define PyBytes_GET_SIZE(op) (Py_SIZE(op))
|
||||
#endif
|
||||
|
||||
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
|
||||
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
|
||||
index 8103a63..f0f3e1a 100644
|
||||
--- a/Include/unicodeobject.h
|
||||
+++ b/Include/unicodeobject.h
|
||||
@@ -381,11 +381,9 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
|
||||
on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
|
||||
|
||||
#define PyUnicode_GET_SIZE(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- (((PyASCIIObject *)(op))->wstr) ? \
|
||||
+ ((((PyASCIIObject *)(op))->wstr) ? \
|
||||
PyUnicode_WSTR_LENGTH(op) : \
|
||||
((void)PyUnicode_AsUnicode((PyObject *)(op)), \
|
||||
- assert(((PyASCIIObject *)(op))->wstr), \
|
||||
PyUnicode_WSTR_LENGTH(op)))
|
||||
|
||||
#define PyUnicode_GET_DATA_SIZE(op) \
|
||||
@@ -397,8 +395,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
|
||||
use PyUnicode_WRITE() and PyUnicode_READ(). */
|
||||
|
||||
#define PyUnicode_AS_UNICODE(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- (((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \
|
||||
+ ((((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \
|
||||
PyUnicode_AsUnicode((PyObject *)(op)))
|
||||
|
||||
#define PyUnicode_AS_DATA(op) \
|
||||
@@ -418,9 +415,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
|
||||
string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be
|
||||
ready. */
|
||||
#define PyUnicode_IS_ASCII(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- assert(PyUnicode_IS_READY(op)), \
|
||||
- ((PyASCIIObject*)op)->state.ascii)
|
||||
+ (((PyASCIIObject*)op)->state.ascii)
|
||||
|
||||
/* Return true if the string is compact or 0 if not.
|
||||
No type checks or Ready calls are performed. */
|
||||
@@ -454,9 +449,7 @@ enum PyUnicode_Kind {
|
||||
|
||||
/* Return one of the PyUnicode_*_KIND values defined above. */
|
||||
#define PyUnicode_KIND(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- assert(PyUnicode_IS_READY(op)), \
|
||||
- ((PyASCIIObject *)(op))->state.kind)
|
||||
+ (((PyASCIIObject *)(op))->state.kind)
|
||||
|
||||
/* Return a void pointer to the raw unicode buffer. */
|
||||
#define _PyUnicode_COMPACT_DATA(op) \
|
||||
@@ -465,12 +458,10 @@ enum PyUnicode_Kind {
|
||||
((void*)((PyCompactUnicodeObject*)(op) + 1)))
|
||||
|
||||
#define _PyUnicode_NONCOMPACT_DATA(op) \
|
||||
- (assert(((PyUnicodeObject*)(op))->data.any), \
|
||||
- ((((PyUnicodeObject *)(op))->data.any)))
|
||||
+ (((((PyUnicodeObject *)(op))->data.any)))
|
||||
|
||||
#define PyUnicode_DATA(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) : \
|
||||
+ (PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) : \
|
||||
_PyUnicode_NONCOMPACT_DATA(op))
|
||||
|
||||
/* In the access macros below, "kind" may be evaluated more than once.
|
||||
@@ -517,9 +508,7 @@ enum PyUnicode_Kind {
|
||||
PyUnicode_READ_CHAR, for multiple consecutive reads callers should
|
||||
cache kind and use PyUnicode_READ instead. */
|
||||
#define PyUnicode_READ_CHAR(unicode, index) \
|
||||
- (assert(PyUnicode_Check(unicode)), \
|
||||
- assert(PyUnicode_IS_READY(unicode)), \
|
||||
- (Py_UCS4) \
|
||||
+ ((Py_UCS4) \
|
||||
(PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \
|
||||
((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
||||
(PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \
|
||||
@@ -531,10 +520,8 @@ enum PyUnicode_Kind {
|
||||
/* Returns the length of the unicode string. The caller has to make sure that
|
||||
the string has it's canonical representation set before calling
|
||||
this macro. Call PyUnicode_(FAST_)Ready to ensure that. */
|
||||
-#define PyUnicode_GET_LENGTH(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- assert(PyUnicode_IS_READY(op)), \
|
||||
- ((PyASCIIObject *)(op))->length)
|
||||
+#define PyUnicode_GET_LENGTH(op) \
|
||||
+ (((PyASCIIObject*)(op))->length)
|
||||
|
||||
|
||||
/* Fast check to determine whether an object is ready. Equivalent to
|
||||
@@ -547,16 +534,14 @@ enum PyUnicode_Kind {
|
||||
_PyUnicode_Ready().
|
||||
Returns 0 on success and -1 on errors. */
|
||||
#define PyUnicode_READY(op) \
|
||||
- (assert(PyUnicode_Check(op)), \
|
||||
- (PyUnicode_IS_READY(op) ? \
|
||||
+ ((PyUnicode_IS_READY(op) ? \
|
||||
0 : _PyUnicode_Ready((PyObject *)(op))))
|
||||
|
||||
/* Return a maximum character value which is suitable for creating another
|
||||
string based on op. This is always an approximation but more efficient
|
||||
than iterating over the string. */
|
||||
#define PyUnicode_MAX_CHAR_VALUE(op) \
|
||||
- (assert(PyUnicode_IS_READY(op)), \
|
||||
- (PyUnicode_IS_ASCII(op) ? \
|
||||
+ ((PyUnicode_IS_ASCII(op) ? \
|
||||
(0x7f) : \
|
||||
(PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND ? \
|
||||
(0xffU) : \
|
||||
@@ -924,8 +909,7 @@ _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
|
||||
|
||||
Return 0 on success, raise an exception and return -1 on error. */
|
||||
#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \
|
||||
- (assert((KIND) != PyUnicode_WCHAR_KIND), \
|
||||
- (KIND) <= (WRITER)->kind \
|
||||
+ ((KIND) <= (WRITER)->kind \
|
||||
? 0 \
|
||||
: _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND)))
|
||||
|
||||
diff --git a/Objects/longobject.c b/Objects/longobject.c
|
||||
index ad239ce..678cc7c 100644
|
||||
--- a/Objects/longobject.c
|
||||
+++ b/Objects/longobject.c
|
||||
@@ -17,8 +17,7 @@
|
||||
#endif
|
||||
|
||||
/* convert a PyLong of size 1, 0 or -1 to an sdigit */
|
||||
-#define MEDIUM_VALUE(x) (assert(-1 <= Py_SIZE(x) && Py_SIZE(x) <= 1), \
|
||||
- Py_SIZE(x) < 0 ? -(sdigit)(x)->ob_digit[0] : \
|
||||
+#define MEDIUM_VALUE(x) (Py_SIZE(x) < 0 ? -(sdigit)(x)->ob_digit[0] : \
|
||||
(Py_SIZE(x) == 0 ? (sdigit)0 : \
|
||||
(sdigit)(x)->ob_digit[0]))
|
||||
|
||||
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
|
||||
index 9c998f7..25e36bc 100644
|
||||
--- a/Objects/unicodeobject.c
|
||||
+++ b/Objects/unicodeobject.c
|
||||
@@ -78,17 +78,13 @@ extern "C" {
|
||||
#define _PyUnicode_UTF8(op) \
|
||||
(((PyCompactUnicodeObject*)(op))->utf8)
|
||||
#define PyUnicode_UTF8(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- assert(PyUnicode_IS_READY(op)), \
|
||||
- PyUnicode_IS_COMPACT_ASCII(op) ? \
|
||||
+ (PyUnicode_IS_COMPACT_ASCII(op) ? \
|
||||
((char*)((PyASCIIObject*)(op) + 1)) : \
|
||||
_PyUnicode_UTF8(op))
|
||||
#define _PyUnicode_UTF8_LENGTH(op) \
|
||||
(((PyCompactUnicodeObject*)(op))->utf8_length)
|
||||
#define PyUnicode_UTF8_LENGTH(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- assert(PyUnicode_IS_READY(op)), \
|
||||
- PyUnicode_IS_COMPACT_ASCII(op) ? \
|
||||
+ (PyUnicode_IS_COMPACT_ASCII(op) ? \
|
||||
((PyASCIIObject*)(op))->length : \
|
||||
_PyUnicode_UTF8_LENGTH(op))
|
||||
#define _PyUnicode_WSTR(op) \
|
||||
@@ -102,28 +98,22 @@ extern "C" {
|
||||
#define _PyUnicode_HASH(op) \
|
||||
(((PyASCIIObject *)(op))->hash)
|
||||
#define _PyUnicode_KIND(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- ((PyASCIIObject *)(op))->state.kind)
|
||||
+ (((PyASCIIObject *)(op))->state.kind)
|
||||
#define _PyUnicode_GET_LENGTH(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- ((PyASCIIObject *)(op))->length)
|
||||
+ (((PyASCIIObject *)(op))->length)
|
||||
#define _PyUnicode_DATA_ANY(op) \
|
||||
(((PyUnicodeObject*)(op))->data.any)
|
||||
|
||||
#undef PyUnicode_READY
|
||||
#define PyUnicode_READY(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- (PyUnicode_IS_READY(op) ? \
|
||||
+ ((PyUnicode_IS_READY(op) ? \
|
||||
0 : \
|
||||
_PyUnicode_Ready(op)))
|
||||
|
||||
#define _PyUnicode_SHARE_UTF8(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- assert(!PyUnicode_IS_COMPACT_ASCII(op)), \
|
||||
- (_PyUnicode_UTF8(op) == PyUnicode_DATA(op)))
|
||||
+ ((_PyUnicode_UTF8(op) == PyUnicode_DATA(op)))
|
||||
#define _PyUnicode_SHARE_WSTR(op) \
|
||||
- (assert(_PyUnicode_CHECK(op)), \
|
||||
- (_PyUnicode_WSTR(unicode) == PyUnicode_DATA(op)))
|
||||
+ ((_PyUnicode_WSTR(unicode) == PyUnicode_DATA(op)))
|
||||
|
||||
/* true if the Unicode object has an allocated UTF-8 memory block
|
||||
(not shared with other data) */
|
||||
diff --git a/Python/pytime.c b/Python/pytime.c
|
||||
index 3015a6b..07335d4 100644
|
||||
--- a/Python/pytime.c
|
||||
+++ b/Python/pytime.c
|
||||
@@ -8,8 +8,7 @@
|
||||
#endif
|
||||
|
||||
#define _PyTime_check_mul_overflow(a, b) \
|
||||
- (assert(b > 0), \
|
||||
- (_PyTime_t)(a) < _PyTime_MIN / (_PyTime_t)(b) \
|
||||
+ ((_PyTime_t)(a) < _PyTime_MIN / (_PyTime_t)(b) \
|
||||
|| _PyTime_MAX / (_PyTime_t)(b) < (_PyTime_t)(a))
|
||||
|
||||
/* To millisecond (10^-3) */
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
diff --git a/Modules/main.c b/Modules/main.c
|
||||
index d75f64a..143a452 100644
|
||||
--- a/Modules/main.c
|
||||
+++ b/Modules/main.c
|
||||
@@ -557,8 +557,8 @@ Py_Main(int argc, wchar_t **argv)
|
||||
Py_FatalError(
|
||||
"not enough memory to copy PYTHONWARNINGS");
|
||||
strcpy(buf, p);
|
||||
- oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
- setlocale(LC_ALL, "");
|
||||
+ //oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
+ //setlocale(LC_ALL, "");
|
||||
for (p = strtok(buf, ","); p != NULL; p = strtok(NULL, ",")) {
|
||||
#ifdef __APPLE__
|
||||
/* Use utf-8 on Mac OS X */
|
||||
@@ -574,8 +574,8 @@ Py_Main(int argc, wchar_t **argv)
|
||||
PySys_AddWarnOptionUnicode(unicode);
|
||||
Py_DECREF(unicode);
|
||||
}
|
||||
- setlocale(LC_ALL, oldloc);
|
||||
- PyMem_RawFree(oldloc);
|
||||
+ //setlocale(LC_ALL, oldloc);
|
||||
+ //PyMem_RawFree(oldloc);
|
||||
PyMem_RawFree(buf);
|
||||
}
|
||||
#endif
|
||||
diff --git a/Programs/python.c b/Programs/python.c
|
||||
index a7afbc7..07fcbe0 100644
|
||||
--- a/Programs/python.c
|
||||
+++ b/Programs/python.c
|
||||
@@ -43,17 +43,17 @@ main(int argc, char **argv)
|
||||
fedisableexcept(FE_OVERFLOW);
|
||||
#endif
|
||||
|
||||
- oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
- if (!oldloc) {
|
||||
- fprintf(stderr, "out of memory\n");
|
||||
- return 1;
|
||||
- }
|
||||
+ // oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
+ // if (!oldloc) {
|
||||
+ // fprintf(stderr, "out of memory\n");
|
||||
+ // return 1;
|
||||
+ // }
|
||||
|
||||
- setlocale(LC_ALL, "");
|
||||
+ // setlocale(LC_ALL, "");
|
||||
for (i = 0; i < argc; i++) {
|
||||
argv_copy[i] = Py_DecodeLocale(argv[i], NULL);
|
||||
if (!argv_copy[i]) {
|
||||
- PyMem_RawFree(oldloc);
|
||||
+ //PyMem_RawFree(oldloc);
|
||||
fprintf(stderr, "Fatal Python error: "
|
||||
"unable to decode the command line argument #%i\n",
|
||||
i + 1);
|
||||
@@ -63,8 +63,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
argv_copy2[argc] = argv_copy[argc] = NULL;
|
||||
|
||||
- setlocale(LC_ALL, oldloc);
|
||||
- PyMem_RawFree(oldloc);
|
||||
+ //setlocale(LC_ALL, oldloc);
|
||||
+ //PyMem_RawFree(oldloc);
|
||||
|
||||
res = Py_Main(argc, argv_copy);
|
||||
|
||||
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
|
||||
index a4f7f82..823372f 100644
|
||||
--- a/Python/pylifecycle.c
|
||||
+++ b/Python/pylifecycle.c
|
||||
@@ -238,6 +238,8 @@ get_locale_encoding(void)
|
||||
return get_codec_name(codeset);
|
||||
#elif defined(__ANDROID__)
|
||||
return get_codec_name("UTF-8");
|
||||
+#elif defined(__serenity__)
|
||||
+ return get_codec_name("UTF-8");
|
||||
#else
|
||||
PyErr_SetNone(PyExc_NotImplementedError);
|
||||
return NULL;
|
||||
--
|
||||
2.17.1
|
||||
|
26
Ports/python-3.6/patches/0004-Remove-wrong-ifdef.patch
Normal file
26
Ports/python-3.6/patches/0004-Remove-wrong-ifdef.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff --git a/Python/pytime.c b/Python/pytime.c
|
||||
index 07335d4..50d676a 100644
|
||||
--- a/Python/pytime.c
|
||||
+++ b/Python/pytime.c
|
||||
@@ -225,7 +225,7 @@ _PyTime_FromNanoseconds(long long ns)
|
||||
return t;
|
||||
}
|
||||
|
||||
-#ifdef HAVE_CLOCK_GETTIME
|
||||
+
|
||||
static int
|
||||
_PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts, int raise)
|
||||
{
|
||||
@@ -247,7 +247,8 @@ _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts, int raise)
|
||||
*tp = t;
|
||||
return res;
|
||||
}
|
||||
-#elif !defined(MS_WINDOWS)
|
||||
+
|
||||
+#if !defined(MS_WINDOWS)
|
||||
static int
|
||||
_PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv, int raise)
|
||||
{
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/Python/random.c b/Python/random.c
|
||||
index 46e3bb5..a4a7136 100644
|
||||
--- a/Python/random.c
|
||||
+++ b/Python/random.c
|
||||
@@ -316,7 +316,7 @@ dev_urandom(char *buffer, Py_ssize_t size, int blocking, int raise)
|
||||
} while (0 < size);
|
||||
}
|
||||
else {
|
||||
- fd = _Py_open_noraise("/dev/urandom", O_RDONLY);
|
||||
+ fd = _Py_open_noraise("/dev/random", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Reference in a new issue