diff Python/import.c @ 1415:06570429f062 legacy-trunk

* import.c (get_module): pass .py filename to parse_file, not .pyc filename! * funcobject.c (func_repr): don't call getstringvalue(None) for anonymous functions. * bltinmodule.c: removed lambda (which is now a built-in function); removed implied lambda for string arg to filter/map/reduce. * Grammar, graminit.[ch], compile.[ch]: replaced lambda as built-in function by lambda as grammar entity: instead of "lambda('x: x+1')" you write "lambda x: x+1". * Xtmodule.c (checkargdict): return 0, not NULL, for error.
author Guido van Rossum <guido@python.org>
date Tue, 30 Nov 1993 13:40:46 +0000
parents 315272ec4d5b
children d1e6c9a64a56
line wrap: on
line diff
--- a/Python/import.c	Tue Nov 23 17:54:03 1993 +0000
+++ b/Python/import.c	Tue Nov 30 13:40:46 1993 +0000
@@ -174,7 +174,8 @@
 
 	case PY_SOURCE:
 		mtime = getmtime(namebuf);
-		strcat(namebuf, "c");
+		len = strlen(namebuf);
+		strcpy(namebuf + len, "c");
 		fpc = fopen(namebuf, "rb");
 		if (fpc != NULL) {
 			magic = rd_long(fpc);
@@ -204,6 +205,7 @@
 			}
 			fclose(fpc);
 		}
+		namebuf[len] = '\0';
 		err = parse_file(fp, namebuf, file_input, &n);
 		if (err != E_DONE) {
 			err_input(err);
@@ -215,9 +217,9 @@
 			return NULL;
 		if (verbose)
 			fprintf(stderr,
-				"import %s # from %.*s\n",
-				name, strlen(namebuf)-1, namebuf);
+				"import %s # from %s\n", name, namebuf);
 		/* Now write the code object to the ".pyc" file */
+		strcpy(namebuf + len, "c");
 		fpc = fopen(namebuf, "wb");
 		if (fpc == NULL) {
 			if (verbose)