msg59764 - (view) |
Author: Thomas Lee (thomaslee)  |
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 (thomaslee)  |
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 (thomaslee)  |
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? |
|
|
msg63545 - (view) |
Author: Thomas Lee (thomaslee)  |
Date: 2008-03-15 10:49 |
Georg, just a ping: still waiting on a review for this. |
|
|
msg63546 - (view) |
Author: Thomas Lee (thomaslee)  |
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. |
|
|
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. |
|
|