diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-10 14:15:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 14:15:14 (GMT) |
commit | 00d7cd8ab8db2c1e1f591ade828f88a1a973d70f (patch) | |
tree | 9de12914f0f8d11ef0d776e3d6f5906e84675541 /Modules | |
parent | 8510f430781118d9b603c3a2f06945d6ebc5fe42 (diff) | |
download | cpython-00d7cd8ab8db2c1e1f591ade828f88a1a973d70f.zip cpython-00d7cd8ab8db2c1e1f591ade828f88a1a973d70f.tar.gz cpython-00d7cd8ab8db2c1e1f591ade828f88a1a973d70f.tar.bz2 |
bpo-38075: Fix random_seed(): use PyObject_CallOneArg() (GH-18897)
Fix the random.Random.seed() method when a bool is passed as the
seed.
PyObject_Vectorcall() was misused: use PyObject_CallOneArg() instead.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_randommodule.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index f0fdb03..7a88718 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -264,7 +264,6 @@ random_seed(RandomObject *self, PyObject *arg) uint32_t *key = NULL; size_t bits, keyused; int res; - PyObject *args[1]; if (arg == NULL || arg == Py_None) { if (random_seed_urandom(self) < 0) { @@ -286,9 +285,7 @@ random_seed(RandomObject *self, PyObject *arg) } else if (PyLong_Check(arg)) { /* Calling int.__abs__() prevents calling arg.__abs__(), which might return an invalid value. See issue #31478. */ - args[0] = arg; - n = PyObject_Vectorcall(_randomstate_global->Long___abs__, args, 0, - NULL); + n = PyObject_CallOneArg(_randomstate_global->Long___abs__, arg); } else { Py_hash_t hash = PyObject_Hash(arg); |