version.pxd 847 B

1234567891011121314151617181920212223242526272829303132
  1. # Python version constants
  2. #
  3. # It's better to evaluate these at runtime (i.e. C compile time) using
  4. #
  5. # if PY_MAJOR_VERSION >= 3:
  6. # do_stuff_in_Py3_0_and_later()
  7. # if PY_VERSION_HEX >= 0x02070000:
  8. # do_stuff_in_Py2_7_and_later()
  9. #
  10. # than using the IF/DEF statements, which are evaluated at Cython
  11. # compile time. This will keep your C code portable.
  12. cdef extern from *:
  13. # the complete version, e.g. 0x010502B2 == 1.5.2b2
  14. int PY_VERSION_HEX
  15. # the individual sections as plain numbers
  16. int PY_MAJOR_VERSION
  17. int PY_MINOR_VERSION
  18. int PY_MICRO_VERSION
  19. int PY_RELEASE_LEVEL
  20. int PY_RELEASE_SERIAL
  21. # Note: PY_RELEASE_LEVEL is one of
  22. # 0xA (alpha)
  23. # 0xB (beta)
  24. # 0xC (release candidate)
  25. # 0xF (final)
  26. char PY_VERSION[]
  27. char PY_PATCHLEVEL_REVISION[]