[Python-checkins] bpo-35119: Fix RecursionError in example of customizing module attribute access. (GH-10323)

Miss Islington (bot) webhook-mailer at python.org
Mon Nov 5 20:59:19 EST 2018


https://github.com/python/cpython/commit/558dc8adbec0b85e0ff257fcedc85c5d89cd2825
commit: 558dc8adbec0b85e0ff257fcedc85c5d89cd2825
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-11-05T17:59:15-08:00
summary:

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 <osipov_d at list.ru>

files:
M Doc/reference/datamodel.rst

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
 



More information about the Python-checkins mailing list