Skip to content

Commit

Permalink
Suppress co_linetable of dummy code to avoid a crash in pytest-cov
Browse files Browse the repository at this point in the history
  • Loading branch information
Azureblade3808 committed Sep 12, 2024
1 parent 67ae94c commit ea4cda2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deferrer/_defer.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def __bool__() -> Literal[False]:
)
dummy_consts += (value,)

# Copy the bytecode of the `...` part in `defer and ...` into the dummy
# Copy the bytecode of the RHS part in `defer and ...` into the dummy
# function.
n_skipped_bytes = code_bytes[i_code_byte + 1] * 2
dummy_code_bytes += code_bytes[
Expand All @@ -192,6 +192,7 @@ def __bool__() -> Literal[False]:
co_kwonlyargcount=0,
co_code=dummy_code_bytes,
co_consts=dummy_consts,
co_linetable=bytes(),
)

new_function = FunctionType(
Expand Down

0 comments on commit ea4cda2

Please sign in to comment.