On 13 Jun 2013 10:09, "Victor Stinner" <victor.stin...@gmail.com> wrote:
>
> 2013/6/13 Nick Coghlan <ncogh...@gmail.com>:
> > On 13 Jun 2013 09:09, "Victor Stinner" <victor.stin...@gmail.com> wrote:
> >> Using this patch, detecting memory corruptions (buffer underflow and
> >> overflow) can be done without recompilation. We may add an environment
> >> variable to enable Python debug functions at runtime, example:
> >> PYDEBUGMALLOC=1. There is just a restriction: the environment variable
> >> would not be ignored with -E command line option, because command line
> >> options are parsed after the first memory allocation. What do you
> >> think?
> >
> > The rest of it sounds fine, but please don't add the runtime switching
> > support to our existing main function. Interpreter startup is a mess
> > already. If you were interested in helping directly with PEP 432,
though,
> > that would be good - I haven't been able to spend much time on it
lately.
>
> I proposed an environment variable to solve the following issue: when
> memory allocators are replaced with custom allocators, debug hooks
> cannot be used. Debug hooks must be set before the first memory
> allocation.
>
> Another option is to add a new function (ex: PyMem_SetDebugHook()) to
> install explicitly debug hooks, so it can be called after
> PyMem_SetAllocators() and before the first memory allocation.

Yes, that sounds better. One of the biggest problems with the current
startup sequence is the way it relies on environment variables for
configuration, which makes life hard for other applications that want to
embed the CPython runtime.

Cheers,
Nick.

>
> Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to