mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
These were reverted in gh-26530 (commit17c4edc
) due to refleaks. *2c1e258
- Compute deref offsets in compiler (gh-25152) *b2bf2bc
- Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388) This change fixes the refleaks. https://bugs.python.org/issue43693
This commit is contained in:
parent
001eb520b5
commit
2ab27c4af4
23 changed files with 6044 additions and 5710 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "pycore_frame.h"
|
||||
|
||||
#include "pycore_pyerrors.h"
|
||||
#include "pycore_code.h" // _PyCode_GetVarnames()
|
||||
|
||||
#define MAX_CANDIDATE_ITEMS 750
|
||||
#define MAX_STRING_SIZE 40
|
||||
|
@ -210,8 +211,13 @@ offer_suggestions_for_name_error(PyNameErrorObject *exc)
|
|||
PyFrameObject *frame = traceback->tb_frame;
|
||||
assert(frame != NULL);
|
||||
PyCodeObject *code = PyFrame_GetCode(frame);
|
||||
assert(code != NULL && code->co_varnames != NULL);
|
||||
PyObject *dir = PySequence_List(code->co_varnames);
|
||||
assert(code != NULL && code->co_localsplusnames != NULL);
|
||||
PyObject *varnames = _PyCode_GetVarnames(code);
|
||||
if (varnames == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
PyObject *dir = PySequence_List(varnames);
|
||||
Py_DECREF(varnames);
|
||||
Py_DECREF(code);
|
||||
if (dir == NULL) {
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue