check50
check50 copied to clipboard
LoggerWriter infinite recursion
@brianyu28 and I looked a bit into this. When the CS50 library makes a Logger.debug() call (or any student code writes anything I imagine), that ends up calling LoggerWriter.write(), presumably because of how the output streams are being temporarily redirected when we enter the CheckRunner context. LoggerWriter.write() calls self.logger.log(), which writes to the "check50" logger, which we think tries to write to stdout or stderr, which causes LoggerWriter.write() to be called again and so on.
I can look into this if you send me some example code?
@cmlsharp
$ pip install check50==3.2.1
$ cat app.py
import flask
import cs50
app = flask.Flask(__name__)
db = cs50.SQL('sqlite:///foo.db')
@app.route("/")
def index():
db.execute('select 1')
return ""
$ cat check/__init__.py
import check50
import check50.flask
@check50.check()
def test_index():
App().get_index().status(200)
class App(check50.flask.app):
def __init__(self):
super().__init__("app.py")
def get_index(self):
return self.get("/")
$ check50 --dev check
...
Results for check generated by check50 v3.2.1
:( test db execute
application raised an exception (see the log for more details)
sending GET request to /
exception raised in application: RecursionError: maximum recursion depth exceeded while calling a Python object
Is this still open?