c
CPython exposes its version number in the following macros. Note that these correspond to the version code is built with, not necessarily the version used at run time.
See stable
for a discussion of API and ABI stability across versions.
All the given macros are defined in Include/patchlevel.h
.