From: Bruce S. <bas...@un...> - 2002-07-19 13:50:12
|
Something very odd. I was reviewing some old mail from Debian users, intending to take care of the problem they had reported (shown below). When I went to fix the typo in cvisual/CXX/Src/cxx_extensions.cxx ("name" should be "nam"), I found that there is no typo in the VPython file! Looking back in time through CVS at sourceforge.net, I cannot find a version of that file with the mistake in it. So how did two Debian users manage to get hold of a file in which "nam" had been changed to "name"? (A problem with English "silent e"?) Bruce Sherwood >From: "Neal M. Holtz" <nh...@do...> >To: vis...@li... >User-Agent: Mutt/1.3.28i >Subject: [Visualpython-users] Re: Trouble installing on Debian >Sender: vis...@li... >X-BeenThere: vis...@li... >X-Mailman-Version: 2.0.9-sf.net >List-Help: ><mailto:vis...@li...?subject=help> >List-Post: <mailto:vis...@li...> >List-Subscribe: ><https://lists.sourceforge.net/lists/listinfo/visualpython-users>, > ><mailto:vis...@li...?subject=subscribe> >List-Id: <visualpython-users.lists.sourceforge.net> >List-Unsubscribe: ><https://lists.sourceforge.net/lists/listinfo/visualpython-users>, > ><mailto:vis...@li...?subject=unsubscribe> >List-Archive: ><http://www.geocrawler.com/redir-sf.php3?list=visualpython-users> >X-Original-Date: Sat, 4 May 2002 07:58:31 -0400 >Date: Sat, 4 May 2002 07:58:31 -0400 > >A couple of replies with respect to a "segfault" problem on Debian >(and also on my highly non-standard Caldera) mentioned problems >with passing const char * pointers. Those points may be valid, >but consider the original method causing the problem: > >void PythonType::name( const char* nam ) >{ > table->tp_name = const_cast<char *>( name ); >} > >I bet that line should be: > > table->tp_name = const_cast<char *>( nam ); > >Otherwise, the code is storing a pointer to the method >and not the string -- a simple typo. > >Changing it this way fixes the segfault on my Caldera system. > >Cheers, and thanks for making it easy for me to fix >the problem get VPython to run .. > >neal > > > FROM: Bruce Sherwood > DATE: 04/26/2002 06:40:58 > SUBJECT: [Visualpython-users] Trouble installing on Debian > > > Here is some nice detective work by Yves Bailly in France. I should > > incorporate his change, but in the meantime here is what he found. I'm > > puzzled that others running on Debian did not run into this problem. > > > > Bruce Sherwood > > > > --On Friday, April 26, 2002 1:57 AM +0200 Yves BAILLY > > <<EMAIL: PROTECTED>> wrote: > > > > > Hello, > > > > > > First of all, I have to say : contragulation for your great work ! > > > > > > Now, my problem : > > > I tried to install VPython on a Debian "sid", using : > > > - Python 2.2.1 > > > - Numeric 21.0 > > > - GtkGlArea 1.2.3 > > > - Mesa which comes with XFree86 4.1.0 > > > > > > Everything compiles fine, but when running > > > from visual import * > > > ...I was always getting a segfault. > > > > > > I dig a little bit, and found this in > cvisual/CXX/Src/cxx_extensions.cxx : > > > void PythonType::name( const char* nam ) > > > { > > > table->tp_name = const_cast<char *>( name ); > > > } > > > The segfault seemed to occure during this method. > > > > > > Considering the char* is a rather strange thing, that should > always be > > > used with care, moreover when you give a litteral string to a > function, > > > I just modified this method a little, to allocate and duplicate the > > > string : > > > void PythonType::name( const char* nam ) > > > { > > > char* str = new char[strlen(nam)+1] ; > > > strcpy(str, nam) ; > > > table->tp_name = const_cast<char *>( str ); > > > } > > > > > > ...and now it works fine, I can even use the KineticsKit ! > > > > > > Just a quick hack, for sure there should something better (nicer). > > > > > > Best regards, > > > > > > -- > > > ( | Yves Bailly : http://kafka-fr.net | - > > > //\ | Linux Dijon : http://www.coagul.org | //\ > > > \_/ | Don d'organe : http://adot21.free.fr | \_/` > > > >-- >Neal Holtz http://www.docuweb.ca/~nholtz >Dept. of Civil and Environmental Engineering, Carleton University, >Ottawa, Ontario, Canada K1S 5B6. nh...@do... > > >_______________________________________________________________ > >Have big pipes? SourceForge.net is looking for download mirrors. We supply >the hardware. You get the recognition. Email Us: ban...@so... >_______________________________________________ >Visualpython-users mailing list >Vis...@li... >https://lists.sourceforge.net/lists/listinfo/visualpython-users |