diff Python/bltinmodule.c @ 5092:cb7aadd9d9f2 legacy-trunk

Added intern() function.
author Guido van Rossum <guido@python.org>
date Fri, 14 Feb 1997 15:48:05 +0000
parents f0cf8d275fbc
children bda01a374762
line wrap: on
line diff
--- a/Python/bltinmodule.c	Wed Feb 12 16:49:57 1997 +0000
+++ b/Python/bltinmodule.c	Fri Feb 14 15:48:05 1997 +0000
@@ -840,6 +840,19 @@
 	return res;
 }
 
+static PyObject *
+builtin_intern(self, args)
+	PyObject *self;
+	PyObject *args;
+{
+	PyObject *s;
+	if (!PyArg_ParseTuple(args, "S", &s))
+		return NULL;
+	Py_INCREF(s);
+	PyString_InternInPlace(&s);
+	return s;
+}
+
 static object *
 builtin_int(self, args)
 	object *self;
@@ -1558,6 +1571,7 @@
 	{"hex",		builtin_hex, 1},
 	{"id",		builtin_id, 1},
 	{"input",	builtin_input, 1},
+	{"intern",	builtin_intern, 1},
 	{"int",		builtin_int, 1},
 	{"len",		builtin_len, 1},
 	{"list",	builtin_list, 1},