Skip to content

Commit 2bec6aa

Browse files
author
Franziska Geiger
committed
Make radd a node again
1 parent 8707cf9 commit 2bec6aa

File tree

2 files changed

+9
-5
lines changed
  • graalpython

2 files changed

+9
-5
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_re.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def test_getattr(self):
379379
self.assertEqual(re.compile("(?i)(a)(b)").pattern, "(?i)(a)(b)")
380380
# TODO at the moment, we use slightly different default flags
381381
#self.assertEqual(re.compile("(?i)(a)(b)").flags, re.I | re.U)
382-
382+
383383
# TODO re-enable this test once TRegex provides this property
384384
#self.assertEqual(re.compile("(?i)(a)(b)").groups, 2)
385385
self.assertEqual(re.compile("(?i)(a)(b)").groupindex, {})
@@ -399,7 +399,7 @@ def test_getattr(self):
399399
p = re.compile(r'(?i)(?P<first>a)(?P<other>b)')
400400
self.assertEqual(sorted(p.groupindex), ['first', 'other'])
401401
self.assertEqual(p.groupindex['other'], 2)
402-
402+
403403
if sys.version_info.minor >= 6:
404404
with self.assertRaises(TypeError):
405405
p.groupindex['other'] = 0
@@ -447,8 +447,8 @@ def test_escaping(self):
447447
self.assertTrue(match)
448448
assert "frac" in match.groupdict()
449449
assert match.groupdict()["frac"] == "1"
450-
451-
450+
451+
452452
def test_escape(self):
453453
self.assertEqual(re.escape(" ()"), "\\ \\(\\)")
454454

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str/StringBuiltins.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ public abstract static class AddNode extends PythonBinaryBuiltinNode {
345345
protected final ConditionProfile rightProfile1 = ConditionProfile.createBinaryProfile();
346346
protected final ConditionProfile rightProfile2 = ConditionProfile.createBinaryProfile();
347347

348+
public static AddNode create() {
349+
return StringBuiltinsFactory.AddNodeFactory.create();
350+
}
351+
348352
@Specialization(guards = "!concatGuard(self, other)")
349353
String doSSSimple(String self, String other) {
350354
if (LazyString.length(self, leftProfile1, leftProfile2) == 0) {
@@ -447,7 +451,7 @@ protected boolean concatGuard(CharSequence left, CharSequence right) {
447451

448452
@Builtin(name = __RADD__, minNumOfPositionalArgs = 2)
449453
@GenerateNodeFactory
450-
public abstract static class RAddNode {
454+
public abstract static class RAddNode extends PythonBinaryBuiltinNode{
451455
@Specialization
452456
Object doAll(VirtualFrame frame, Object left, Object right,
453457
@Cached("create()") AddNode addNode) {

0 commit comments

Comments
 (0)