Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(especially': 0.07; 'attribute': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'stack,': 0.09; 'stack.': 0.09; 'am,': 0.12; 'subject:function': 0.16; 'wrote:': 0.18; 'wrap': 0.18; 'jan': 0.19; 'extension': 0.21; 'header:In-Reply-To:1': 0.22; 'objects,': 0.23; 'there.': 0.24; 'code': 0.25; 'function': 0.27; 'pm,': 0.29; 'kelly': 0.30; 'subject:each': 0.30; 'subject:?': 0.31; "isn't": 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'fri,': 0.34; 'to:addr:python-list': 0.34; 'issue': 0.35; 'received:au': 0.36; 'acceptable': 0.37; 'but': 0.37; 'received:org': 0.38; 'some': 0.38; 'should': 0.39; 'subject:how': 0.39; 'to:addr:python.org': 0.40; 'might': 0.40; '2012': 0.67; 'lose': 0.84; '12:29': 0.84; 'build-in': 0.84; 'case?': 0.84; 'received:110': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lie Ryan Subject: Re: how to get id(function) for each function in stack? Date: Sat, 07 Jan 2012 11:17:38 +1100 References: <1002d4cd-6cfe-4b79-917f-361a06ffd215@a11g2000vbz.googlegroups.com> <9f8a8fd4-3541-4f9b-a887-3d10524de8f1@t30g2000vbx.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 110-175-240-90.static.tpgi.com.au User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325895612 news.xs4all.nl 6903 [2001:888:2000:d::a6]:54945 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18624 On 01/07/2012 06:50 AM, Ian Kelly wrote: > On Fri, Jan 6, 2012 at 12:29 PM, dmitrey wrote: >> Python build-in function sum() has no attribute func_code, what should >> I do in the case? > > Built-in functions and C extension functions have no code objects, and > for that reason they also do not exist in the stack. There is no way > to find sum() in the Python stack, because it isn't there. a practical solution to this issue is to wrap the C functions in Python functions. You lose some speed but that might be an acceptable tradeoff in some situations (especially if you're only wrapping when debugging).