getversion.c 552 B

1234567891011121314151617181920212223242526272829
  1. /* Return the full version string. */
  2. #include "Python.h"
  3. #include "patchlevel.h"
  4. static int initialized = 0;
  5. static char version[250];
  6. void _Py_InitVersion(void)
  7. {
  8. if (initialized) {
  9. return;
  10. }
  11. initialized = 1;
  12. PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
  13. PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
  14. }
  15. const char *
  16. Py_GetVersion(void)
  17. {
  18. _Py_InitVersion();
  19. return version;
  20. }
  21. // Export the Python hex version as a constant.
  22. const unsigned long Py_Version = PY_VERSION_HEX;