summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-06-03 22:50:16 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-06-03 22:50:16 (GMT)
commit48deae12d511eabd8d73a2e4a135e6321a88b48c (patch)
tree22195a5bcb8aaab3c5ca52850f02c1eb06ce9642 /Python
parentdd5be06e6b0d858832a79606f1b90ec99e5522e2 (diff)
downloadcpython-48deae12d511eabd8d73a2e4a135e6321a88b48c.zip
cpython-48deae12d511eabd8d73a2e4a135e6321a88b48c.tar.gz
cpython-48deae12d511eabd8d73a2e4a135e6321a88b48c.tar.bz2
some horrible preprocessing tricks to automatically update the tag
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index 1f28d22..aaf649f 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -110,8 +110,12 @@ typedef unsigned short mode_t;
TAG and PYC_TAG_UNICODE must change for each major Python release. The magic
number will take care of any bytecode changes that occur during development.
*/
+#define QUOTE(arg) #arg
+#define STRIFY(name) QUOTE(name)
+#define MAJOR STRIFY(PY_MAJOR_VERSION)
+#define MINOR STRIFY(PY_MINOR_VERSION)
#define MAGIC (3180 | ((long)'\r'<<16) | ((long)'\n'<<24))
-#define TAG "cpython-32"
+#define TAG "cpython-" MAJOR MINOR;
#define CACHEDIR "__pycache__"
static const Py_UNICODE CACHEDIR_UNICODE[] = {
'_', '_', 'p', 'y', 'c', 'a', 'c', 'h', 'e', '_', '_', '\0'};
@@ -119,7 +123,11 @@ static const Py_UNICODE CACHEDIR_UNICODE[] = {
static long pyc_magic = MAGIC;
static const char *pyc_tag = TAG;
static const Py_UNICODE PYC_TAG_UNICODE[] = {
- 'c', 'p', 'y', 't', 'h', 'o', 'n', '-', '3', '2', '\0'};
+ 'c', 'p', 'y', 't', 'h', 'o', 'n', '-', PY_MAJOR_VERSION + 48, PY_MINOR_VERSION + 48, '\0'};
+#undef QUOTE
+#undef STRIFY
+#undef MAJOR
+#undef MINOR
/* See _PyImport_FixupExtensionObject() below */
static PyObject *extensions = NULL;