From af8a450c0fc6016b883c67824aca0209f0bb948a Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 6 Oct 2008 09:38:06 +0000 Subject: [PATCH] Merging with the BR_V5_DEV branch. --- src/PyConsole/PyConsole_Editor.cxx | 14 +++++++------- src/PyConsole/PyConsole_Interp.cxx | 10 ++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index fea5d6804..af69ea1fb 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -138,7 +138,7 @@ public: PyConsole_Editor* theListener, bool sync = false ) : PyInterp_LockRequest( theInterp, theListener, sync ), - myCommand( theCommand ), myState( PyInterp_Event::OK ) + myCommand( theCommand ), myState( PyInterp_Event::ES_OK ) {} protected: @@ -152,9 +152,9 @@ protected: { int ret = getInterp()->run( myCommand.toLatin1() ); if ( ret < 0 ) - myState = PyInterp_Event::ERROR; + myState = PyInterp_Event::ES_ERROR; else if ( ret > 0 ) - myState = PyInterp_Event::INCOMPLETE; + myState = PyInterp_Event::ES_INCOMPLETE; } } @@ -906,8 +906,8 @@ void PyConsole_Editor::customEvent( QEvent* event ) addText( pe->text() ); return; } - case PyInterp_Event::OK: - case PyInterp_Event::ERROR: + case PyInterp_Event::ES_OK: + case PyInterp_Event::ES_ERROR: { // clear command buffer myCommandBuffer.truncate( 0 ); @@ -928,7 +928,7 @@ void PyConsole_Editor::customEvent( QEvent* event ) myEventLoop->exit(); break; } - case PyInterp_Event::INCOMPLETE: + case PyInterp_Event::ES_INCOMPLETE: { // extend command buffer (multi-line command) myCommandBuffer.append( "\n" ); @@ -958,7 +958,7 @@ void PyConsole_Editor::customEvent( QEvent* event ) // unset history browsing mode myCmdInHistory = -1; - if ( (int)event->type() == (int)PyInterp_Event::OK && myQueue.count() > 0 ) + if ( (int)event->type() == (int)PyInterp_Event::ES_OK && myQueue.count() > 0 ) { // process the next sheduled command from the queue (if there is any) QString nextcmd = myQueue[0]; diff --git a/src/PyConsole/PyConsole_Interp.cxx b/src/PyConsole/PyConsole_Interp.cxx index 234e55973..003d59f39 100644 --- a/src/PyConsole/PyConsole_Interp.cxx +++ b/src/PyConsole/PyConsole_Interp.cxx @@ -93,6 +93,16 @@ bool PyConsole_Interp::initState() _tstate = Py_NewInterpreter(); // create an interpreter and save current state PySys_SetArgv(PyInterp_Interp::_argc,PyInterp_Interp::_argv); // initialize sys.argv + if(!builtinmodule) // PAL18041: deepcopy function don't work in Salome + { + //builtinmodule is static member of PyInterp class + //If it is not NULL (initialized to the builtin module of the main interpreter + //all the sub interpreters will have the same builtin + //_interp is a static member and is the main interpreter + //The first time we initialized it to the builtin of main interpreter + builtinmodule=PyDict_GetItemString(_interp->modules, "__builtin__"); + } + //If builtinmodule has been initialized all the sub interpreters // will have the same __builtin__ module if(builtinmodule){ -- 2.39.2