]> granicus.if.org Git - python/commitdiff
make some freezing related stuff const
authorBenjamin Peterson <benjamin@python.org>
Wed, 13 Mar 2013 19:06:39 +0000 (14:06 -0500)
committerBenjamin Peterson <benjamin@python.org>
Wed, 13 Mar 2013 19:06:39 +0000 (14:06 -0500)
Include/import.h
Modules/_freeze_importlib.c
Python/frozen.c
Python/importlib.h

index fdc27336c35ba7834160c620295db4cdfe7ff3f5..90049e051b18d35494ffef3400e28f879c1e3ebb 100644 (file)
@@ -113,15 +113,15 @@ PyAPI_FUNC(int) PyImport_AppendInittab(
 
 #ifndef Py_LIMITED_API
 struct _frozen {
-    char *name;                 /* ASCII encoded string */
-    unsigned char *code;
+    const char *name;                 /* ASCII encoded string */
+    const unsigned char *code;
     int size;
 };
 
 /* Embedding apps may change this pointer to point to their favorite
    collection of frozen modules: */
 
-PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
+PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
 #endif
 
 #ifdef __cplusplus
index 65b29e1f8c2a952d0429377d466553644c3ed8fa..0435a8adb1b9d2c78bcce57adf0086e348176fcc 100644 (file)
@@ -17,7 +17,7 @@
    of frozen modules instead, left deliberately blank so as to avoid
    unintentional import of a stale version of _frozen_importlib. */
 
-static struct _frozen _PyImport_FrozenModules[] = {
+const static struct _frozen _PyImport_FrozenModules[] = {
     {0, 0, 0} /* sentinel */
 };
 
@@ -25,7 +25,7 @@ static struct _frozen _PyImport_FrozenModules[] = {
 /* On Windows, this links with the regular pythonXY.dll, so this variable comes
    from frozen.obj. In the Makefile, frozen.o is not linked into this executable,
    so we define the variable here. */
-struct _frozen *PyImport_FrozenModules;
+const struct _frozen *PyImport_FrozenModules;
 #endif
 
 const char header[] = "/* Auto-generated by Modules/_freeze_importlib.c */";
@@ -105,7 +105,7 @@ main(int argc, char *argv[])
         return 1;
     }
     fprintf(outfile, "%s\n", header);
-    fprintf(outfile, "unsigned char _Py_M__importlib[] = {\n");
+    fprintf(outfile, "const unsigned char _Py_M__importlib[] = {\n");
     for (n = 0; n < data_size; n += 16) {
         size_t i, end = Py_MIN(n + 16, data_size);
         fprintf(outfile, "    ");
index 25fdc17b3f8c31ea36a9b7a92331793f954ea085..9bc662b9943503e99e98271e983d504f9771b44a 100644 (file)
@@ -28,7 +28,7 @@ static unsigned char M___hello__[] = {
 
 #define SIZE (int)sizeof(M___hello__)
 
-static struct _frozen _PyImport_FrozenModules[] = {
+static const struct _frozen _PyImport_FrozenModules[] = {
     /* importlib */
     {"_frozen_importlib", _Py_M__importlib, (int)sizeof(_Py_M__importlib)},
     /* Test module */
@@ -42,4 +42,4 @@ static struct _frozen _PyImport_FrozenModules[] = {
 /* Embedding apps may change this pointer to point to their favorite
    collection of frozen modules: */
 
-struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules;
+const struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules;
index 13db56d95ef4091f965ba1d4196ece0f6c485b93..b4aab8384e6d4c4d9f44a66987e62cf53f8df109 100644 (file)
@@ -1,5 +1,5 @@
 /* Auto-generated by Modules/_freeze_importlib.c */
-unsigned char _Py_M__importlib[] = {
+const unsigned char _Py_M__importlib[] = {
     99,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
     0,64,0,0,0,115,229,3,0,0,100,0,0,90,0,0,
     100,130,0,90,1,0,100,4,0,100,5,0,132,0,0,90,