title: ignore Python SyntaxError coming from `PYTHONWARNINGS="error::Warning`?
body: <p>I'm using <code>PYTHONWARNINGS="error::Warning"</code> to raise exceptions on warnings, but I want to ignore certain such exceptions, which is normally fine. When the exception that results is <code>SyntaxError</code>, I would sometimes like to ignore that but don't know how.</p>
  
  <p>Detailed example:</p>
  
  <pre><code># has_deprecated_syntax.py
  """this becomes invalid: \* """
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>`$PYTHONWARNINGS="error::Warning" python3.6 -c "import     has_deprecated_syntax"
  Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "/Users/davidchudzicki/temp/so/has_deprecated_syntax.py", line 1
      """this becomes invalid: \* """
      ^
  SyntaxError: invalid escape sequence \*
  </code></pre>
  
  <p>These attempts to ignore it both got me the same failure:</p>
  
  <pre><code>PYTHONWARNINGS="error::Warning,default::Warning:has_deprecated_syntax" python3.6 -c "import has_deprecated_syntax" 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>PYTHONWARNINGS="error::Warning,default::SyntaxError" python3.6 -c "import has_deprecated_syntax"
  </code></pre>
  
  <p>For reference, here's what makes me think this is the correct environment setting in general for ignoring warnings from particular modules:</p>
  
  <p>With:</p>
  
  <pre><code># has_warning.py
  import warnings
  warnings.warn("hi")
  </code></pre>
  
  <p>... I get:</p>
  
  <pre><code>$PYTHONWARNINGS="error::Warning" python -c "import has_warning"
  Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "has_warning.py", line 3, in &lt;module&gt;
      warnings.warn("hi")
  UserWarning: hi
  </code></pre>
  
  <p>...which I can ignore with:</p>
  
  <pre><code>$PYTHONWARNINGS="error::Warning,default::Warning:has_warning" python -c 
  "import has_warning"
  has_warning.py:3: UserWarning: hi
    warnings.warn("hi")
  </code></pre>
  
  <p>But it doesn't work for SyntaxError. Is there any way to ignore those from particular modules?</p>
  
  <p>(Note: I've constructed a small example for this question, but the real reason I care is that I want to fail on warnings in continuous integration for package I help with, but I get the <code>SyntaxError</code> from one of our dependencies when I do this.)</p>