Frame update bug after updating my MacOS to Sonoma

Hello everyone, I’ve encountered a problem. After updating my MacOS from Monterey to Sonoma, I’ve been experiencing issues with screen refresh.

Here’s an example:

from psychopy import core, visual, event

#create window

win = visual.Window(fullscr = False, size = [1920,1080], color = [-1,-1,-1],
units = “pix”, waitBlanking = True, screen = 0)

timer = core.Clock()
timer.reset()

for f in range(600):
win.flip()

t = timer.getTime()
print(t)

event.waitKeys()

win.close()
core.quit()

My screen refresh rate is 60hz, so theoretically, the part where it prints (t) should be around 10 seconds. However, I continue to get about half of the time (5s). Looking at another one of my experimental scripts, the animations also seem to be overall accelerated. I suspect half of the frames are being skipped since the refresh rate of monitor can’t be changed.
Why is this happening?