traitlets icon indicating copy to clipboard operation
traitlets copied to clipboard

get function of TraitType(BaseDescriptor) is called right after start ipython and then run forever?

Open ke-zhang-rd opened this issue 6 years ago • 1 comments

Hi, I'm using ipython and trailets. I met a bug in my code and eventually lead me to try to print something inside get function of TraitType(BaseDescriptor).

I put print('enter get function') before try block here. I observed that once I start ipython, enter get function started printing out and never stopped. It looks like get was called in a loop and run forever. Is there something that could help me understand this?

output

enter get function
enter get function
enter get function
enter get function
enter get function
...

Below are version info: ipython 7.7.0 python 3.7 traitlets 4.3.3

ke-zhang-rd avatar Sep 10 '19 19:09 ke-zhang-rd

If you throw in a bit more information it looks like it is the prompt stepping on it self:

entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of highlight_matching_brackets of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of highlight_matching_brackets of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of highlight_matching_brackets of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of highlight_matching_brackets of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of execution_count of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of highlight_matching_brackets of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
entering get of prompts of <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>


If you use non-print tracing, get gets called a finite number of times.

tacaswell avatar Sep 10 '19 23:09 tacaswell