Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exercise': 0.03; 'context': 0.05; 'problem?': 0.07; 'subject:missing': 0.07; 'subject:How': 0.09; '2to3': 0.09; 'armin': 0.09; 'ast': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stating': 0.09; 'throw': 0.09; '\xe2\x80\x94': 0.09; 'jan': 0.11; '2.7': 0.13; 'exception': 0.13; '.py': 0.16; 'compile.': 0.16; 'grepping': 0.16; 'hand?': 0.16; 'hits.': 0.16; 'lineno': 0.16; 'proceed?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:debug': 0.16; 'subject:required': 0.16; 'terribly': 0.16; 'wrote:': 0.16; 'changes': 0.20; 'either.': 0.22; 'lawrence': 0.22; 'code.': 0.23; "i've": 0.24; 'header:In-Reply- To:1': 0.24; 'raise': 0.24; 'somewhere': 0.24; 'sort': 0.25; 'example': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'error': 0.27; 'checking': 0.27; 'converting': 0.27; 'asked': 0.28; "i'm": 0.29; 'helpful.': 0.29; 'terry': 0.29; 'no,': 0.29; 'random': 0.29; 'function': 0.30; 'minimal': 0.31; 'code': 0.31; 'post': 0.32; 'compiled': 0.32; 'traceback': 0.33; 'subject:?': 0.34; 'to:addr:python-list': 0.35; 'along': 0.35; 'something': 0.35; 'asking': 0.35; 'problem.': 0.35; 'but': 0.36; 'statement': 0.36; 'subject:" ': 0.36; 'subject:: ': 0.37; 'missing': 0.37; '(with': 0.38; 'rather': 0.38; 'received:org': 0.38; 'say': 0.38; 'files': 0.38; 'mean': 0.38; 'pm,': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'mark': 0.40; 'field': 0.60; 'times': 0.61; 'complete': 0.63; 'subject': 0.68; '3.4': 0.84; 'frustrating': 0.84; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: How to debug TypeError: required field "lineno" missing from expr? Date: Sun, 28 Jun 2015 22:20:48 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-98-114-97-173.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435544465 news.xs4all.nl 2830 [2001:888:2000:d::a6]:46321 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:93281 On 6/28/2015 9:14 PM, Mark Lawrence wrote: > Purely as an exercise I've been converting Grant Jenks' pypatt[1] from > 2.7 to 3.4. With 2to3 or by hand? > I've managed to sort out most of the required changes by > checking on what I can see with an AST pretty printer[2]. So it's > rather frustrating to have the compile stage throw the error given in > the subject line. > > The code has a call to the ast fix_missing_locations function. ast.fix_missing_locations does not have a raise statement > I'm aware of the Armin Ronacher tweet[3] stating > > > "TypeError: required field "lineno" missing from stmt" =E2=80=94 no, wh= at you > actually mean is "tuple is not a statement'. > As near as I can tell, it is impossible for lineno to be missing from a=20 call to the inner function _fix. Grepping for "TypeError: required=20 field" in 3.4 .c and .py files (with Idle) does not return any hits. astpp.py does not raise that particular error either. A random tweet without context or example is not terribly helpful. > but I don't think this is the problem. Still I've clearly managed to > screw something up somewhere along so line, so any bright ideas as to > how I can proceed? How many times have you asked people asking such questions to post both=20 the complete traceback and the code. Where does the traceback say the=20 exception is from? The What is the code that compiled with 2.7 and the=20 (modified?) code that does not compile. What is a minimal example that=20 exhibits the problem? --=20 Terry Jan Reedy