microsoftarchive/msgraph-sdk-python

prop_dict={} default arg

j0hnsmith opened this issue · 1 comments

Haven't actually used this library, just looked over the source, seems to be a major problem.

All the model classes use prop_dict={} in the __init__ method, this is a mutable default argument, that dict is evaluated once, at import time. In the example below it essentially means that all instances of Group share self._prop_dict, thus setting display_name of one group changes all instances, both existing and future.

https://github.com/microsoftgraph/msgraph-sdk-python/blob/1320ba9116be0d00a1d7fce3484ea979e24ee82d/src/msgraph/model/group.py#L14-L16

All the files in the models package do the same. This is definitely not intended behaviour.

More about mutable default args (and an example), http://docs.python-guide.org/en/latest/writing/gotchas/

Thank you for your contribution. Right now, we aren't accepting any new PRs because this library is being deprecated. Feel free to publish this under a fork.