This rule raises an issue when the exec statement is used.

Why is this an issue?

Use of the exec statement could be dangerous, and should be avoided. Moreover, the exec statement was removed in Python 3.0. Instead, the built-in exec() function can be used.

Use of the exec statement is strongly discouraged for several reasons such as:

Code examples

Noncompliant code example

exec 'print 1' # Noncompliant

Compliant solution

exec('print 1')