File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 2424
2525PyObject *idToKey (JSContext *cx, JS::HandleId id) {
2626 JS::RootedValue idv (cx, js::IdToValue (id));
27- JSString * idStr;
27+ JS::RootedString idStr (cx) ;
2828 if (!id.isSymbol ()) { // `JS::ToString` returns `nullptr` for JS symbols
2929 idStr = JS::ToString (cx, idv);
3030 } else {
3131 // TODO (Tom Tang): Revisit this once we have Symbol coercion support
3232 // FIXME (Tom Tang): key collision for symbols without a description string, or pure strings look like "Symbol(xxx)"
3333 idStr = JS_ValueToSource (cx, idv);
3434 }
35+
3536 // We convert all types of property keys to string
36- return StrType (cx, idStr).getPyObject ();
37+ auto chars = JS_EncodeStringToUTF8 (cx, idStr);
38+ return PyUnicode_FromString (chars.get ());
3739}
3840
3941bool idToIndex (JSContext *cx, JS::HandleId id, Py_ssize_t *index) {
You can’t perform that action at this time.
0 commit comments