[pypy-commit] pypy cpyext-gc-support-2: Add PYPY_VERSION_NUM

arigo pypy.commits at gmail.com
Wed Feb 17 15:14:02 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-gc-support-2
Changeset: r82313:6fb202f87513
Date: 2016-02-17 21:13 +0100
http://bitbucket.org/pypy/pypy/changeset/6fb202f87513/

Log:	Add PYPY_VERSION_NUM

diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -30,6 +30,7 @@
 
 /* PyPy version as a string */
 #define PYPY_VERSION "4.1.0-alpha0"
+#define PYPY_VERSION_NUM  0x04010000
 
 /* Defined to mean a PyPy where cpyext holds more regular references
    to PyObjects, e.g. staying alive as long as the internal PyPy object
diff --git a/pypy/module/cpyext/test/test_version.py b/pypy/module/cpyext/test/test_version.py
--- a/pypy/module/cpyext/test/test_version.py
+++ b/pypy/module/cpyext/test/test_version.py
@@ -23,6 +23,7 @@
             PyModule_AddIntConstant(m, "py_minor_version", PY_MINOR_VERSION);
             PyModule_AddIntConstant(m, "py_micro_version", PY_MICRO_VERSION);
             PyModule_AddStringConstant(m, "pypy_version", PYPY_VERSION);
+            PyModule_AddIntConstant(m, "pypy_version_num", PYPY_VERSION_NUM);
         }
         """
         module = self.import_module(name='foo', init=init)
@@ -35,3 +36,6 @@
         if v.releaselevel != 'final':
             s += '-%s%d' % (v[3], v[4])
         assert module.pypy_version == s
+        assert module.pypy_version_num == ((v[0] << 24) |
+                                           (v[1] << 16) |
+                                           (v[2] << 8))


More information about the pypy-commit mailing list