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


Groups > comp.lang.python > #93279

How to debug TypeError: required field "lineno" missing from expr?

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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exercise': 0.03; 'from:addr:yahoo.co.uk': 0.05; 'needed,': 0.05; 'subject:missing': 0.07; 'subject:How': 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; 'url:github': 0.09; '\xe2\x80\x94': 0.09; 'bug': 0.10; '2.7': 0.13; 'proceed?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:debug': 0.16; 'subject:required': 0.16; 'url:status': 0.18; 'language': 0.19; 'changes': 0.20; 'beauty': 0.22; 'function,': 0.22; 'lawrence': 0.22; "i've": 0.24; 'somewhere': 0.24; 'sort': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'error': 0.27; 'checking': 0.27; '[2]': 0.27; 'converting': 0.27; "i'm": 0.29; 'no,': 0.29; 'code': 0.31; '[1]': 0.32; 'language.': 0.32; 'raising': 0.33; 'subject:?': 0.34; 'to:addr:python-list': 0.35; 'along': 0.35; 'something': 0.35; 'problem.': 0.35; 'but': 0.36; 'too': 0.36; 'subject:" ': 0.36; 'subject:: ': 0.37; 'missing': 0.37; 'rather': 0.38; 'received:org': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'mark': 0.40; 'some': 0.40; 'further': 0.60; 'field': 0.60; 'url:co': 0.64; 'our': 0.64; 'subject': 0.68; 'worth': 0.73; 'bst': 0.84; 'frustrating': 0.84; 'pythonistas,': 0.84; 'difficult,': 0.91; 'enhancement': 0.96
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject How to debug TypeError: required field "lineno" missing from expr?
Date Mon, 29 Jun 2015 02:14:43 +0100
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host host-78-147-25-88.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.153.1435540503.3674.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435540503 news.xs4all.nl 2914 [2001:888:2000:d::a6]:39564
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!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:93279

Show key headers only | View raw


Purely as an exercise I've been converting Grant Jenks' pypatt[1] from 
2.7 to 3.4.  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.  I'm 
aware of the Armin Ronacher tweet[3] stating

<quote>
"TypeError: required field "lineno" missing from stmt" — no, what you 
actually mean is "tuple is not a statement'.
</quote>

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?

Further would it be worth raising an enhancement request to get some 
better diagnostics from the built-in compile function, or is such a 
thing already on the bug tracker?  Or is it simply too difficult, or what?

No panic needed, it's past 2am BST and I'm off to bed for my beauty 
sleep, so give me a couple of months :)

[1] https://github.com/grantjenks/pypatt_python_pattern_matching
[2] http://alexleone.blogspot.co.uk/2010/01/python-ast-pretty-printer.html
[3] https://twitter.com/mitsuhiko/status/91169383254200320

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Thread

How to debug TypeError: required field "lineno" missing from expr? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-29 02:14 +0100
  Re: How to debug TypeError: required field "lineno" missing from expr? Steven D'Aprano <steve@pearwood.info> - 2015-06-29 12:44 +1000
    Re: How to debug TypeError: required field "lineno" missing from expr? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-01 00:01 +0100

csiph-web