Skip to content

Commit

Permalink
src/bin/sage-env: set PYDEVD_DISABLE_FILE_VALIDATION=1
Browse files Browse the repository at this point in the history
Newer versions of debugpy come with a bundled pydevd that complains
about >=python-3.11's frozen core modules. This causes a doctest
failure,

  File "sage/repl/ipython_kernel/kernel.py", line 48, in sage.repl.ipython_kernel.kernel.SageKernel.__init__
  Failed example:
    from sage.repl.ipython_kernel.kernel import SageKernel
  Expected nothing
  Got:
    0.00s - Debugger warning: It seems that frozen modules are being used, which may
    0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
    0.00s - to python to disable frozen modules.
    0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.

The issue is simply that, with the core modules frozen, the user
cannot place breakpoints in them. The warning however is displayed
whenever you import debugpy, which happens inside ipykernel,
i.e. whenever we merely import SageKernel.

Taking the warning's advice, we set PYDEVD_DISABLE_FILE_VALIDATION=1
in src/bin/sage-env to hide the untimely warning. This does nothing to
change the status quo (you couldn't put breakpoints in frozen modules
before and now you still can't), but it fixes the doctest failure
and makes the old/new versions of debugpy behave consistently.
  • Loading branch information
orlitzky committed Sep 8, 2023
1 parent 6ea1fe9 commit 31a764f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bin/sage-env
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,11 @@ if [ -n "$SAGE_LOCAL" ]; then
fi

fi


# Newer versions of debugpy come with a bundled pydevd that complains
# about >=python-3.11's core modules being frozen (and therefore not
# breakpoint-able). This workaround simply hides the warning to keep
# our doctests predictable (which was the status quo with earlier
# versions of debugpy).
export PYDEVD_DISABLE_FILE_VALIDATION=1

0 comments on commit 31a764f

Please sign in to comment.