Bug report
Bug description:
rlocktesting.py:
from_threadimportstart_new_thread,RLockfromselectimportselectfromosimportwritefromsignalimportsignal,SIGALRM,alarmlock=RLock()
defthreadfunc():
write(1,b"thread: trying to acquire lock\n")
lock.acquire()
write(1,b"thread: acquired lock and doing unrelated stuff for 3 seconds\n")
select((),(),(),3)
write(1,b"thread: trying to release lock\n")
lock.release()
write(1,b"thread: released lock\n")
defSIGALRMhandler(signum,frame):
write(1,b"SIGALRM: trying to acquire lock\n")
lock.acquire()
write(1,b"SIGALRM: acquired lock, returning\n")
signal(SIGALRM,SIGALRMhandler)
start_new_thread(threadfunc,())
alarm(2)
write(1,b"main: doing unrelated stuff for 1 second\n")
select((),(),(),1)
write(1,b"main: trying to acquire lock\n")
lock.acquire()#global scopewrite(1,b"main: acquired lock\nEND OF USELESS PROGRAM\n")
running:
$ python3 rlocktesting.pymain: doing unrelated stuff for 1 secondthread: trying to acquire lockthread: acquired lock and doing unrelated stuff for 3 secondsmain: trying to acquire lockSIGALRM: trying to acquire lockthread: trying to release lockthread: released lockSIGALRM: acquired lock, returning
it gets stuck forever, pressing ctrl+c:
^CTraceback (most recent call last): File "/tmp/rlocktesting.py", line 28, in <module> lock.acquire()#global scope ~~~~~~~~~~~~^^KeyboardInterrupt
I excpeted main thread to successfully acquire lock twice (first inside SIGALRMhandler, second continuing inside global scope)
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
rlocktesting.py:running:
it gets stuck forever, pressing ctrl+c:
I excpeted main thread to successfully acquire lock twice (first inside
SIGALRMhandler, second continuing inside global scope)CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs