Author: Carl Friedrich Bolz <[email protected]>
Branch: remove-objspace-options
Changeset: r83808:a14e75914940
Date: 2016-04-21 19:08 +0300
http://bitbucket.org/pypy/pypy/changeset/a14e75914940/
Log: remove the withprebuiltchar option and make it part of sharesmallstr
(withprebuiltchar was always turned on with O2 and Ojit, but since
sharesmallstr is off, it had no effect)
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -204,10 +204,6 @@
BoolOption("withstrbuf", "use strings optimized for addition (ver 2)",
default=False),
- BoolOption("withprebuiltchar",
- "use prebuilt single-character string objects",
- default=False),
-
BoolOption("sharesmallstr",
"always reuse the prebuilt string objects "
"(the empty string and potentially single-char strings)",
@@ -292,7 +288,6 @@
# all the good optimizations for PyPy should be listed here
if level in ['2', '3', 'jit']:
config.objspace.std.suggest(withmethodcache=True)
- config.objspace.std.suggest(withprebuiltchar=True)
config.objspace.std.suggest(intshortcut=True)
config.objspace.std.suggest(optimized_list_getitem=True)
config.objspace.std.suggest(getattributeshortcut=True)
@@ -312,7 +307,7 @@
if level == 'mem':
config.objspace.std.suggest(withprebuiltint=True)
config.objspace.std.suggest(withliststrategies=True)
- config.objspace.std.suggest(withprebuiltchar=True)
+ config.objspace.std.suggest(sharesmallstr=True)
config.objspace.std.suggest(withmapdict=True)
if not IS_64_BITS:
config.objspace.std.suggest(withsmalllong=True)
diff --git a/pypy/doc/config/objspace.std.withprebuiltchar.txt
b/pypy/doc/config/objspace.std.withprebuiltchar.txt
deleted file mode 100644
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
@@ -847,23 +847,18 @@
def wrapstr(space, s):
if space.config.objspace.std.sharesmallstr:
- if space.config.objspace.std.withprebuiltchar:
- # 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)
- else:
- # only share the empty string
+ # 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.withprebuiltchar and not we_are_jitted():
+ if space.config.objspace.std.sharesmallstr and not we_are_jitted():
return W_BytesObject.PREBUILT[ord(c)]
else:
return W_BytesObject(c)
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
@@ -796,12 +796,5 @@
x = Foo()
assert "hello" + x == 42
-class AppTestPrebuilt(AppTestBytesObject):
- spaceconfig = {"objspace.std.withprebuiltchar": True}
-
class AppTestShare(AppTestBytesObject):
spaceconfig = {"objspace.std.sharesmallstr": True}
-
-class AppTestPrebuiltShare(AppTestBytesObject):
- spaceconfig = {"objspace.std.withprebuiltchar": True,
- "objspace.std.sharesmallstr": True}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit