Skip to content

Assigning to attribute flask.g.[...] not defined in class slots (assigning-non-slot) #4020

@anders-kiaer

Description

@anders-kiaer

Thanks for a recent release of flask which looks great. 🎉 Just started testing it out.

This is not directly a bug afaik, but our CI started failing on the new release of flask and werkzeug.

Following the flask documentation, it appears the recommended way of setting new attributes to flask.g is simply doing flask.g.some_attribute = some_value.

This example code

from flask import g

g.some_attribute = 42

gives no pylint warning when used together with pip install "flask<2" "werkzeug<2", however after pip install --upgrade flask werkzeug the same code gives the following pylint warning:

test_pylint.py:3:0: E0237: Assigning to attribute 'some_attribute' not defined in class slots (assigning-non-slot)

Any recommended code change that should be done related to setting attributes on the namespace object flask.g, or would the best recommendation be to silence pylint when used with newest flask + werkzeug?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions