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.

classification
Title: PyObject_Print with Visual Studio 2010
Type: crash Stage:
Components: Interpreter Core, Windows Versions: Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Krauzi, amaury.forgeotdarc, lemburg
Priority: normal Keywords:

Created on 2010-08-31 09:43 by Krauzi, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg115256 - (view) Author: Krauzi (Krauzi) Date: 2010-08-31 09:43
Hi guys,
i recently found out that PyObject_Print is not working with Visual Studio 2010:


#include <Python.h>
#include <iostream>

int main( int argc, char** argv )
{
    Py_Initialize();
    PyObject_Print( PyUnicode_FromString("test"), stdout, Py_PRINT_RAW );
    Py_Finalize();
    
    std::cin.get();
    return EXIT_SUCCESS;
}
msg115257 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-08-31 10:26
Krauzi wrote:
> 
> New submission from Krauzi <krauzi_gmbh@yahoo.de>:
> 
> Hi guys,
> i recently found out that PyObject_Print is not working with Visual Studio 2010:
> 
> 
> #include <Python.h>
> #include <iostream>
> 
> int main( int argc, char** argv )
> {
>     Py_Initialize();
>     PyObject_Print( PyUnicode_FromString("test"), stdout, Py_PRINT_RAW );
>     Py_Finalize();
>     
>     std::cin.get();
>     return EXIT_SUCCESS;
> }

In what way is this not working ?

Have you compiled Python with VS2010 or are you using the stock
from python.org (which is compiled with VS2008) ?
msg115258 - (view) Author: Krauzi (Krauzi) Date: 2010-08-31 11:01
i used the one from python.org.
I cant build python with VC2010 because it cant convert the project from VC2008 to VC2010.
msg115261 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-08-31 12:30
You really should use the same version of Visual Studio than the one used to compile python.
"stdout" points to a FILE object created by your version of the compiler (VS2010); it cannot be passed to PyObject_Print(), which uses definitions from the VS2008 compiler.

What issue did you encounter when converting the project files to VS2010?
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53931
2012-06-10 02:32:52r.david.murraysetstatus: pending -> closed
2010-08-31 12:30:07amaury.forgeotdarcsetstatus: open -> pending

nosy: + amaury.forgeotdarc
messages: + msg115261

resolution: not a bug
2010-08-31 11:01:44Krauzisetmessages: + msg115258
2010-08-31 10:26:10lemburgsetnosy: + lemburg
messages: + msg115257
2010-08-31 09:43:01Krauzicreate