8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa438bd commit befbad3Copy full SHA for befbad3
Python/symtable.c
@@ -497,18 +497,14 @@ _PySymtable_Lookup(struct symtable *st, void *key)
497
k = PyLong_FromVoidPtr(key);
498
if (k == NULL)
499
return NULL;
500
- v = PyDict_GetItemWithError(st->st_blocks, k);
501
- Py_DECREF(k);
502
-
503
- if (v) {
504
- assert(PySTEntry_Check(v));
505
- }
506
- else if (!PyErr_Occurred()) {
+ if (PyDict_GetItemRef(st->st_blocks, k, &v) == 0) {
507
PyErr_SetString(PyExc_KeyError,
508
"unknown symbol table entry");
509
}
+ Py_DECREF(k);
510
511
- return (PySTEntryObject *)Py_XNewRef(v);
+ assert(v == NULL || PySTEntry_Check(v));
+ return (PySTEntryObject *)v;
512
513
514
long
0 commit comments