[Python-checkins] python/dist/src/Mac/Python macimport.c,1.15,1.16

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Mon, 22 Jul 2002 05:35:24 -0700


Update of /cvsroot/python/python/dist/src/Mac/Python
In directory usw-pr-cvs1:/tmp/cvs-serv16522

Modified Files:
	macimport.c 
Log Message:
Fixed potential refcount problems with interned strings, adapted comments, added a bit more trace output if verbose > 1.

Index: macimport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Python/macimport.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** macimport.c	11 Apr 2002 20:48:14 -0000	1.15
--- macimport.c	22 Jul 2002 12:35:22 -0000	1.16
***************
*** 69,73 ****
  
  	/*
! 	** If we have interning find_module takes care of interning all
  	** sys.path components. We then keep a record of all sys.path
  	** components for which GetFInfo has failed (usually because the
--- 69,73 ----
  
  	/*
! 	** Find_module takes care of interning all
  	** sys.path components. We then keep a record of all sys.path
  	** components for which GetFInfo has failed (usually because the
***************
*** 86,92 ****
  	}
  	if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) {
! 		if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned )
  			not_a_file[max_not_a_file++] = obj;
! 	     	/* doesn't exist or is folder */
  		return 0;
  	}			
--- 86,96 ----
  	}
  	if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) {
! 	     /* doesn't exist or is folder */
! 		if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) {
! 			Py_INCREF(obj);
  			not_a_file[max_not_a_file++] = obj;
! 			if (Py_VerboseFlag > 1)
! 				PySys_WriteStderr("# %s is not a file\n", filename);
! 		}
  		return 0;
  	}			
***************
*** 101,108 ****
  		filerh = -1;
  	} else {
! 	     	if ( FSpGetFInfo(&fss, &finfo) != noErr ) {
! 			if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned )
  				not_a_file[max_not_a_file++] = obj;
! 	     		/* doesn't exist or is folder */
  			return 0;
  		}			
--- 105,116 ----
  		filerh = -1;
  	} else {
!      	if ( FSpGetFInfo(&fss, &finfo) != noErr ) {
!      		/* doesn't exist or is folder */
! 			if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) {
! 				Py_INCREF(obj);
  				not_a_file[max_not_a_file++] = obj;
! 				if (Py_VerboseFlag > 1)
! 					PySys_WriteStderr("# %s is not a file\n", filename);
! 			}
  			return 0;
  		}			
***************
*** 115,118 ****
--- 123,128 ----
  	if ( dataptr == NULL )
  		SetResLoad(0);
+ 	if (Py_VerboseFlag > 1)
+ 		PySys_WriteStderr("# Look for ('PYC ', %s) in %s\n", module, filename);
  	h = Get1NamedResource(restype, Pstring(module));
  	SetResLoad(1);