Hello community, here is the log from the commit of package python-spyder-kernels for openSUSE:Factory checked in at 2020-07-14 07:56:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-spyder-kernels (Old) and /work/SRC/openSUSE:Factory/.python-spyder-kernels.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-spyder-kernels" Tue Jul 14 07:56:36 2020 rev:16 rq:820033 version:1.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-spyder-kernels/python-spyder-kernels.changes 2020-05-14 23:28:37.997483645 +0200 +++ /work/SRC/openSUSE:Factory/.python-spyder-kernels.new.3060/python-spyder-kernels.changes 2020-07-14 07:58:56.993723638 +0200 @@ -1,0 +2,27 @@ +Fri Jul 10 17:57:33 UTC 2020 - Benjamin Greiner <c...@bnavigator.de> + +- Update to version 1.9.2 + * PR gh#spyder-ide/spyder-kernels#234 + Fix a problem caused by ipykernel 5.3.1, by @ccordoba12 + * PR gh#spyder-ide/spyder-kernels#231 + Send comm config on every message, by @impact27 + * PR gh#spyder-ide/spyder-kernels#230 + Send comm config before any wait just to be sure, by @impact27 + * PR gh#spyder-ide/spyder-kernels#229 + Add warning on console if file is not saved, by @impact27 + * PR gh#spyder-ide/spyder-kernels#228 + Fix post_mortem interaction, by @dalthviz + * PR gh#spyder-ide/spyder-kernels#227 + Create a constant for numeric Numpy types, by @dalthviz + * PR gh#spyder-ide/spyder-kernels#226 + Backport PR 225, by @ccordoba12 + * PR gh#spyder-ide/spyder-kernels#222 + Remove the current working directory from sys.path for Python 3.7+, + by @ccordoba12 + * PR gh#spyder-ide/spyder-kernels#220 + Make multithreading patch work for all OSes in Python 3, + by @steff456 (gh#spyder-ide/spyder#12465) +- use pytest macro +- add scipy and dask-distributed to test requirements + +------------------------------------------------------------------- Old: ---- python-spyder-kernels-1.9.1.tar.gz New: ---- python-spyder-kernels-1.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-spyder-kernels.spec ++++++ --- /var/tmp/diff_new_pack.fqaLzJ/_old 2020-07-14 07:58:57.661725801 +0200 +++ /var/tmp/diff_new_pack.fqaLzJ/_new 2020-07-14 07:58:57.665725814 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-spyder-kernels -Version: 1.9.1 +Version: 1.9.2 Release: 0 Summary: Jupyter kernels for Spyder's console License: MIT @@ -32,6 +32,7 @@ BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module cloudpickle} +BuildRequires: %{python_module dask-distributed} BuildRequires: %{python_module flaky} BuildRequires: %{python_module ipykernel >= 4.8.2} BuildRequires: %{python_module jupyter_client >= 5.2.3} @@ -40,6 +41,7 @@ BuildRequires: %{python_module pandas} BuildRequires: %{python_module pytest} BuildRequires: %{python_module pyzmq >= 17} +BuildRequires: %{python_module scipy} BuildRequires: %{python_module wurlitzer} BuildRequires: %{python_module xarray} # /SECTION @@ -73,9 +75,7 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -rm -rf _build.python* -rm -rf build -%python_expand pytest-%{$python_bin_suffix} +%pytest -v %files %{python_files} %doc CHANGELOG.md README.md ++++++ python-spyder-kernels-1.9.1.tar.gz -> python-spyder-kernels-1.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/.github/workflows/windows-tests.yml new/spyder-kernels-1.9.2/.github/workflows/windows-tests.yml --- old/spyder-kernels-1.9.1/.github/workflows/windows-tests.yml 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/.github/workflows/windows-tests.yml 2020-07-10 07:45:01.000000000 +0200 @@ -19,7 +19,7 @@ strategy: fail-fast: false matrix: - PYTHON_VERSION: ['2.7', '3.6', '3.7', '3.8'] + PYTHON_VERSION: ['3.6', '3.7', '3.8'] steps: - name: Checkout branch uses: actions/checkout@v1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/CHANGELOG.md new/spyder-kernels-1.9.2/CHANGELOG.md --- old/spyder-kernels-1.9.1/CHANGELOG.md 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/CHANGELOG.md 2020-07-10 07:45:01.000000000 +0200 @@ -1,5 +1,23 @@ # History of changes +## Version 1.9.2 (2020-07-10) + +### Pull Requests Merged + +* [PR 234](https://github.com/spyder-ide/spyder-kernels/pull/234) - PR: Fix a problem caused by ipykernel 5.3.1, by [@ccordoba12](https://github.com/ccordoba12) +* [PR 231](https://github.com/spyder-ide/spyder-kernels/pull/231) - PR: Send comm config on every message, by [@impact27](https://github.com/impact27) +* [PR 230](https://github.com/spyder-ide/spyder-kernels/pull/230) - PR: Send comm config before any wait just to be sure, by [@impact27](https://github.com/impact27) +* [PR 229](https://github.com/spyder-ide/spyder-kernels/pull/229) - PR: Add warning on console if file is not saved, by [@impact27](https://github.com/impact27) +* [PR 228](https://github.com/spyder-ide/spyder-kernels/pull/228) - PR: Fix post_mortem interaction, by [@dalthviz](https://github.com/dalthviz) +* [PR 227](https://github.com/spyder-ide/spyder-kernels/pull/227) - PR: Create a constant for numeric Numpy types, by [@dalthviz](https://github.com/dalthviz) +* [PR 226](https://github.com/spyder-ide/spyder-kernels/pull/226) - PR: Backport PR 225, by [@ccordoba12](https://github.com/ccordoba12) +* [PR 222](https://github.com/spyder-ide/spyder-kernels/pull/222) - PR: Remove the current working directory from sys.path for Python 3.7+, by [@ccordoba12](https://github.com/ccordoba12) +* [PR 220](https://github.com/spyder-ide/spyder-kernels/pull/220) - PR: Make multithreading patch work for all OSes in Python 3, by [@steff456](https://github.com/steff456) ([12465](https://github.com/spyder-ide/spyder/issues/12465)) + +In this release 9 pull requests were closed. + +---- + ## Version 1.9.1 (2020-05-06) ### Issues Closed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/requirements/tests.txt new/spyder-kernels-1.9.2/requirements/tests.txt --- old/spyder-kernels-1.9.1/requirements/tests.txt 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/requirements/tests.txt 2020-07-10 07:45:01.000000000 +0200 @@ -1,5 +1,6 @@ codecov cython +dask flaky matplotlib mock diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/setup.py new/spyder-kernels-1.9.2/setup.py --- old/spyder-kernels-1.9.1/setup.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/setup.py 2020-07-10 07:45:01.000000000 +0200 @@ -47,6 +47,7 @@ TEST_REQUIREMENTS = [ 'codecov', 'cython', + 'dask', 'flaky', 'matplotlib', 'mock', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/_version.py new/spyder-kernels-1.9.2/spyder_kernels/_version.py --- old/spyder-kernels-1.9.1/spyder_kernels/_version.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/_version.py 2020-07-10 07:45:01.000000000 +0200 @@ -8,5 +8,5 @@ """Version File.""" -VERSION_INFO = (1, 9, 1) +VERSION_INFO = (1, 9, 2) __version__ = '.'.join(map(str, VERSION_INFO)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/comms/commbase.py new/spyder-kernels-1.9.2/spyder_kernels/comms/commbase.py --- old/spyder-kernels-1.9.1/spyder_kernels/comms/commbase.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/comms/commbase.py 2020-07-10 07:45:01.000000000 +0200 @@ -335,6 +335,7 @@ def _handle_remote_call(self, msg, buffer): """Handle a remote call.""" msg_dict = msg['content'] + self.on_incoming_call(msg_dict) try: return_value = self._remote_callback( msg_dict['call_name'], @@ -385,6 +386,16 @@ if blocking or callback is not None: self._reply_waitlist[call_id] = blocking, callback + def on_outgoing_call(self, call_dict): + """A message is about to be sent""" + call_dict["pickle_highest_protocol"] = pickle.HIGHEST_PROTOCOL + return call_dict + + def on_incoming_call(self, call_dict): + """A call was received""" + if "pickle_highest_protocol" in call_dict: + self._set_pickle_protocol(call_dict["pickle_highest_protocol"]) + def _get_call_return_value(self, call_dict, call_data, comm_id): """ Send a remote call and return the reply. @@ -392,6 +403,7 @@ If settings['blocking'] == True, this will wait for a reply and return the replied value. """ + call_dict = self.on_outgoing_call(call_dict) self._send_message( 'remote_call', content=call_dict, data=call_data, comm_id=comm_id) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/comms/frontendcomm.py new/spyder-kernels-1.9.2/spyder_kernels/comms/frontendcomm.py --- old/spyder-kernels-1.9.1/spyder_kernels/comms/frontendcomm.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/comms/frontendcomm.py 2020-07-10 07:45:01.000000000 +0200 @@ -154,13 +154,10 @@ """Wait until the frontend replies to a request.""" if call_id in self._reply_inbox: return - t_start = time.time() while call_id not in self._reply_inbox: if time.time() > t_start + timeout: if retry: - # Send config again just in case - self._send_comm_config() self._wait_reply(call_id, call_name, timeout, False) return raise TimeoutError( @@ -182,6 +179,11 @@ self._set_pickle_protocol(msg['content']['data']['pickle_protocol']) self._send_comm_config() + def on_outgoing_call(self, call_dict): + """A message is about to be sent""" + call_dict["comm_port"] = self.comm_port + return super(FrontendComm, self).on_outgoing_call(call_dict) + def _send_comm_config(self): """Send the comm config to the frontend.""" self.remote_call()._set_comm_port(self.comm_port) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/console/__main__.py new/spyder-kernels-1.9.2/spyder_kernels/console/__main__.py --- old/spyder-kernels-1.9.1/spyder_kernels/console/__main__.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/console/__main__.py 2020-07-10 07:45:01.000000000 +0200 @@ -6,6 +6,18 @@ # (see spyder_kernels/__init__.py for details) # ----------------------------------------------------------------------------- +import sys +import os + + if __name__ == '__main__': + # Remove the current working directory from sys.path for Python 3.7+ + # because since that version it's added by default to sys.path when + # using 'python -m'. + if sys.version_info[0] == 3 and sys.version_info[1] >= 7: + cwd = os.getcwd() + if cwd in sys.path: + sys.path.remove(cwd) + from spyder_kernels.console import start start.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/console/kernel.py new/spyder-kernels-1.9.2/spyder_kernels/console/kernel.py --- old/spyder-kernels-1.9.1/spyder_kernels/console/kernel.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/console/kernel.py 2020-07-10 07:45:01.000000000 +0200 @@ -75,6 +75,7 @@ self._mpl_backend_error = None self._running_namespace = None + # -- Public API ----------------------------------------------------------- def frontend_call(self, blocking=False, broadcast=True, timeout=None): """Call the frontend.""" # If not broadcast, send only to the calling comm @@ -88,75 +89,6 @@ comm_id=comm_id, timeout=timeout) - @property - def _pdb_frame(self): - """Return current Pdb frame if there is any""" - if self._pdb_obj is not None and self._pdb_obj.curframe is not None: - return self._pdb_obj.curframe - - @property - def _pdb_locals(self): - """ - Return current Pdb frame locals if available. Otherwise - return an empty dictionary - """ - if self._pdb_frame: - return self._pdb_obj.curframe_locals - else: - return {} - - def set_spyder_breakpoints(self, breakpoints): - """ - Handle a message from the frontend - """ - if self._pdb_obj: - self._pdb_obj.set_spyder_breakpoints(breakpoints) - - def set_pdb_echo_code(self, state): - """Set if pdb should echo the code. - - This might change for each pdb statment and is therefore not included - in pdb settings. - """ - self._pdb_print_code = state - - def set_pdb_ignore_lib(self, state): - """ - Change the "Ignore libraries while stepping" debugger setting. - """ - if self._pdb_obj: - self._pdb_obj.pdb_ignore_lib = state - - def set_pdb_execute_events(self, state): - """ - Handle a message from the frontend - """ - if self._pdb_obj: - self._pdb_obj.pdb_execute_events = state - - def update_syspath(self, path_dict, new_path_dict): - """ - Update the PYTHONPATH of the kernel. - - `path_dict` and `new_path_dict` have the paths as keys and the state - as values. The state is `True` for active and `False` for inactive. - - `path_dict` corresponds to the previous state of the PYTHONPATH. - `new_path_dict` corresponds to the new state of the PYTHONPATH. - """ - # Remove old paths - for path in path_dict: - while path in sys.path: - sys.path.remove(path) - - # Add new paths - # We do this in reverse order as we use `sys.path.insert(1, path)`. - # This ensures the end result has the correct path order. - for path, active in reversed(new_path_dict.items()): - if active: - sys.path.insert(1, path) - - # -- Public API --------------------------------------------------- # --- For the Variable Explorer def set_namespace_view_settings(self, settings): """Set namespace_view_settings.""" @@ -332,6 +264,35 @@ if self._pdb_obj: self.frontend_call(blocking=False).pdb_continue() + def set_spyder_breakpoints(self, breakpoints): + """ + Handle a message from the frontend + """ + if self._pdb_obj: + self._pdb_obj.set_spyder_breakpoints(breakpoints) + + def set_pdb_echo_code(self, state): + """Set if pdb should echo the code. + + This might change for each pdb statment and is therefore not included + in pdb settings. + """ + self._pdb_print_code = state + + def set_pdb_ignore_lib(self, state): + """ + Change the "Ignore libraries while stepping" debugger setting. + """ + if self._pdb_obj: + self._pdb_obj.pdb_ignore_lib = state + + def set_pdb_execute_events(self, state): + """ + Handle a message from the frontend + """ + if self._pdb_obj: + self._pdb_obj.pdb_execute_events = state + # --- For the Help plugin def is_defined(self, obj, force_import=False): """Return True if object is defined in current namespace""" @@ -409,6 +370,28 @@ return u'cython' return None + def update_syspath(self, path_dict, new_path_dict): + """ + Update the PYTHONPATH of the kernel. + + `path_dict` and `new_path_dict` have the paths as keys and the state + as values. The state is `True` for active and `False` for inactive. + + `path_dict` corresponds to the previous state of the PYTHONPATH. + `new_path_dict` corresponds to the new state of the PYTHONPATH. + """ + # Remove old paths + for path in path_dict: + while path in sys.path: + sys.path.remove(path) + + # Add new paths + # We do this in reverse order as we use `sys.path.insert(1, path)`. + # This ensures the end result has the correct path order. + for path, active in reversed(new_path_dict.items()): + if active: + sys.path.insert(1, path) + # -- Private API --------------------------------------------------- # --- For the Variable Explorer def _get_current_namespace(self, with_magics=False): @@ -527,6 +510,23 @@ """Register Pdb session to use it later""" self._pdb_obj = pdb_obj + @property + def _pdb_frame(self): + """Return current Pdb frame if there is any""" + if self._pdb_obj is not None and self._pdb_obj.curframe is not None: + return self._pdb_obj.curframe + + @property + def _pdb_locals(self): + """ + Return current Pdb frame locals if available. Otherwise + return an empty dictionary + """ + if self._pdb_frame: + return self._pdb_obj.curframe_locals + else: + return {} + # --- For the Help plugin def _eval(self, text): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/console/start.py new/spyder-kernels-1.9.2/spyder_kernels/console/start.py --- old/spyder-kernels-1.9.1/spyder_kernels/console/start.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/console/start.py 2020-07-10 07:45:01.000000000 +0200 @@ -295,11 +295,23 @@ while '' in sys.path: sys.path.remove('') - # Fire up the kernel instance. + # Main imports from ipykernel.kernelapp import IPKernelApp from spyder_kernels.console.kernel import SpyderKernel - kernel = IPKernelApp.instance() + class SpyderKernelApp(IPKernelApp): + + def init_pdb(self): + """ + This method was added in IPykernel 5.3.1 and it replaces + the debugger used by the kernel with a new class + introduced in IPython 7.15 during kernel's initialization. + Therefore, it doesn't allow us to use our debugger. + """ + pass + + # Fire up the kernel instance. + kernel = SpyderKernelApp.instance() kernel.kernel_class = SpyderKernel try: kernel.config = kernel_config() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/console/tests/test_console_kernel.py new/spyder-kernels-1.9.2/spyder_kernels/console/tests/test_console_kernel.py --- old/spyder-kernels-1.9.1/spyder_kernels/console/tests/test_console_kernel.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/console/tests/test_console_kernel.py 2020-07-10 07:45:01.000000000 +0200 @@ -396,11 +396,11 @@ @flaky(max_runs=3) -@pytest.mark.skipif(not (os.name == 'nt' and PY3), - reason="Only meant for Windows and Python 3") +@pytest.mark.skipif(not PY3, + reason="Only meant for Python 3") def test_multiprocessing(tmpdir): """ - Test that multiprocessing works on Windows and Python 3. + Test that multiprocessing works on Python 3. """ # Command to start the kernel cmd = "from spyder_kernels.console import start; start.main()" @@ -433,6 +433,48 @@ msg = client.get_shell_msg(block=True, timeout=TIMEOUT) content = msg['content'] assert content['found'] + + +@flaky(max_runs=3) +@pytest.mark.skipif(not PY3, + reason="Only meant for Python 3") +def test_dask_multiprocessing(tmpdir): + """ + Test that dask multiprocessing works on Python 3. + """ + # Command to start the kernel + cmd = "from spyder_kernels.console import start; start.main()" + + with setup_kernel(cmd) as client: + # Remove all variables + client.execute("%reset -f") + client.get_shell_msg(block=True, timeout=TIMEOUT) + + # Write multiprocessing code to a file + # Runs two times to verify that in the second case it doesn't break + code = """ +from dask.distributed import Client + +if __name__=='__main__': + client = Client() + client.close() + x = 'hello' +""" + p = tmpdir.join("mp-test.py") + p.write(code) + + # Run code two times + client.execute("runfile(r'{}')".format(to_text_string(p))) + client.get_shell_msg(block=True, timeout=TIMEOUT) + + client.execute("runfile(r'{}')".format(to_text_string(p))) + client.get_shell_msg(block=True, timeout=TIMEOUT) + + # Verify that the `x` variable is defined + client.inspect('x') + msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + content = msg['content'] + assert content['found'] @flaky(max_runs=3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/customize/spydercustomize.py new/spyder-kernels-1.9.2/spyder_kernels/customize/spydercustomize.py --- old/spyder-kernels-1.9.1/spyder_kernels/customize/spydercustomize.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/customize/spydercustomize.py 2020-07-10 07:45:01.000000000 +0200 @@ -273,8 +273,8 @@ # ============================================================================= # Multiprocessing adjustments # ============================================================================= -# This patch is only needed on Windows and Python 3 -if os.name == 'nt' and not PY2: +# This patch is only needed on Python 3 +if not PY2: # This could fail with changes in Python itself, so we protect it # with a try/except try: @@ -287,13 +287,22 @@ removed before execution. """ try: - return _old_preparation_data(name) + d = _old_preparation_data(name) except AttributeError: main_module = sys.modules['__main__'] # Any string for __spec__ does the job main_module.__spec__ = '' - return _old_preparation_data(name) - + d = _old_preparation_data(name) + # On windows, there is no fork, so we need to save the main file + # and import it + if (os.name == 'nt' and 'init_main_from_path' in d + and not os.path.exists(d['init_main_from_path'])): + _print( + "Warning: multiprocessing may need the main file to exist. " + "Please save {}".format(d['init_main_from_path'])) + # Remove path as the subprocess can't do anything with it + del d['init_main_from_path'] + return d multiprocessing.spawn.get_preparation_data = _patched_preparation_data except Exception: pass @@ -332,7 +341,7 @@ # add ability to move between frames p.send_initial_notification = False p.reset() - frame = tb.tb_frame + frame = tb.tb_next.tb_frame # wait for stdout to print time.sleep(0.1) p.interaction(frame, tb) @@ -440,7 +449,7 @@ ipython_shell.kernel._pdb_obj = None elif post_mortem and isinstance(error, Exception): error_type, error, tb = sys.exc_info() - post_mortem_excepthook(error_type, error, tb.tb_next) + post_mortem_excepthook(error_type, error, tb) else: # We ignore the call to exec ipython_shell.showtraceback(tb_offset=1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-kernels-1.9.1/spyder_kernels/utils/nsview.py new/spyder-kernels-1.9.2/spyder_kernels/utils/nsview.py --- old/spyder-kernels-1.9.1/spyder_kernels/utils/nsview.py 2020-05-06 17:59:06.000000000 +0200 +++ new/spyder-kernels-1.9.2/spyder_kernels/utils/nsview.py 2020-07-10 07:45:01.000000000 +0200 @@ -48,6 +48,11 @@ float64 = float32 = float16 = complex64 = complex128 = bool_ = FakeObject +NUMERIC_NUMPY_TYPES = (int64, int32, int16, int8, uint64, uint32, uint16, + uint8, float64, float32, float16, complex64, complex128, + bool_) + + def get_numpy_dtype(obj): """Return NumPy data type associated to obj Return None if NumPy is not available @@ -346,10 +351,6 @@ np_printoptions = FakeObject try: - numeric_numpy_types = (int64, int32, int16, int8, - uint64, uint32, uint16, uint8, - float64, float32, float16, - complex128, complex64, bool_) if ndarray is not FakeObject: # Save printoptions np_printoptions = get_printoptions() @@ -370,11 +371,11 @@ try: display = 'Min: %r\nMax: %r' % (value.min(), value.max()) except (TypeError, ValueError): - if value.dtype.type in numeric_numpy_types: + if value.dtype.type in NUMERIC_NUMPY_TYPES: display = str(value) else: display = default_display(value) - elif value.dtype.type in numeric_numpy_types: + elif value.dtype.type in NUMERIC_NUMPY_TYPES: display = str(value) else: display = default_display(value) @@ -447,7 +448,7 @@ display = str(value) elif (isinstance(value, NUMERIC_TYPES) or isinstance(value, bool) or - isinstance(value, numeric_numpy_types)): + isinstance(value, NUMERIC_NUMPY_TYPES)): display = repr(value) else: if level == 0: