[pypy-svn] rev 2629 - pypy/trunk/src/pypy/module
pmaupin at codespeak.net
pmaupin at codespeak.net
Sat Dec 20 11:31:32 CET 2003
Author: pmaupin
Date: Sat Dec 20 11:31:32 2003
New Revision: 2629
Modified:
pypy/trunk/src/pypy/module/builtin.py
Log:
Added intern() implementation
Modified: pypy/trunk/src/pypy/module/builtin.py
==============================================================================
--- pypy/trunk/src/pypy/module/builtin.py (original)
+++ pypy/trunk/src/pypy/module/builtin.py Sat Dec 20 11:31:32 2003
@@ -698,13 +698,13 @@
return result
def app_intern(self, s):
- """
- We don't have a string table, making intern a null operation.
- This is here for backwards compatibility.
- """
if not isinstance(s, str):
raise TypeError("intern() argument 1 must be string.")
- return s
+ try:
+ t = self._stringtable
+ except AttributeError:
+ t = self._stringtable = {}
+ return t.setdefault(s,s)
def app_copyright(self):
print 'Copyright 2002-2004 Pypy development team.\nAll rights reserved.\nFor further information see http://www.codespaek.net/pypy.\nSome materials may have a different copyright.\nIn these cases, this is explicitly noted in the source code file.'
More information about the Pypy-commit
mailing list