[Python-checkins] cpython: Issue #15181: importlib bytecode is unsigned and shouldn't have negative
antoine.pitrou
python-checkins at python.org
Mon Jun 25 17:36:26 CEST 2012
http://hg.python.org/cpython/rev/6dc9472346de
changeset: 77777:6dc9472346de
parent: 77775:2d3031c1c148
user: Antoine Pitrou <solipsis at pitrou.net>
date: Mon Jun 25 17:32:43 2012 +0200
summary:
Issue #15181: importlib bytecode is unsigned and shouldn't have negative numbers.
This fixes a compiler warning with suncc.
files:
Modules/_freeze_importlib.c | 7 +-
Python/importlib.h | 1288 +++++++++++-----------
2 files changed, 648 insertions(+), 647 deletions(-)
diff --git a/Modules/_freeze_importlib.c b/Modules/_freeze_importlib.c
--- a/Modules/_freeze_importlib.c
+++ b/Modules/_freeze_importlib.c
@@ -31,7 +31,8 @@
FILE *infile, *outfile = NULL;
struct stat st;
size_t text_size, data_size, n;
- char *text, *data;
+ char *text;
+ unsigned char *data;
PyObject *code, *marshalled;
if (argc != 3) {
@@ -85,7 +86,7 @@
goto error;
assert(PyBytes_CheckExact(marshalled));
- data = PyBytes_AS_STRING(marshalled);
+ data = (unsigned char *) PyBytes_AS_STRING(marshalled);
data_size = PyBytes_GET_SIZE(marshalled);
outfile = fopen(outpath, "wb");
@@ -99,7 +100,7 @@
size_t i, end = Py_MIN(n + 16, data_size);
fprintf(outfile, " ");
for (i = n; i < end; i++) {
- fprintf(outfile, "%d,", (int) data[i]);
+ fprintf(outfile, "%d,", (unsigned int) data[i]);
}
fprintf(outfile, "\n");
}
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list