/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.*/
ASSERTE(_CrtIsValidHeapPointer(pUserData));
This is source code i used, note: everything compiled and linked fine.
#include <stdio.h>
#include <string>
#include <boost\python.hpp>
struct World{
void Set(std::string m){ msg = m;}
std::string Greet(){return msg;}
std::string msg;
};
BOOST_PYTHON_MODULE(hello){
class_<World>("World")
.def("Set", &World::Set)
.def("Greet",&World::Greet)
;
}
int main(){
Py_Initialize();
inithello();
if(PyRun_SimpleString( "import hello\n"
"planet = hello.World()\n"
"planet.Set('Kick Ass!')\n"
"print planet.Greet()") == -1){
printf("Error Running script");
}
Py_Finalize();
return 0;
}
the error only occurs in the debug build. im using Python2.2 and boost 1.30.2 .
I would like to know why this assert failure is happening. i cant see any reason why it would happen except for maybe the custom module being loaded.
Get busy livin' or get busy dyin'... - Shawshank Redemption
If a man is talking in the forest, and no woman is around to hear him, is he still wrong? - Unknown
Fulcrum
[edited by - syrillix on February 14, 2004 12:44:41 AM]
bizzare embedded python error
i just started getting into the whole embedded languages thing and python looks so promising. however i was messing around looking at code snippets and generally playing around with the boost.python / python API when i got this strange debug runtime assertion error from Py_Finalize(),
this is the assert that failed that happened in Py_Finalize()
Get busy livin' or get busy dyin'... - Shawshank RedemptionIf a man is talking in the forest, and no woman is around to hear him, is he still wrong? - UnknownFulcrum
I'm guessing you have some sort of memory allocation error in the module you're wrapping with Boost:: Python. Possibly a double-free.
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
[edited by - Kylotan on February 15, 2004 7:40:34 PM]
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
[edited by - Kylotan on February 15, 2004 7:40:34 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement