[issue23503] undefined behavior in Objects/obmalloc.c

STINNER Victor report at bugs.python.org
Mon Sep 19 04:40:15 EDT 2016


STINNER Victor added the comment:

> As a result, this initializer causes this file to be undefined.

Hum, in practice I'm not aware of any crash on any platform. Python is tested on various compilers (GCC, Clang, ICC, Microsoft Visual Studio, etc.), various operating systems (Mac OS X, Linux, Windows, FreeBSD, OpenBSD, Solaris, etc.), various architectures (x86, x86-64, PPC, etc.).

The memory allocator is probably the first instruction when starting Python.

Anyway, do you see a way to avoid the undefined behaviour?

Python has a _PyMem_SetupAllocators() function called very early in main() (before the first Python memory allocation), but calling this function is optional. So we have to prepare everything during the compilation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23503>
_______________________________________


More information about the Python-bugs-list mailing list