[pypy-commit] pypy jit-ordereddict: A few more operations that don't return a constant bytearray.
arigo
noreply at buildbot.pypy.org
Wed Dec 25 23:12:04 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-ordereddict
Changeset: r68550:708ec7898dbc
Date: 2013-12-25 22:59 +0100
http://bitbucket.org/pypy/pypy/changeset/708ec7898dbc/
Log: A few more operations that don't return a constant bytearray.
diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
--- a/rpython/annotator/binaryop.py
+++ b/rpython/annotator/binaryop.py
@@ -412,10 +412,7 @@
return SomeByteArray(can_be_None=can_be_None)
def add((b1, b2)):
- result = SomeByteArray()
- if b1.is_immutable_constant() and b2.is_immutable_constant():
- result.const = b1.const + b2.const
- return result
+ return SomeByteArray()
class __extend__(pairtype(SomeByteArray, SomeInteger)):
def getitem((s_b, s_i)):
@@ -429,10 +426,7 @@
pairtype(SomeChar, SomeByteArray),
pairtype(SomeByteArray, SomeChar)):
def add((b1, b2)):
- result = SomeByteArray()
- if b1.is_immutable_constant() and b2.is_immutable_constant():
- result.const = b1.const + b2.const
- return result
+ return SomeByteArray()
class __extend__(pairtype(SomeChar, SomeChar)):
diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
--- a/rpython/annotator/model.py
+++ b/rpython/annotator/model.py
@@ -215,7 +215,8 @@
class SomeStringOrUnicode(SomeObject):
- """Base class for shared implementation of SomeString and SomeUnicodeString.
+ """Base class for shared implementation of SomeString,
+ SomeUnicodeString and SomeByteArray.
Cannot be an annotation."""
@@ -228,6 +229,7 @@
if can_be_None:
self.can_be_None = True
if no_nul:
+ assert self.immutable #'no_nul' cannot be used with SomeByteArray
self.no_nul = True
def can_be_none(self):
@@ -263,6 +265,7 @@
class SomeByteArray(SomeStringOrUnicode):
+ immutable = False
knowntype = bytearray
More information about the pypy-commit
mailing list