File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ PyObject *StrType::proxifyString(JSContext *cx, JS::HandleValue strVal) {
139
139
// Short path to temporarily fix the issue with Python 3.13+ compact unicode representation.
140
140
// It would error with `ValueError: embedded null character`, which is caused by the fact that
141
141
// most Python C APIs assume the string buffer is null-terminated, so we need to create a copy.
142
- PyObject *copied = PyUnicode_FromObject ((PyObject *)pyString); // create a copy when it's not a true Unicode object
142
+ PyObject *copied = PyUnicode_FromKindAndData (PyUnicode_1BYTE_KIND, chars, length);
143
143
Py_DECREF (pyString);
144
144
return copied;
145
145
}
@@ -166,7 +166,7 @@ PyObject *StrType::proxifyString(JSContext *cx, JS::HandleValue strVal) {
166
166
else { // utf16 spidermonkey, ucs2 python
167
167
const char16_t *chars = JS::GetTwoByteLinearStringChars (nogc, lstr);
168
168
if ((PY_VERSION_HEX) >= 0x030d0000 ) { // Python 3.13+, see above
169
- PyObject *copied = PyUnicode_FromObject ((PyObject *)pyString); // create a copy when it's not a true Unicode object
169
+ PyObject *copied = PyUnicode_FromKindAndData (PyUnicode_2BYTE_KIND, chars, length);
170
170
Py_DECREF (pyString);
171
171
return copied;
172
172
}
You can’t perform that action at this time.
0 commit comments