Python: introducting macro to simplify minor version check.

This commit is contained in:
Max Romanov
2020-11-05 00:04:58 +03:00
parent a29d970f10
commit 4225361f0e

View File

@@ -11,6 +11,8 @@
#include <nxt_main.h> #include <nxt_main.h>
#include <nxt_unit.h> #include <nxt_unit.h>
#define NXT_PYTHON_VER(maj, min) ((maj << 24) | (min << 16))
#if PY_MAJOR_VERSION == 3 #if PY_MAJOR_VERSION == 3
#define NXT_PYTHON_BYTES_TYPE "bytestring" #define NXT_PYTHON_BYTES_TYPE "bytestring"
@@ -31,7 +33,7 @@
#define PyUnicode_GET_LENGTH PyUnicode_GET_SIZE #define PyUnicode_GET_LENGTH PyUnicode_GET_SIZE
#endif #endif
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 5 #if PY_VERSION_HEX >= NXT_PYTHON_VER(3, 5)
#define NXT_HAVE_ASGI 1 #define NXT_HAVE_ASGI 1
#endif #endif