Home | History | Annotate | Download | only in cpython
      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 >= 0x02050000:
      8 #           do_stuff_in_Py2_5_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 
     13 
     14 cdef extern from *:
     15     # the complete version, e.g. 0x010502B2 == 1.5.2b2
     16     int PY_VERSION_HEX
     17 
     18     # the individual sections as plain numbers
     19     int PY_MAJOR_VERSION
     20     int PY_MINOR_VERSION
     21     int PY_MICRO_VERSION
     22     int PY_RELEASE_LEVEL
     23     int PY_RELEASE_SERIAL
     24 
     25     # Note: PY_RELEASE_LEVEL is one of
     26     #    0xA (alpha)
     27     #    0xB (beta)
     28     #    0xC (release candidate)
     29     #    0xF (final)
     30 
     31     char PY_VERSION[]
     32     char PY_PATCHLEVEL_REVISION[]
     33