Skip to content

Commit 7b09279

Browse files
authored
Add comments for deref and hash_bytecode
1 parent 0a2817b commit 7b09279

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

line_profiler/_line_profiler.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,10 @@ cdef inline inner_trace_callback(
14401440
# in tests it only seems to add overhead...
14411441
for i in range(size):
14421442
if data[i]:
1443+
# hash_bytecode is currently unused due to test issues on Windows with PyObject_Hash
1444+
# but we plan to fix those and enable it shortly
14431445
# block_hash = hash_bytecode(<PyObject *>py_bytes_obj, data, size)
1446+
14441447
# because we use Python functions like hash, we CANNOT mark this function as nogil
14451448
block_hash = hash(py_bytes_obj)
14461449
break
@@ -1460,6 +1463,9 @@ cdef inline inner_trace_callback(
14601463
has_time = True
14611464
ident = PyThread_get_thread_ident()
14621465
last_map = &(prof._c_last_time[ident])
1466+
# deref() is Cython's version of the -> accessor in C++. if we don't use deref then
1467+
# Cython thinks that when we index last_map,
1468+
# we want pointer indexing (which is not the case)
14631469
if deref(last_map).count(block_hash):
14641470
old = deref(last_map)[block_hash]
14651471
line_entries = &(prof._c_code_map[code_hash])

0 commit comments

Comments
 (0)