pallets / flask

The Python micro framework for building web applications.
https://flask.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
68.07k stars 16.22k forks source link

Requiring endpoints to have a __dict__ #3864

Closed piotrmaslanka closed 3 years ago

piotrmaslanka commented 3 years ago

I've stumbled upon this bug while trying to bear Cython down with Flask.

Flask namely requires it's endpoint functions to have a __dict__, while Cython's def's are created as builtin_methods_or_functions which don't have a __dict__.

I've solved the problem in way mentioned here, but I still think it's a wrong design pattern to demand your endpoints to have a __dict__.

davidism commented 3 years ago

Flask namely requires it's endpoint functions to have a __dict__

As far as I know, Flask itself does not. @app.route records the function, but does not modify it. I can't tell from the linked issue how this is related to Flask.

piotrmaslanka commented 3 years ago

Flask namely requires it's endpoint functions to have a __dict__

As far as I know, Flask itself does not. @app.route records the function, but does not modify it. I can't tell from the linked issue how this is related to Flask.

It does not have to be modifying. Accessing some wild attribute of this function would suffice to yield this kind of error.

davidism commented 3 years ago

As far as I can tell, Flask doesn't access anything on the view functions that would require __dict__. You've pointed to a separate library called flasgger, which is not this project. If you want to report an issue with Flask, please provided a minimal reproducible example for Flask.

piotrmaslanka commented 3 years ago

You're right. This only affects Flasgger. I'm sorry to bother you.