Kaydet (Commit) 0ab5cf9b authored tarafından Antoine Pitrou's avatar Antoine Pitrou

Issue #15181: importlib bytecode is unsigned and shouldn't have negative numbers.

This fixes a compiler warning with suncc.
üst 7334be88
...@@ -31,7 +31,8 @@ main(int argc, char *argv[]) ...@@ -31,7 +31,8 @@ main(int argc, char *argv[])
FILE *infile, *outfile = NULL; FILE *infile, *outfile = NULL;
struct stat st; struct stat st;
size_t text_size, data_size, n; size_t text_size, data_size, n;
char *text, *data; char *text;
unsigned char *data;
PyObject *code, *marshalled; PyObject *code, *marshalled;
if (argc != 3) { if (argc != 3) {
...@@ -85,7 +86,7 @@ main(int argc, char *argv[]) ...@@ -85,7 +86,7 @@ main(int argc, char *argv[])
goto error; goto error;
assert(PyBytes_CheckExact(marshalled)); assert(PyBytes_CheckExact(marshalled));
data = PyBytes_AS_STRING(marshalled); data = (unsigned char *) PyBytes_AS_STRING(marshalled);
data_size = PyBytes_GET_SIZE(marshalled); data_size = PyBytes_GET_SIZE(marshalled);
outfile = fopen(outpath, "wb"); outfile = fopen(outpath, "wb");
...@@ -99,7 +100,7 @@ main(int argc, char *argv[]) ...@@ -99,7 +100,7 @@ main(int argc, char *argv[])
size_t i, end = Py_MIN(n + 16, data_size); size_t i, end = Py_MIN(n + 16, data_size);
fprintf(outfile, " "); fprintf(outfile, " ");
for (i = n; i < end; i++) { for (i = n; i < end; i++) {
fprintf(outfile, "%d,", (int) data[i]); fprintf(outfile, "%d,", (unsigned int) data[i]);
} }
fprintf(outfile, "\n"); fprintf(outfile, "\n");
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment