|
75 | 75 | import com.oracle.graal.python.builtins.objects.itertools.PZipLongest;
|
76 | 76 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.IsTypeNode;
|
77 | 77 | import com.oracle.graal.python.lib.PyCallableCheckNode;
|
| 78 | +import com.oracle.graal.python.lib.PyLongAsIntNode; |
78 | 79 | import com.oracle.graal.python.lib.PyNumberAsSizeNode;
|
79 | 80 | import com.oracle.graal.python.lib.PyObjectGetIter;
|
80 | 81 | import com.oracle.graal.python.lib.PyObjectLookupAttr;
|
@@ -773,8 +774,18 @@ Object construct(Object cls, Object object, int times,
|
773 | 774 | return self;
|
774 | 775 | }
|
775 | 776 |
|
| 777 | + @Specialization(guards = {"isTypeNode.execute(cls)", "times >= 0"}) |
| 778 | + Object construct(VirtualFrame frame, Object cls, Object object, long times, |
| 779 | + @Cached PyLongAsIntNode asIntNode, |
| 780 | + @SuppressWarnings("unused") @Cached IsTypeNode isTypeNode) { |
| 781 | + PRepeat self = factory().createRepeat(cls); |
| 782 | + self.setElement(object); |
| 783 | + self.setCnt(asIntNode.execute(frame, times)); |
| 784 | + return self; |
| 785 | + } |
| 786 | + |
776 | 787 | @SuppressWarnings("unused")
|
777 |
| - @Specialization(guards = {"isTypeNode.execute(cls)", "!isNone(times)", "!isInt(times)"}) |
| 788 | + @Specialization(guards = {"isTypeNode.execute(cls)", "!isNone(times)", "!isInt(times)", "!isLong(times)"}) |
778 | 789 | Object construct(Object cls, Object object, Object times,
|
779 | 790 | @SuppressWarnings("unused") @Cached IsTypeNode isTypeNode) {
|
780 | 791 | throw raise(TypeError, S_EXPECTED_GOT_P, "integer", times);
|
|
0 commit comments