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


Groups > comp.lang.python > #19907

Re: nested embedding of interpreter

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'called.': 0.09; 'from:addr:pitrou.net': 0.09; 'from:addr:solipsis': 0.09; 'lost.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'atexit': 0.16; 'buffering': 0.16; 'from:name:antoine pitrou': 0.16; 'message- id:@post.gmane.org': 0.16; 'received:213.41.240': 0.16; 'received:213.41.240.54': 0.16; 'received:charlus.yi.org': 0.16; 'received:yi.org': 0.16; "user's": 0.18; 'mechanism': 0.19; 'correct,': 0.23; 'fine': 0.24; 'writes:': 0.25; 'problem': 0.29; 'objects': 0.32; 'there': 0.33; 'header:User-Agent:1': 0.33; 'object': 0.33; 'file': 0.34; 'header:X-Complaints-To:1': 0.34; 'eric': 0.34; '(including': 0.34; 'calling': 0.34; 'problem.': 0.35; 'to:addr:python-list': 0.35; 'something': 0.35; 'received:org': 0.36; 'run': 0.37; 'hello,': 0.37; 'charset:us- ascii': 0.37; 'problems': 0.38; 'called': 0.40; 'to:addr:python.org': 0.40; 'opened': 0.64
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Antoine Pitrou <solipsis@pitrou.net>
Subject Re: nested embedding of interpreter
Date Mon, 6 Feb 2012 19:59:24 +0000 (UTC)
References <CAAoZyYPSxcZNCdq7nRA74EBMEPpRLDgdTCpYdS3keeNV4Rrj3g@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host sea.gmane.org
User-Agent Loom/3.14 (http://gmane.org/)
X-Loom-IP 213.41.240.54 (Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5484.1328558381.27778.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328558381 news.xs4all.nl 6966 [2001:888:2000:d::a6]:46102
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19907

Show key headers only | 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