|
144 | 144 | import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile;
|
145 | 145 | import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
|
146 | 146 | import com.oracle.graal.python.nodes.truffle.PythonTypes;
|
147 |
| -import com.oracle.graal.python.nodes.util.CastToJavaIntExactNode; |
| 147 | +import com.oracle.graal.python.nodes.util.CannotCastException; |
148 | 148 | import com.oracle.graal.python.nodes.util.CastToJavaIntLossyNode;
|
| 149 | +import com.oracle.graal.python.nodes.util.CastToJavaLongExactNode; |
149 | 150 | import com.oracle.graal.python.runtime.PythonContext;
|
150 | 151 | import com.oracle.graal.python.runtime.PythonOptions;
|
151 | 152 | import com.oracle.graal.python.runtime.exception.PException;
|
@@ -842,7 +843,7 @@ static int doMemoryViewFlags(PMemoryView object, @SuppressWarnings("unused") Pyt
|
842 | 843 | }
|
843 | 844 |
|
844 | 845 | @Specialization(guards = "eq(MEMORYVIEW_EXPORTS, key)")
|
845 |
| - static int doMemoryViewExports(PMemoryView object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key) { |
| 846 | + static long doMemoryViewExports(PMemoryView object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key) { |
846 | 847 | return object.getExports().get();
|
847 | 848 | }
|
848 | 849 |
|
@@ -1233,8 +1234,12 @@ static Object doTpDictoffset(PythonManagedClass object, @SuppressWarnings("unuse
|
1233 | 1234 |
|
1234 | 1235 | @Specialization(guards = "eq(MEMORYVIEW_EXPORTS, key)")
|
1235 | 1236 | static Object doMemoryViewExports(PMemoryView object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key, Object value,
|
1236 |
| - @Cached CastToJavaIntExactNode cast) { |
1237 |
| - object.getExports().set(cast.execute(value)); |
| 1237 | + @Cached CastToJavaLongExactNode cast) { |
| 1238 | + try { |
| 1239 | + object.getExports().set(cast.execute(value)); |
| 1240 | + } catch (CannotCastException | PException e) { |
| 1241 | + throw CompilerDirectives.shouldNotReachHere("Failed to set memoryview exports: invalid type"); |
| 1242 | + } |
1238 | 1243 | return value;
|
1239 | 1244 | }
|
1240 | 1245 |
|
|
0 commit comments