Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ab5cf9

Browse files
committed
Issue #15181: importlib bytecode is unsigned and shouldn't have negative numbers.
This fixes a compiler warning with suncc.
1 parent 7334be8 commit 0ab5cf9

2 files changed

Lines changed: 648 additions & 647 deletions

File tree

Modules/_freeze_importlib.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ main(int argc, char *argv[])
3131
FILE *infile, *outfile = NULL;
3232
struct stat st;
3333
size_t text_size, data_size, n;
34-
char *text, *data;
34+
char *text;
35+
unsigned char *data;
3536
PyObject *code, *marshalled;
3637

3738
if (argc != 3) {
@@ -85,7 +86,7 @@ main(int argc, char *argv[])
8586
goto error;
8687

8788
assert(PyBytes_CheckExact(marshalled));
88-
data = PyBytes_AS_STRING(marshalled);
89+
data = (unsigned char *) PyBytes_AS_STRING(marshalled);
8990
data_size = PyBytes_GET_SIZE(marshalled);
9091

9192
outfile = fopen(outpath, "wb");
@@ -99,7 +100,7 @@ main(int argc, char *argv[])
99100
size_t i, end = Py_MIN(n + 16, data_size);
100101
fprintf(outfile, " ");
101102
for (i = n; i < end; i++) {
102-
fprintf(outfile, "%d,", (int) data[i]);
103+
fprintf(outfile, "%d,", (unsigned int) data[i]);
103104
}
104105
fprintf(outfile, "\n");
105106
}

0 commit comments

Comments
 (0)