]> granicus.if.org Git - python/commitdiff
Make __module__ writable except in restricted mode (like for classic classes).
authorGuido van Rossum <guido@python.org>
Tue, 18 Feb 2003 17:18:35 +0000 (17:18 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Feb 2003 17:18:35 +0000 (17:18 +0000)
Objects/funcobject.c
Objects/methodobject.c

index fa241312c2bf50edeae8ad9e9de99c23c9cc40cc..6f0fa268562902d83c1c2e9d38355240d893a1fb 100644 (file)
@@ -159,7 +159,7 @@ static PyMemberDef func_memberlist[] = {
         RESTRICTED|READONLY},
         {"func_name",     T_OBJECT,     OFF(func_name),         READONLY},
         {"__name__",      T_OBJECT,     OFF(func_name),         READONLY},
-       {"__module__",    T_OBJECT,     OFF(func_module)},
+        {"__module__",    T_OBJECT,     OFF(func_module), WRITE_RESTRICTED},
         {NULL}  /* Sentinel */
 };
 
index 5e967d3f3dba83aa5f65ad5bb6baa5fd90babaae..3a92fa45ce33b3c67d0818e2bb519a196c11dbe5 100644 (file)
@@ -189,7 +189,7 @@ static PyGetSetDef meth_getsets [] = {
 #define OFF(x) offsetof(PyCFunctionObject, x)
 
 static PyMemberDef meth_members[] = {
-       {"__module__",    T_OBJECT,     OFF(m_module)},
+       {"__module__",    T_OBJECT,     OFF(m_module), WRITE_RESTRICTED},
        {NULL}
 };