<h3 dir="auto">Bug summary</h3>
<p dir="auto">Not sure if this is a Matplotlib bug or not. I am aware that this method is deprecated, but it is currently used in IPython and I assume that it shouldn't restart the terminal.</p>
<p dir="auto">Executing the code in Spyder 5.2.1 with Python 3.9.7, IPython 7.30.1 and Matplotlib 3.5.1 a restart happens on my Windows 10 laptop. Same thing if executed in a standard python prompt (although only the deprecation warnings are shown).</p>
<p dir="auto">On a Linux machine with Python 3.9.7 and IPython 7.29.0 it works (as in not crashing).</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from io import BytesIO
from matplotlib import mathtext
mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">io</span> <span class="pl-k">import</span> <span class="pl-v">BytesIO</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">mathtext</span>
<span class="pl-s1">mathtext</span>.<span class="pl-v">MathTextParser</span>(<span class="pl-s">'bitmap'</span>).<span class="pl-en">to_png</span>(<span class="pl-v">BytesIO</span>(), <span class="pl-s">'$x$'</span>)</pre></div>
<h3 dir="auto">Actual outcome</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:15:42) [MSC v.1916 64 bit (AMD64)]
Type &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.

IPython 7.30.1 -- An enhanced Interactive Python.

from io import BytesIO

from matplotlib import mathtext

mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$'

)
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The to_png function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The to_rgba function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The to_mask function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The MathtextBackendBitmap class was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')


Windows fatal exception: access violation


Main thread:
Current thread 0x00005478 (most recent call first):
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 271 in _get_info
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 150 in get_metrics
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 1162 in _update_metrics
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 1156 in __init__
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 2356 in symbol
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 283 in wrapper
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 844 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4074 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 5186 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4919 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 3828 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4074 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 5186 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4074 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 5186 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4074 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 5186 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4750 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 5186 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 1117 in parse_string
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 2300 in math_string
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 283 in wrapper
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 844 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 3828 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4750 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4851 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 3850 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 4335 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 5186 in parseImpl
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 807 in _parseNoCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 907 in _parseCache
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py&quot;, line 1117 in parse_string
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py&quot;, line 2237 in parse
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py&quot;, line 456 in _parse_cached
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py&quot;, line 435 in parse
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py&quot;, line 483 in to_mask
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_api\deprecation.py&quot;, line 205 in wrapper
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py&quot;, line 509 in to_rgba
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_api\deprecation.py&quot;, line 205 in wrapper
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py&quot;, line 542 in to_png
  File &quot;C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_api\deprecation.py&quot;, line 205 in wrapper
  File &quot;C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py&quot;, line 1 in &lt;module&gt;


Restarting kernel...
 "><pre class="notranslate"><code class="notranslate">Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:15:42) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.30.1 -- An enhanced Interactive Python.

from io import BytesIO

from matplotlib import mathtext

mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$'

)
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The to_png function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The to_rgba function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The to_mask function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')
C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py:1: MatplotlibDeprecationWarning: 
The MathtextBackendBitmap class was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  mathtext.MathTextParser('bitmap').to_png(BytesIO(), '$x$')


Windows fatal exception: access violation


Main thread:
Current thread 0x00005478 (most recent call first):
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 271 in _get_info
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 150 in get_metrics
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 1162 in _update_metrics
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 1156 in __init__
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 2356 in symbol
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 283 in wrapper
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 844 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4074 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 5186 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4919 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 3828 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4074 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 5186 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4074 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 5186 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4074 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 5186 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4750 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 5186 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 1117 in parse_string
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 2300 in math_string
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 283 in wrapper
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 844 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 3828 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4750 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4851 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 3850 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 4335 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 5186 in parseImpl
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 807 in _parseNoCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 907 in _parseCache
  File "C:\Users\Oscar\miniconda3\lib\site-packages\pyparsing\core.py", line 1117 in parse_string
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_mathtext.py", line 2237 in parse
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py", line 456 in _parse_cached
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py", line 435 in parse
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py", line 483 in to_mask
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_api\deprecation.py", line 205 in wrapper
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py", line 509 in to_rgba
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_api\deprecation.py", line 205 in wrapper
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\mathtext.py", line 542 in to_png
  File "C:\Users\Oscar\miniconda3\lib\site-packages\matplotlib\_api\deprecation.py", line 205 in wrapper
  File "C:\Users\Oscar\AppData\Local\Temp/ipykernel_19884/2432144463.py", line 1 in &lt;module&gt;


Restarting kernel...
 
</code></pre></div>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">No restart.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">It worked "last time I tried" which was probably a year ago.</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows 10</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.1</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Python version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">conda</p>
<h3 dir="auto">Bug summary</h3>
<p dir="auto">After updating <code class="notranslate">matplotlib version 3.5.0</code> through <code class="notranslate">conda update</code>, there seem to be some issues using matplotlib in both Spyder and PyCharm, but they show different phenomena. I try to run a simple script using matplotlib (Please check the code in the <code class="notranslate">Code for reproduction</code>), what I see is described below:</p>
<p dir="auto">In Spyder, the phenomena depend on the <code class="notranslate">preferences</code> (settings):<br>
If the <code class="notranslate">Inline Backend</code> is used, the script can be run without any issues. But if the <code class="notranslate">plt.show()</code> is commented, I will not see the figure showing (Normally in Spyder, even without the code <code class="notranslate">plt.show()</code>, the figure should be shown.), and after a while, I see <code class="notranslate">Restarting kernel...</code> in the console.<br>
If the <code class="notranslate">Automatic Backend</code> is used no matter the code <code class="notranslate">plt.show()</code> is commented or not, after the script is run, I can see the figure window popping up, but no figure is shown and the figure window is disappeared after one second around. After that, the <code class="notranslate">Restarting kernel...</code> is shown in the console.</p>
<p dir="auto">In PyCharm:<br>
After the script is run, again I can see the figure window popping up but no figure shown in the window. After around one second, the figure window disappears and the exit code is shown as <code class="notranslate">Process finished with exit code -1073741819 (0xC0000005)</code>. If the code <code class="notranslate">plt.show()</code> is commented, the figure is not shown anymore which is normal while using PyCharm, and the exit code is shown as <code class="notranslate">Process finished with exit code 0</code>.</p>
<p dir="auto">I consider there can be something wrong or bugs within the newest version of matplotlib, or maybe my setting issues. Could anyone help me with this issue?</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib.pyplot as plt

x=np.arange(0,10)
y=np.arange(0,10)

plt.plot(x, y)
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0</span>,<span class="pl-c1">10</span>)
<span class="pl-s1">y</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0</span>,<span class="pl-c1">10</span>)

<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">Spyder:<br>
<code class="notranslate">Restarting kernel...</code></p>
<p dir="auto">PyCharm:<br>
<code class="notranslate">Process finished with exit code -1073741819 (0xC0000005)</code></p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">A figure window with the expected figure shown on it</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows 10</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.0</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">Qt5Agg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">Python 3.8.12</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">conda</p>