Psychopy Coder (and Runner) crashing upon closing graph output produced in Shell

Dear all,

Does anyone know why I might get crashes when running code from shell in PsychoPy 2021 1.4 in Windows 10?
Here is a minimal example for anyone who might want to test.

import matplotlib.pyplot as plt
plt.plot([1, 2])
plt.show()

It runs fine when I run it as a script (green play button), but when I copy-paste it to the Shell, PsychoPy Coder and Runner crash when I close the window with the graphics output. I tried the same on an older installation of PsychoPy (3.2.1) and it works just fine, both as script and in the interactive shell.

I copy-pasted my system info below.

Kind regards,

Peter

PsychoPy 2021.1.4

Paths to files on the system:
userPrefsFile: C:\Users\Peter\AppData\Roaming\psychopy3\userPrefs.cfg
appDataFile: C:\Users\Peter\AppData\Roaming\psychopy3\appData.cfg
demos: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos
appFile: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\PsychoPy.py

System Info:
Operating System: Windows-10-10.0.19041-SP0
Processor: Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
CPU freq (MHz): 2701.0
CPU cores: 2 (physical), 4 (logical)
Installed memory: 17080623104 (Total), 2660057088 (Available)

Python info:
Executable path: C:\Program Files\PsychoPy3\pythonw.exe
Version: 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
(Selected) Installed Packages:
numpy (1.18.1)
scipy (1.4.1)
matplotlib (3.3.0)
pyglet (1.4.11)
PyGLFW [not installed]
pyo 0.9.7
psychtoolbox (3.0.16)
wxPython (4.1.0)

OpenGL Info:
Vendor: Intel
Rendering engine: Intel(R) HD Graphics 4400
OpenGL version: 4.3.0 - Build 20.19.15.4835
Shaders supported: True
(Selected) Extensions:
GL_ARB_multitexture: True
GL_EXT_framebuffer_object: True
GL_ARB_fragment_program: True
GL_ARB_shader_objects: True
GL_ARB_vertex_shader: True
GL_ARB_texture_non_power_of_two: True
GL_ARB_texture_float: True
GL_STEREO: False
max vertices in vertex array: 1048576