[C++-sig] Re: [BPL] python::interpreter proposal

Dirk Gerrits dirk at gerrits.homeip.net
Thu Jan 2 17:49:13 CET 2003


Bjorn Pettersen wrote:
>>From: Dirk Gerrits [mailto:dirk at gerrits.homeip.net] 
>>
>>For the python::interpreter class that has been discussed 
>>here earlier I propose the following interface:
> 
> [...]
> 
>>object interpreter::run(object code_string);
>>
>>Run the Python code in the string 
>>extract<std::string>(code_string) with 
>>this (sub-)interpreter and return the result.
> 
> 
> Question... how are you going to distinguish calling PyRun_String with
> Py_eval_input vs. Py_file_input? (the former only takes expressions, the
> latter doesn't return a result...)

It doesn't? I wasn't aware of that.

The PyRun_String docs say: "Returns the result of executing the code as 
a Python object, or NULL if an exception was raised."

And the Py_file_input doesn't say anything about the return value of the 
PyRun_* functions.

Dirk Gerrits







More information about the Cplusplus-sig mailing list