Issue1810
Created on 2008-01-11 23:58 by thomas.lee, last changed 2008-03-28 12:12 by georg.brandl.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
ast-r01.patch
|
thomas.lee,
2008-01-11 23:58
|
A(n almost complete) patch implementing this feature |
|
|
|
ast.py
|
thomas.lee,
2008-01-12 00:00
|
A demonstration of the crash occuring when ast-r01.patch is applied |
|
|
|
ast-r02.patch
|
thomas.lee,
2008-01-13 01:20
|
Complete patch? |
|
|
|
ast-r03.patch
|
thomas.lee,
2008-03-15 11:01
|
Updated to apply cleanly against HEAD, still pending review. |
|
|
| msg59764 (view) |
Author: Thomas Lee (thomas.lee) |
Date: 2008-01-11 23:58 |
|
This patch against HEAD provides the inverse operations to all the
ast2obj_* functions in Python/Python-ast.c: effectively, this allows
conversion to & from a PyObject representation of a Python AST.
Additionally, it updates the compile() builtin to allow it to compile
Python ASTs to bytecode.
The patch seems to work for most simple cases, but crashes out with a
segfault when trying to compile functions for some reason.
|
| msg59765 (view) |
Author: Thomas Lee (thomas.lee) |
Date: 2008-01-12 00:00 |
|
Attaching a sample program to demonstrate the crash.
|
| msg59766 (view) |
Author: Christian Heimes (christian.heimes) |
Date: 2008-01-12 00:03 |
|
Georg is working on the AST front.
|
| msg59813 (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2008-01-12 11:15 |
|
This is great work!
The problem is that ast2obj_object translates NULL values to Py_None,
but obj2ast_object doesn't translate that back. This definition fixes
your testcase:
static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
{
if (obj == Py_None)
obj = NULL;
Py_XINCREF(obj);
*out = obj;
return 0;
}
|
| msg59847 (view) |
Author: Thomas Lee (thomas.lee) |
Date: 2008-01-13 01:20 |
|
I knew it would be a simple one for somebody who knew what to look for
:) Thanks Georg! r02 is the updated patch. Changing the title of the
tracker issue to reflect that this *should* be a complete patch now.
Any further recommendations?
|
| msg63546 (view) |
Author: Thomas Lee (thomas.lee) |
Date: 2008-03-15 11:00 |
|
Updating the patch to apply cleanly against HEAD.
|
| msg63562 (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2008-03-15 19:56 |
|
I'll try to handle it this weekend.
|
| msg63545 (view) |
Author: Thomas Lee (thomas.lee) |
Date: 2008-03-15 10:49 |
|
Georg, just a ping: still waiting on a review for this.
|
| msg64630 (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2008-03-28 12:12 |
|
So I finally got to this one :)
I had to fix a few things, mainly error handling, and a refleak.
And I found a refleak in the compiler :)
Reviewed and committed in r62004.
|
|
| Date |
User |
Action |
Args |
| 2008-03-28 12:12:15 | georg.brandl | set | status: open -> closed resolution: accepted messages:
+ msg64630 |
| 2008-03-22 23:03:55 | aronacher | set | nosy:
+ aronacher |
| 2008-03-15 19:56:48 | georg.brandl | set | messages:
+ msg63562 |
| 2008-03-15 11:01:04 | thomas.lee | set | files:
+ ast-r03.patch messages:
+ msg63546 |
| 2008-03-15 10:49:55 | thomas.lee | set | messages:
+ msg63545 |
| 2008-01-13 01:20:44 | thomas.lee | set | files:
+ ast-r02.patch messages:
+ msg59847 title: Partial AST compile() patch -> AST compile() patch |
| 2008-01-12 11:15:17 | georg.brandl | set | messages:
+ msg59813 |
| 2008-01-12 00:03:24 | christian.heimes | set | priority: normal assignee: georg.brandl messages:
+ msg59766 keywords:
+ patch nosy:
+ georg.brandl, christian.heimes |
| 2008-01-12 00:00:36 | thomas.lee | set | files:
+ ast.py messages:
+ msg59765 |
| 2008-01-11 23:58:41 | thomas.lee | create | |
|