Python provides memory safety by default, so low-level security vulnerabilities are rare and typically needs fixing the Python interpreter or standard library itself.
Other sections with Python-specific advice include:
Some areas of the standard library, notably the
ctypes
module, do not provide memory safety
guarantees comparable to the rest of Python. If such
functionality is used, the advice in [sect-Defensive_Coding-C-Language] should be followed.
The following Python functions and statements related to code execution should be avoided:
compile
eval
exec
execfile
If you need to parse integers or floating point values, use the
int
and float
functions instead of eval
. Sandboxing
untrusted Python code does not work reliably.