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

Skip to content

Commit 53fa8b2

Browse files
Fixed few compiler warnings.
1 parent a9e00d1 commit 53fa8b2

5 files changed

Lines changed: 9 additions & 10 deletions

File tree

Modules/cjkcodecs/_codecs_iso2022.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ iso2022processesc(const void *config, MultibyteCodec_State *state,
292292
const unsigned char **inbuf, Py_ssize_t *inleft)
293293
{
294294
unsigned char charset, designation;
295-
Py_ssize_t i, esclen;
295+
Py_ssize_t i, esclen = 0;
296296

297297
for (i = 1;i < MAX_ESCSEQLEN;i++) {
298298
if (i >= *inleft)
@@ -307,10 +307,9 @@ iso2022processesc(const void *config, MultibyteCodec_State *state,
307307
}
308308
}
309309

310-
if (i >= MAX_ESCSEQLEN)
311-
return 1; /* unterminated escape sequence */
312-
313310
switch (esclen) {
311+
case 0:
312+
return 1; /* unterminated escape sequence */
314313
case 3:
315314
if (INBYTE2 == '$') {
316315
charset = INBYTE3 | CHARSET_DBCS;

Modules/faulthandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ faulthandler_thread(void *unused)
458458
assert(st == PY_LOCK_FAILURE);
459459

460460
/* get the thread holding the GIL, NULL if no thread hold the GIL */
461-
current = _Py_atomic_load_relaxed(&_PyThreadState_Current);
461+
current = (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
462462

463463
write(thread.fd, thread.header, (int)thread.header_len);
464464

Python/ceval_gil.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void drop_gil(PyThreadState *tstate)
191191
if (_Py_atomic_load_relaxed(&gil_drop_request) && tstate != NULL) {
192192
MUTEX_LOCK(switch_mutex);
193193
/* Not switched yet => wait */
194-
if (_Py_atomic_load_relaxed(&gil_last_holder) == tstate) {
194+
if ((PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder) == tstate) {
195195
RESET_GIL_DROP_REQUEST();
196196
/* NOTE: if COND_WAIT does not atomically start waiting when
197197
releasing the mutex, another thread can run through, take
@@ -239,7 +239,7 @@ static void take_gil(PyThreadState *tstate)
239239
_Py_atomic_store_relaxed(&gil_locked, 1);
240240
_Py_ANNOTATE_RWLOCK_ACQUIRED(&gil_locked, /*is_write=*/1);
241241

242-
if (tstate != _Py_atomic_load_relaxed(&gil_last_holder)) {
242+
if (tstate != (PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder)) {
243243
_Py_atomic_store_relaxed(&gil_last_holder, tstate);
244244
++gil_switch_number;
245245
}

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ Py_FatalError(const char *msg)
12581258
PyErr_PrintEx(0);
12591259
}
12601260
else {
1261-
tstate = _Py_atomic_load_relaxed(&_PyThreadState_Current);
1261+
tstate = (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
12621262
if (tstate != NULL) {
12631263
fputc('\n', stderr);
12641264
fflush(stderr);

Python/pystate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ tstate_delete_common(PyThreadState *tstate)
403403
void
404404
PyThreadState_Delete(PyThreadState *tstate)
405405
{
406-
if (tstate == _Py_atomic_load_relaxed(&_PyThreadState_Current))
406+
if (tstate == (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
407407
Py_FatalError("PyThreadState_Delete: tstate is still current");
408408
#ifdef WITH_THREAD
409409
if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
@@ -662,7 +662,7 @@ PyThreadState_IsCurrent(PyThreadState *tstate)
662662
{
663663
/* Must be the tstate for this thread */
664664
assert(PyGILState_GetThisThreadState()==tstate);
665-
return tstate == _Py_atomic_load_relaxed(&_PyThreadState_Current);
665+
return tstate == (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
666666
}
667667

668668
/* Internal initialization/finalization functions called by

0 commit comments

Comments
 (0)