Skip to content

Commit 67ad7ab

Browse files
committed
Fix PyUnicodeDecodeError_Create
1 parent a620166 commit 67ad7ab

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/cpyext/test_unicode.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,16 @@ class TestPyUnicode(CPyExtTestCase):
11321132
cmpfunc=unhandled_error_compare,
11331133
)
11341134

1135+
test_PyUnicodeDecodeError_Create = CPyExtFunction(
1136+
lambda args: UnicodeDecodeError(*args),
1137+
lambda: (
1138+
("utf-8", b"asdf", 1, 2, "some reason"),
1139+
),
1140+
resultspec="O",
1141+
argspec="sy#nns",
1142+
arguments=["const char* encoding", "const char* object", "Py_ssize_t length", "Py_ssize_t start", "Py_ssize_t end", "const char* reason"]
1143+
)
1144+
11351145

11361146
class TestUnicodeObject(unittest.TestCase):
11371147
def test_intern(self):

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextUnicodeBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ static Object doNull(@SuppressWarnings("unused") PNone noValue) {
11771177
@CApiBuiltin(ret = PyObjectTransfer, args = {ConstCharPtrAsTruffleString, ConstCharPtr, Py_ssize_t, Py_ssize_t, Py_ssize_t, ConstCharPtrAsTruffleString}, call = Direct)
11781178
abstract static class PyUnicodeDecodeError_Create extends CApi6BuiltinNode {
11791179
@Specialization
1180-
static Object doit(Object encoding, Object object, int length, int start, int end, Object reason,
1180+
static Object doit(Object encoding, Object object, long length, long start, long end, Object reason,
11811181
@Bind("this") Node inliningTarget,
11821182
@Cached GetByteArrayNode getByteArrayNode,
11831183
@Cached CallNode callNode,

0 commit comments

Comments
 (0)