Skip to content

Commit 86e322f

Browse files
authored
bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 (GH-24384)
1 parent 62437a2 commit 86e322f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Objects/codeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ emit_pair(PyObject **bytes, int *offset, int a, int b)
408408
if (_PyBytes_Resize(bytes, len * 2) < 0)
409409
return 0;
410410
}
411-
unsigned char *lnotab = (unsigned char *)
412-
PyBytes_AS_STRING(*bytes) + *offset;
411+
unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(*bytes);
412+
lnotab += *offset;
413413
*lnotab++ = a;
414414
*lnotab++ = b;
415415
*offset += 2;

Python/compile.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5577,9 +5577,8 @@ assemble_emit_linetable_pair(struct assembler *a, int bdelta, int ldelta)
55775577
if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0)
55785578
return 0;
55795579
}
5580-
unsigned char *lnotab = (unsigned char *)
5581-
PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
5582-
5580+
unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(a->a_lnotab);
5581+
lnotab += a->a_lnotab_off;
55835582
a->a_lnotab_off += 2;
55845583
*lnotab++ = bdelta;
55855584
*lnotab++ = ldelta;

0 commit comments

Comments
 (0)