diff options
author | Andrew Kuchling <amk@amk.ca> | 2014-04-14 18:19:52 (GMT) |
---|---|---|
committer | Andrew Kuchling <amk@amk.ca> | 2014-04-14 18:19:52 (GMT) |
commit | 6283691d461ab3d378d56e9a23a1499a8ad2e655 (patch) | |
tree | 587b33272914cb3a02dd8e4430d58f26ac49fe92 /Include | |
parent | 7f54b2bf710a2d7653090b54f50c2874104653dc (diff) | |
download | cpython-6283691d461ab3d378d56e9a23a1499a8ad2e655.zip cpython-6283691d461ab3d378d56e9a23a1499a8ad2e655.tar.gz cpython-6283691d461ab3d378d56e9a23a1499a8ad2e655.tar.bz2 |
#11983: update comment to describe which fields are used and why.
Original patch by Caelyn McAulay; modified after discussion w/ her at
the PyCon 2014 sprints.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/code.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Include/code.h b/Include/code.h index 7c7e5bf..ff2b97e 100644 --- a/Include/code.h +++ b/Include/code.h @@ -21,7 +21,12 @@ typedef struct { PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ - /* The rest doesn't count for hash or comparisons */ + /* The rest aren't used in either hash or comparisons, except for + co_name (used in both) and co_firstlineno (used only in + comparisons). This is done to preserve the name and line number + for tracebacks and debuggers; otherwise, constant de-duplication + would collapse identical functions/lambdas defined on different lines. + */ unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */ PyObject *co_filename; /* unicode (where it was loaded from) */ PyObject *co_name; /* unicode (name, for reference) */ |