13.3. Embedded Python Interpreter¶
The embedded Python3 interpreter is a vanilla version of CPython (the
official Python distribution). The Python environment you get in Keypirinha is
pretty similar to the original one except that some modules have been removed
from the standard library:
The exact version number of the application and the interpreter can be read at the beginning of the log in the Console. Or by typing the following commands in the Console window:
>>> import sys >>> sys.version '3.5.0 (default, Oct 18 2015, 16:49:14) [MSC v.1800 64 bit (AMD64)]'
When started, Keypirinha initializes the embedded Python interpreter and enables
its optimize flag. This is equivalent to running the standard Python command
As a result, the
__debug__ constant is false and
assert statements are
There are some modifications made by Keypirinha that impact the default behavior of Python. All of these modifications are documented in this section.
188.8.131.52. exit() and quit()¶
In its vanilla version, Python offers numerous ways to exit a program. Keypirinha on the other hand is not meant to be shutdown by its plugins and would crash in that case so traps have been installed to avoid that.
As a result, if a plugin calls one of the
_thread.exit(), directly or
NotImplementedError exception is raised instead of the
program being shutdown.
As a side note, may the plugin developer absolutely wishes to crash the application anyway, Python and Keypirinha both offer numerous ways to do that too.
In the Python implementation that Keypirinha embeds, the
map is created at import time and never updated. The
function does not help here because it is just a wrapper around
As a result, a Keypirinha plugin would not be able to read up-to-date environment variables except by requesting the Windows API which is quite tedious in this case.
Keypirinha solves this issue by automatically updating
every time an environment variable has been modified so the plugins always get