File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,27 +149,27 @@ extern char *getenv();
149149char *
150150getpythonpath ()
151151{
152- #ifdef macintosh
153- return PYTHONPATH ;
154- #else /* !macintosh */
155152 char * path = getenv ("PYTHONPATH" );
156153 char * defpath = PYTHONPATH ;
157- char * buf ;
154+ static char * buf = NULL ;
158155 char * p ;
159156 int n ;
160157
161- if (path == 0 || * path == '\0' )
162- return defpath ;
158+ if (path == NULL )
159+ path = "" ;
163160 n = strlen (path ) + strlen (defpath ) + 2 ;
161+ if (buf != NULL ) {
162+ free (buf );
163+ buf = NULL ;
164+ }
164165 buf = malloc (n );
165166 if (buf == NULL )
166- return path ; /* XXX too bad -- but not likely */
167+ fatal ( "not enough memory to copy module search path" );
167168 strcpy (buf , path );
168169 p = buf + strlen (buf );
169170 * p ++ = DELIM ;
170171 strcpy (p , defpath );
171172 return buf ;
172- #endif /* !macintosh */
173173}
174174
175175
You can’t perform that action at this time.
0 commit comments