Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <[email protected]>
  • Loading branch information
mrclary and ccordoba12 committed Oct 19, 2024
1 parent 0a0db98 commit 181f9bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
12 changes: 10 additions & 2 deletions spyder_kernels/console/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,17 @@ def update_syspath(self, new_path, prioritize):
"""
Update the PYTHONPATH of the kernel.
`new_path` corresponds to the new state of the PYTHONPATH.
`prioritize` determines whether to prioritize PYTHONPATH in sys.path.
Parameters
----------
new_path: list of str
List of PYTHONPATH paths.
prioritize: bool
Whether to place PYTHONPATH paths at the front (True) or
back (False) of sys.path.
Notes
-----
A copy of sys.path is made at instantiation, which should be clean,
so we can just prepend/append to the copy without having to explicitly
remove old user paths. PYTHONPATH can just be overwritten.
Expand Down
5 changes: 2 additions & 3 deletions spyder_kernels/console/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
import sys
import site

# Remove current directory from sys.path to prevent kernel
# crashes when people name Python files or modules with
# the same name as standard library modules.
# Remove current directory from sys.path to prevent kernel crashes when people
# name Python files or modules with the same name as standard library modules.
# See spyder-ide/spyder#8007
# Inject it back into sys.path after all imports in this module but
# before the kernel is initialized
Expand Down
4 changes: 2 additions & 2 deletions spyder_kernels/console/tests/test_console_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ def test_runfile(tmpdir):
sys.platform == 'darwin' and sys.version_info[:2] == (3, 8),
reason="Fails on Mac with Python 3.8")
def test_np_threshold(kernel):
"""Test that setting Numpy threshold doesn't make the Variable Explorer
slow.
"""
Test that setting Numpy threshold doesn't make the Variable Explorer slow.
"""

cmd = "from spyder_kernels.console import start; start.main()"
Expand Down

0 comments on commit 181f9bf

Please sign in to comment.