python.lang.compatibility.python36.python36-compatibility-Popen1

profile photo of semgrepsemgrep
Author
6,393
Download Count*

the errors argument to Popen is only available on Python 3.6+

Run Locally

Run in CI

Defintion

rules:
  - id: python36-compatibility-Popen1
    pattern: subprocess.Popen(errors=$X, ...)
    message: the `errors` argument to Popen is only available on Python 3.6+
    languages:
      - python
    severity: ERROR
    metadata:
      category: compatibility
      technology:
        - python
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]

Examples

python36.py

import ssl as s2
import subprocess as s1

# ruleid:python36-compatibility-ssl
s2.get_ciphers()

def main():
    # ruleid:python36-compatibility-Popen2
    subprocess.Popen(cmd, encoding="utf-8")
    # ruleid:python36-compatibility-Popen1
    subprocess.Popen(cmd, errors=None)