mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Merge pull request #1761 from RustPython/coolreader18/random-wasm
Make _random work on wasm
This commit is contained in:
3 files changed
+10
-3
No files matched your search
Generated
+1
@@ -636,6 +636,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Vendored
+7
-1
@@ -41,7 +41,13 @@ from warnings import warn as _warn
|
||||
from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethodType
|
||||
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
|
||||
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
|
||||
from os import urandom as _urandom
|
||||
try:
|
||||
from os import urandom as _urandom
|
||||
except ImportError:
|
||||
# On wasm, _random.Random.random() does give a proper random value, but
|
||||
# we don't have the os module
|
||||
def _urandom(*args, **kwargs):
|
||||
raise NotImplementedError("urandom")
|
||||
from _collections_abc import Set as _Set, Sequence as _Sequence
|
||||
from hashlib import sha512 as _sha512
|
||||
import itertools as _itertools
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@ num-traits = "0.2.8"
|
||||
num-integer = "0.1.41"
|
||||
num-rational = "0.2.2"
|
||||
num-iter = "0.1.39"
|
||||
rand = "0.7"
|
||||
rand = { version = "0.7", features = ["wasm-bindgen"] }
|
||||
rand_core = "0.5"
|
||||
getrandom = "0.1"
|
||||
getrandom = { version = "0.1", features = ["wasm-bindgen"] }
|
||||
log = "0.4"
|
||||
rustpython-derive = {path = "../derive", version = "0.1.1"}
|
||||
rustpython-parser = {path = "../parser", optional = true, version = "0.1.1"}
|
||||
|
||||
Reference in new issue
Block a user