Turns out it's a VM related problem. I was running my Python code on a VM, but when I copy the same code to a physical machinse running the same Windows edition, the problem disappears.
As I'm totally unfamiliar with VM mechanisms, it would be great if someone can explain why such a problem exists in VM.