@@ -79,7 +79,7 @@ static bool toPrimitive(JSContext *cx, unsigned argc, JS::Value *vp) {
79
79
_PyUnicodeWriter writer;
80
80
81
81
_PyUnicodeWriter_Init (&writer);
82
-
82
+
83
83
PyObject *s = PyObject_Repr (self);
84
84
85
85
if (s == nullptr ) {
@@ -95,8 +95,8 @@ static bool toPrimitive(JSContext *cx, unsigned argc, JS::Value *vp) {
95
95
return true ;
96
96
}
97
97
98
- PyObject* repr = _PyUnicodeWriter_Finish (&writer);
99
-
98
+ PyObject * repr = _PyUnicodeWriter_Finish (&writer);
99
+
100
100
args.rval ().set (jsTypeFactory (cx, repr));
101
101
return true ;
102
102
}
@@ -262,7 +262,7 @@ bool PyIterableProxyHandler::getOwnPropertyDescriptor(
262
262
// symbol property
263
263
if (id.isSymbol ()) {
264
264
JS::RootedSymbol rootedSymbol (cx, id.toSymbol ());
265
- JS::SymbolCode symbolCode = JS::GetSymbolCode (rootedSymbol);
265
+ JS::SymbolCode symbolCode = JS::GetSymbolCode (rootedSymbol);
266
266
267
267
if (symbolCode == JS::SymbolCode::iterator) {
268
268
JSFunction *newFunction = JS_NewFunction (cx, iterable_values, 0 , 0 , NULL );
@@ -275,7 +275,7 @@ bool PyIterableProxyHandler::getOwnPropertyDescriptor(
275
275
)
276
276
));
277
277
return true ;
278
- }
278
+ }
279
279
else if (symbolCode == JS::SymbolCode::toPrimitive) {
280
280
JSFunction *newFunction = JS_NewFunction (cx, toPrimitive, 0 , 0 , nullptr );
281
281
if (!newFunction) return false ;
@@ -293,6 +293,9 @@ bool PyIterableProxyHandler::getOwnPropertyDescriptor(
293
293
PyObject *attrName = idToKey (cx, id);
294
294
PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
295
295
PyObject *item = PyObject_GetAttr (self, attrName);
296
+ if (!item && PyErr_ExceptionMatches (PyExc_AttributeError)) {
297
+ PyErr_Clear (); // clear error, we will be returning undefined in this case
298
+ }
296
299
297
300
return handleGetOwnPropertyDescriptor (cx, id, desc, item);
298
301
}
0 commit comments