Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93297 > unrolled thread
| Started by | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| First post | 2015-06-29 23:07 +0100 |
| Last post | 2015-06-29 23:07 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to debug TypeError: required field "lineno" missing from expr? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-29 23:07 +0100
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-06-29 23:07 +0100 |
| Subject | Re: How to debug TypeError: required field "lineno" missing from expr? |
| Message-ID | <mailman.173.1435615662.3674.python-list@python.org> |
On 29/06/2015 21:59, Terry Reedy wrote: > On 6/29/2015 7:17 AM, Terry Reedy wrote: >> On 6/29/2015 3:08 AM, Laura Creighton wrote: >>> In a message of Mon, 29 Jun 2015 02:14:43 +0100, Mark Lawrence writes: >>>> 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. >>> >>> Are you trying to use ast.copy_location recursively somewhere? >>> http://bugs.python.org/issue3530 Maybe you have found something else >>> that doesn't work recursively? > > The issue is that copy_location is not recursive and does not fix > children of the node being fixed, whereas the example method, copied > from the NodeTransformer doc, creates 3 new nodes, not just 1, that need > fixing. I reopened the issue as a doc issue to fix the example and > recommend the use of recursive fix_missing_locations() instead of the > non-recursive copy_location. > > The only other location-related function in ast is increment_lineno, > which also works on multiple nodes. I would not be surprised is Mark's > issue results from Mark or someone else copying the bad doc example. > FTR there is no call to copy_location in Grant's existing code. Whether or not one is actually needed in 3.4 when compared to 2.7 is another question. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to top | Article view | comp.lang.python
csiph-web