Skip to content

Commit 3475188

Browse files
author
gvanrossum
committed
Fix warnings on 64-bit platforms about casts from pointers to ints.
Two of these were real bugs. git-svn-id: http://svn.python.org/projects/python/trunk@28670 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 5877547 commit 3475188

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

Objects/obmalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ new_arena(void)
437437
arenabase = bp;
438438
nfreepools = ARENA_SIZE / POOL_SIZE;
439439
assert(POOL_SIZE * nfreepools == ARENA_SIZE);
440-
excess = (uint)bp & POOL_SIZE_MASK;
440+
excess = (uint) ((Py_uintptr_t)bp & POOL_SIZE_MASK);
441441
if (excess != 0) {
442442
--nfreepools;
443443
arenabase += POOL_SIZE - excess;

Objects/stringobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3883,7 +3883,8 @@ PyString_Format(PyObject *format, PyObject *args)
38833883
PyErr_Format(PyExc_ValueError,
38843884
"unsupported format character '%c' (0x%x) "
38853885
"at index %i",
3886-
c, c, fmt - 1 - PyString_AsString(format));
3886+
c, c,
3887+
(int)(fmt - 1 - PyString_AsString(format)));
38873888
goto error;
38883889
}
38893890
if (sign) {

Objects/unicodeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6465,7 +6465,8 @@ PyObject *PyUnicode_Format(PyObject *format,
64656465
"unsupported format character '%c' (0x%x) "
64666466
"at index %i",
64676467
(31<=c && c<=126) ? c : '?',
6468-
c, fmt -1 - PyUnicode_AS_UNICODE(uformat));
6468+
c,
6469+
(int)(fmt -1 - PyUnicode_AS_UNICODE(uformat)));
64696470
goto onError;
64706471
}
64716472
if (sign) {

0 commit comments

Comments
 (0)