-
Notifications
You must be signed in to change notification settings - Fork 133
Stack overflow when importing GPy #1495
Comments
|
I encountered the StackOverflowException when using the Flask_WTF (0.14.2) package. In my case I was able to isolate the cause. First, the basic structure of the code in the form.py module in Flask_WTF is: from wtforms import Form
class FlaskForm(Form):
# Class definition ...
pass
# In prior versions of Flask_WTF, the class FlaskForm was called Form.
# flask_wtf.Form is defined for backward compatibility. The symbol
# 'Form' from the import is overwritten by the definition of the
# 'Form' class here.
class Form(FlaskForm):
"""
.. deprecated:: 0.13
Renamed to :class:`~flask_wtf.FlaskForm`.
"""
# Class definition ...
pass Next, my code (greatly simplified): from flask_wtf import FlaskForm
class MyForm(FlaskForm):
# The argument of the lambda function is a list, for example.
_a = lambda x: x[0]
# ('_a' is defined for convenience, and in my actual code is more complicated; it is
# used multiple times in defining other class variables. It is not intended to be a
# class or static method). Two things are required to generate the StackOverflowException:
|
The first is definitely the same as what's been observed for GPy (and what the ongoing PR addresses). |
OK, but just to be clear, no. 1 (the redefinition of |
Yes, the underlying cause is endless recursion in walking class bases since they are circular. |
Environment data
VS Code version: 1.37.1
Microsoft Python Language Server version: 0.3.66.0
Extension version (available under the Extensions sidebar):2019.8.30787
OS and version: MacOs Mojave 10.14.5 (18F132)
Python version (& distribution if applicable, e.g. Anaconda): Anaconda 3.7.3
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
Relevant/affected Python packages and their versions: GPy https://sheffieldml.github.io/GPy/
Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info microsoft/vscode-python#3977): python.jediEnabled:false
Expected behaviour
Language server doesn't hang on 'Analyzing in background'
Actual behaviour
CPU usage is not high but process keeps terminating due to StackOverflowException. Then the 'The Python Tools server crashed 5 times in the last 3 minutes. The server will not be restarted.' warning appears . I've isolated the problem to be due to importing the GPy package (problem goes away if I comment out the imports). I've also tried adding the '# noqa' tag after the imports and it doesn't work. Is it possible to allow users to specify packages for the language server to ignore?
Steps to reproduce:
Open a blank python file and import gpy
Logs
User belongs to experiment group 'AlwaysDisplayTestExplorer - experiment'
User belongs to experiment group 'ShowPlayIcon - control'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
Starting Microsoft Python language server.
The text was updated successfully, but these errors were encountered: