summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-02-14 15:48:05 (GMT)
committerGuido van Rossum <guido@python.org>1997-02-14 15:48:05 (GMT)
commite8811f85ed7c1a1087ee371f236e33cf4f159568 (patch)
tree73f09876c3b2d5ba5fbc5d9c738499bac54fcb70 /Python/bltinmodule.c
parent17ca9928188d9d1e22a06b3d562e32616ca64524 (diff)
downloadcpython-e8811f85ed7c1a1087ee371f236e33cf4f159568.zip
cpython-e8811f85ed7c1a1087ee371f236e33cf4f159568.tar.gz
cpython-e8811f85ed7c1a1087ee371f236e33cf4f159568.tar.bz2
Added intern() function.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index b3cb6f7..d1dc9a5 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -840,6 +840,19 @@ builtin_input(self, args)
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 @@ static struct methodlist builtin_methods[] = {
{"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},