This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年01月11日 23:58 by thomaslee, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| ast-r01.patch | thomaslee, 2008年01月11日 23:58 | A(n almost complete) patch implementing this feature | ||
| ast.py | thomaslee, 2008年01月12日 00:00 | A demonstration of the crash occuring when ast-r01.patch is applied | ||
| ast-r02.patch | thomaslee, 2008年01月13日 01:20 | Complete patch? | ||
| ast-r03.patch | thomaslee, 2008年03月15日 11:01 | Updated to apply cleanly against HEAD, still pending review. | ||
| Messages (9) | |||
|---|---|---|---|
| msg59764 - (view) | Author: Thomas Lee (thomaslee) (Python committer) | 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) (Python committer) | Date: 2008年01月12日 00:00 | |
Attaching a sample program to demonstrate the crash. |
|||
| msg59766 - (view) | Author: Christian Heimes (christian.heimes) * (Python committer) | Date: 2008年01月12日 00:03 | |
Georg is working on the AST front. |
|||
| msg59813 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | 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) (Python committer) | 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) (Python committer) | Date: 2008年03月15日 10:49 | |
Georg, just a ping: still waiting on a review for this. |
|||
| msg63546 - (view) | Author: Thomas Lee (thomaslee) (Python committer) | Date: 2008年03月15日 11:00 | |
Updating the patch to apply cleanly against HEAD. |
|||
| msg63562 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年03月15日 19:56 | |
I'll try to handle it this weekend. |
|||
| msg64630 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | 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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:29 | admin | set | github: 46135 |
| 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 | thomaslee | set | files:
+ ast-r03.patch messages: + msg63546 |
| 2008年03月15日 10:49:55 | thomaslee | set | messages: + msg63545 |
| 2008年01月13日 01:20:44 | thomaslee | 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 | thomaslee | set | files:
+ ast.py messages: + msg59765 |
| 2008年01月11日 23:58:41 | thomaslee | create | |