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?

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject How to debug TypeError: required field "lineno" missing from expr?
Date 2015-06-29 02:14 +0100
Newsgroups comp.lang.python
Message-ID <mailman.153.1435540503.3674.python-list@python.org> (permalink)

Show all headers | 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