Update bytecode to 0.13.0 and simplify patch #225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Fabio,
In my attempts to package pydevd for Debian, I have packaged bytecode separately. (Debian is quite against having vendored copies of software in other packages wherever it can be avoided.) In the process of doing so, I discovered that the patched version of bytecode in pydevd fails some of the bytecode package tests because of a subtle issue: having
stream=sys.stdout
as a default argument indump_bytecode
means thatcontextlib.redirect_stdout()
fails to actually redirect stdout.This PR does several different things:
dump_bytecode
function. Instead it wraps the call to it in_pydevd_frame_eval/pydevd_modify_bytecode.py
inside acontextlib.redirect_stdout
context manager. This simplifies the patch significantly and separates concerns more cleanly. (This function was introduced in Python 3.4 so is available for all versions of Python 3.x that pydevd supports.)_pack_linetable
method; there seems to be no benefit in doing so.This reduces the entire patch size to about 11 changed lines (depending on how you count!).
All of the pydevd tests still pass with both Python 3.9 and 3.10 (except for the two mentioned in #222).