Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed as not planned
Closed as not planned
Description
Bug report
Bug description:
The place that negative indices for lists are offset currently in the free-threaded build can cause data to be returned that never actually resided at that offset (negatively speaking) if the list is modified during the access (either before or after the modification). Is this an issue?
Line 3581 in5326c27
i+=PyList_GET_SIZE(self); |
Reproducer (it will happen eventually):
importreimportthreadingdefins1(b,l):b.wait()l.insert(0,'potato')defget_secret(b,l):b.wait()assertl[-1]!='super secret password'defcheck(funcs,*args):barrier=threading.Barrier(len(funcs))thrds= []forfuncinfuncs:thrd=threading.Thread(target=func,args=(barrier,*args))thrds.append(thrd)thrd.start()forthrdinthrds:thrd.join()if__name__=="__main__":whileTrue:check([ins1]+ [get_secret]*10, ['super secret password','tomato'])
Output:
$ ./python ../check.py Exception in thread Thread-38474 (get_secret):Traceback (most recent call last): File "/home/tom/work/cpython/free/cp/Lib/threading.py", line 1054, in _bootstrap_inner self.run() ~~~~~~~~^^ File "/home/tom/work/cpython/free/cp/Lib/threading.py", line 996, in run self._target(*self._args, **self._kwargs) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/tom/work/cpython/free/cp/../check.py", line 11, in get_secret assert l[-1] != 'super secret password' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError
CPython versions tested on:
3.14
Operating systems tested on:
Linux