From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 6 Nov 2018 01:59:15 +0000 (-0800) Subject: bpo-35119: Fix RecursionError in example of customizing module attribute access.... X-Git-Tag: v3.7.2rc1~185 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=558dc8adbec0b85e0ff257fcedc85c5d89cd2825;p=thirdparty%2FPython%2Fcpython.git bpo-35119: Fix RecursionError in example of customizing module attribute access. (GH-10323) https://bugs.python.org/issue35119 (cherry picked from commit 0bee3c36d406e47fa9f99cfc1e07b701512c4f3f) Co-authored-by: Denis Osipov --- diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 2012d7abc23f..be9b3ad1af69 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1580,7 +1580,7 @@ a module object to a subclass of :class:`types.ModuleType`. For example:: def __setattr__(self, attr, value): print(f'Setting {attr}...') - setattr(self, attr, value) + super().__setattr__(attr, value) sys.modules[__name__].__class__ = VerboseModule