[issue1810] Partial AST compile() patch

2008-01-12 Thread Georg Brandl

Georg Brandl added the comment:

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;
}

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1810
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1810] Partial AST compile() patch

2008-01-11 Thread Thomas Lee

New submission from Thomas Lee:

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.

--
components: Interpreter Core
files: ast-r01.patch
messages: 59764
nosy: thomas.lee
severity: normal
status: open
title: Partial AST compile() patch
versions: Python 2.6
Added file: http://bugs.python.org/file9134/ast-r01.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1810
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1810] Partial AST compile() patch

2008-01-11 Thread Thomas Lee

Thomas Lee added the comment:

Attaching a sample program to demonstrate the crash.

Added file: http://bugs.python.org/file9135/ast.py

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1810
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1810] Partial AST compile() patch

2008-01-11 Thread Christian Heimes

Christian Heimes added the comment:

Georg is working on the AST front.

--
assignee:  - georg.brandl
keywords: +patch
nosy: +georg.brandl, tiran
priority:  - normal

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1810
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com