Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19907

Re: nested embedding of interpreter

From Antoine Pitrou <solipsis@pitrou.net>
Subject Re: nested embedding of interpreter
Date 2012-02-06 19:59 +0000
References <CAAoZyYPSxcZNCdq7nRA74EBMEPpRLDgdTCpYdS3keeNV4Rrj3g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5484.1328558381.27778.python-list@python.org> (permalink)

Show all headers | View raw


Hello,

Eric Frederich <eric.frederich <at> gmail.com> writes:
> 
> 1)Is calling Py_Initialize twice correct, or will I run into other problems
> down the road?

It's fine in practice (spurious calls are ignored).

> I am not sure if there is a mechanism to get something called at the end of
the 
> user's session with the program though, so is it a problem if I don't call
> Py_Finalize at the end?

Yes, it's a problem. If you don't call Py_Finalize, atexit handlers, object
destructors and the like will not be called. These include destructors of file
objects (including stdout): any buffering in a still-open file opened for
writing can be lost.

Regards

Antoine.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: nested embedding of interpreter Antoine Pitrou <solipsis@pitrou.net> - 2012-02-06 19:59 +0000

csiph-web