[Python-checkins] CVS: python/dist/src/Python dynload_next.c,2.7,2.7.6.1

Anthony Baxter anthonybaxter@users.sourceforge.net
2001年11月20日 20:58:39 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv11381
Modified Files:
 Tag: release21-maint
	dynload_next.c 
Log Message:
backport of 2.8 by jack:
Patch by Jonathan Wight (slightly reformatted) to forestall loading the
same module twice, which apparently crashes Python. I could not test the
error condition, but in normal life it seems to have no adverse effects.
Also removed an unsued variable, and corrected 2 glaring errors (missing
'case' in front of a label).
Index: dynload_next.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_next.c,v
retrieving revision 2.7
retrieving revision 2.7.6.1
diff -C2 -d -r2.7 -r2.7.6.1
*** dynload_next.c	2000年09月01日 23:29:28	2.7
--- dynload_next.c	2001年11月21日 04:58:37	2.7.6.1
***************
*** 120,131 ****
 		NSModule newModule;
 		NSSymbol theSym;
- 		void *symaddr;
 		const char *errString;
 	
 		rc = NSCreateObjectFileImageFromFile(pathname, &image);
 		switch(rc) {
 		 default:
 		 case NSObjectFileImageFailure:
! 		 NSObjectFileImageFormat:
 		 /* for these a message is printed on stderr by dyld */
 			errString = "Can't create object file image";
--- 120,135 ----
 		NSModule newModule;
 		NSSymbol theSym;
 		const char *errString;
 	
+ 		if (NSIsSymbolNameDefined(funcname)) {
+ 			theSym = NSLookupAndBindSymbol(funcname);
+ 			p = (dl_funcptr)NSAddressOfSymbol(theSym);
+ 			return p;
+ 		}
 		rc = NSCreateObjectFileImageFromFile(pathname, &image);
 		switch(rc) {
 		 default:
 		 case NSObjectFileImageFailure:
! 		 case NSObjectFileImageFormat:
 		 /* for these a message is printed on stderr by dyld */
 			errString = "Can't create object file image";
***************
*** 140,144 ****
 			errString = "Wrong CPU type in object file";
 			break;
! 		 NSObjectFileImageAccess:
 			errString = "Can't read object file (no access)";
 			break;
--- 144,148 ----
 			errString = "Wrong CPU type in object file";
 			break;
! 		 case NSObjectFileImageAccess:
 			errString = "Can't read object file (no access)";
 			break;

AltStyle によって変換されたページ (->オリジナル) /