Skip to content

Commit 31a764f

Browse files
committed
src/bin/sage-env: set PYDEVD_DISABLE_FILE_VALIDATION=1
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.
1 parent 6ea1fe9 commit 31a764f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bin/sage-env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,3 +635,11 @@ if [ -n "$SAGE_LOCAL" ]; then
635635
fi
636636

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

0 commit comments

Comments
 (0)