Skip to content

Commit 9ea88c0

Browse files
committed
Address review comments
1 parent 262abf1 commit 9ea88c0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Python/instrumentation.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,16 @@ get_events(_Py_GlobalMonitors *m, int tool_id)
279279
return result;
280280
}
281281

282-
/* Line delta.
283-
* Variable sized int. Most significant byte first.
284-
* if line_delta == NO_LINE:
285-
* line = None
286-
* else:
287-
* line = first_line + line_delta
288-
*/
289-
290282
/* Module code can have line 0, even though modules start at line 1,
291283
* so -1 is a legal delta. */
292284
#define NO_LINE (-2)
293285

286+
/* Returns the line delta. Defined as:
287+
* if line is None:
288+
* line_delta = NO_LINE
289+
* else:
290+
* line_delta = line - first_line
291+
*/
294292
static int
295293
compute_line_delta(PyCodeObject *code, int line)
296294
{
@@ -369,7 +367,7 @@ set_line_delta(_PyCoLineInstrumentationData *line_data, int index, int line_delt
369367
assert(line_delta >= NO_LINE);
370368
uint32_t adjusted = line_delta - NO_LINE;
371369
uint8_t *ptr = &line_data->data[index*line_data->bytes_per_entry+1];
372-
assert(line_data->bytes_per_entry > 2 || adjusted < 256);
370+
assert(adjusted < (1ULL << (line_data->bytes_per_entry*8)));
373371
if (line_data->bytes_per_entry > 2) {
374372
if (line_data->bytes_per_entry > 3) {
375373
if (line_data->bytes_per_entry > 4) {

0 commit comments

Comments
 (0)