Author: Armin Rigo <[email protected]>
Branch: remove-objspace-options
Changeset: r83852:d905304eb5a8
Date: 2016-04-25 10:24 +0200
http://bitbucket.org/pypy/pypy/changeset/d905304eb5a8/
Log: Remove 'sharesmallstr'
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -204,11 +204,6 @@
BoolOption("withstrbuf", "use strings optimized for addition (ver 2)",
default=False),
- BoolOption("sharesmallstr",
- "always reuse the prebuilt string objects "
- "(the empty string and potentially single-char strings)",
- default=False),
-
BoolOption("withspecialisedtuple",
"use specialised tuples",
default=False),
@@ -272,7 +267,6 @@
if level == 'mem':
config.objspace.std.suggest(withprebuiltint=True)
config.objspace.std.suggest(withliststrategies=True)
- config.objspace.std.suggest(sharesmallstr=True)
if not IS_64_BITS:
config.objspace.std.suggest(withsmalllong=True)
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -841,29 +841,12 @@
return [s for s in value]
W_BytesObject.EMPTY = W_BytesObject('')
-W_BytesObject.PREBUILT = [W_BytesObject(chr(i)) for i in range(256)]
-del i
def wrapstr(space, s):
- if space.config.objspace.std.sharesmallstr:
- # share characters and empty string
- if len(s) <= 1:
- if len(s) == 0:
- return W_BytesObject.EMPTY
- else:
- s = s[0] # annotator hint: a single char
- return wrapchar(space, s)
return W_BytesObject(s)
-def wrapchar(space, c):
- if space.config.objspace.std.sharesmallstr and not we_are_jitted():
- return W_BytesObject.PREBUILT[ord(c)]
- else:
- return W_BytesObject(c)
-
-
W_BytesObject.typedef = TypeDef(
"str", basestring_typedef,
__new__ = interp2app(W_BytesObject.descr_new),
diff --git a/pypy/objspace/std/test/test_bytesobject.py
b/pypy/objspace/std/test/test_bytesobject.py
--- a/pypy/objspace/std/test/test_bytesobject.py
+++ b/pypy/objspace/std/test/test_bytesobject.py
@@ -795,6 +795,3 @@
return 42
x = Foo()
assert "hello" + x == 42
-
-class AppTestShare(AppTestBytesObject):
- spaceconfig = {"objspace.std.sharesmallstr": True}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit