======================================================================
ERROR: test_kde_random (test.test_statistics.TestKDE.test_kde_random) (kernel='gauss')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/buildarea/pull_request.angelico-debian-amd64/build/Lib/test/test_statistics.py", line 2518, in test_kde_random
big_sample = sorted([rand() for i in range(n)])
~~~~^^
File "/root/buildarea/pull_request.angelico-debian-amd64/build/Lib/statistics.py", line 1122, in rand
return choice(data) + h * invcdf(random())
~~~~~~^^^^^^
File "/root/buildarea/pull_request.angelico-debian-amd64/build/Lib/random.py", line 352, in choice
return seq[self._randbelow(len(seq))]
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Random' object is not subscriptable
----------------------------------------------------------------------
changed the title [-]`test_kde_random` spurious failure: "TypeError: 'Random' object is not subscriptable"[/-][+]test_statistics: `test_kde_random` spurious failure: "TypeError: 'Random' object is not subscriptable"[/+]on Mar 5, 2025
It seems clear to me that the failure is unrelated to the PR. I don't generally actively look at regular buildbots unless there's a specific failure, so it's easy to miss things that fail rarely, especially since we retry failures.
In order of decreasing confidence I think:
This is not due to a bug in the PR
This is not due to a bug in the test, statistics module, or random module
This is possibly a bug in specialization, MRO cache, or some other related part of the interpreter core
File "/root/buildarea/pull_request.angelico-debian-amd64/build/Lib/random.py", line 352, in choice
return seq[self._randbelow(len(seq))]
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Random' object is not subscriptable
The failure of line 352 in random.choice() is perplexing. The only way to get this error message is for seq to have been an instance of random.Random; however, if that were true, the prior call to len(seq) inside the brackets would have failed beforehand:
>>> import random
>>> seq = random.Random()
>>> seq[0]
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
seq[0]
TypeError: 'Random' object is not subscriptable
>>> len(seq)
Traceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
len(seq)
TypeError: object of type 'Random' has no len()
Looking at the disassembly of random.Random.choice, the most likely culprit is LOAD_FAST_LOAD_FAST (seq, self) executing as if it has been written LOAD_FAST_LOAD_FAST (self, self):
changed the title [-]test_statistics: `test_kde_random` spurious failure: "TypeError: 'Random' object is not subscriptable"[/-][+]Possible error in LOAD_FAST_LOAD_FAST opcode: test_statistics: `test_kde_random` spurious failure[/+]on Mar 7, 2025
I think this is likely a hardware failure. There are other similar unexplainable failures on that worker recently, but not on the other buildbots, and that machine was undergoing thermal stress testing around the same time. See:
Activity
picnixz commented on Mar 5, 2025
cc @rhettinger
vstinner commented on Mar 5, 2025
That's a build on the pull request #130849
Did you see this error on a regular buildbot build? I don't see test_statistics failures on recent "AMD64 Debian root 3.x" builds.
colesbury commented on Mar 5, 2025
It seems clear to me that the failure is unrelated to the PR. I don't generally actively look at regular buildbots unless there's a specific failure, so it's easy to miss things that fail rarely, especially since we retry failures.
In order of decreasing confidence I think:
rhettinger commented on Mar 6, 2025
File "/root/buildarea/pull_request.angelico-debian-amd64/build/Lib/random.py", line 352, in choice return seq[self._randbelow(len(seq))] ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'Random' object is not subscriptableThe failure of line 352 in random.choice() is perplexing. The only way to get this error message is for seq to have been an instance of random.Random; however, if that were true, the prior call to len(seq) inside the brackets would have failed beforehand:
>>> import random >>> seq = random.Random() >>> seq[0] Traceback (most recent call last): File "<pyshell#24>", line 1, in <module> seq[0] TypeError: 'Random' object is not subscriptable >>> len(seq) Traceback (most recent call last): File "<pyshell#26>", line 1, in <module> len(seq) TypeError: object of type 'Random' has no len()Looking at the disassembly of random.Random.choice, the most likely culprit is LOAD_FAST_LOAD_FAST (seq, self) executing as if it has been written LOAD_FAST_LOAD_FAST (self, self):
8 L1: LOAD_FAST_LOAD_FAST 16 (seq, self) LOAD_ATTR 5 (_randbelow + NULL|self) LOAD_GLOBAL 1 (len + NULL) LOAD_FAST 1 (seq) CALL 1 CALL 1 BINARY_OP 26 ([]) RETURN_VALUEcolesbury commented on Mar 7, 2025
I think this is likely a hardware failure. There are other similar unexplainable failures on that worker recently, but not on the other buildbots, and that machine was undergoing thermal stress testing around the same time. See: