Skip to content

Commit

Permalink
bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Jan 30, 2021
1 parent 62437a2 commit 86e322f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ emit_pair(PyObject **bytes, int *offset, int a, int b)
if (_PyBytes_Resize(bytes, len * 2) < 0)
return 0;
}
unsigned char *lnotab = (unsigned char *)
PyBytes_AS_STRING(*bytes) + *offset;
unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(*bytes);
lnotab += *offset;
*lnotab++ = a;
*lnotab++ = b;
*offset += 2;
Expand Down
5 changes: 2 additions & 3 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5577,9 +5577,8 @@ assemble_emit_linetable_pair(struct assembler *a, int bdelta, int ldelta)
if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0)
return 0;
}
unsigned char *lnotab = (unsigned char *)
PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off;

unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(a->a_lnotab);
lnotab += a->a_lnotab_off;
a->a_lnotab_off += 2;
*lnotab++ = bdelta;
*lnotab++ = ldelta;
Expand Down

0 comments on commit 86e322f

Please sign in to comment.