Commit 8410e0ee authored by Jim Fulton's avatar Jim Fulton

Fixed bug: instances without their own dictionaries could

accidentally inherit one from a base class.
parent 366e8e44
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.41 2000/12/26 15:20:23 jim Exp $ $Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.41 2000/12/26 15:20:23 jim Exp $\n" "$Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -1708,8 +1708,12 @@ ExtensionClass_FindInstanceAttribute(PyObject *inst, PyObject *oname, ...@@ -1708,8 +1708,12 @@ ExtensionClass_FindInstanceAttribute(PyObject *inst, PyObject *oname,
} }
UNLESS(r) UNLESS(r)
{ {
if (*name=='_' && name[1]=='_' && name[2]=='b' && if (*name=='_' && name[1]=='_'
strcmp(name+2,"bases__")==0) &&
( (name[2]=='b' && strcmp(name+2,"bases__")==0)
|| (name[2]=='d' && strcmp(name+2,"dict__")==0)
)
)
{ {
PyErr_SetObject(PyExc_AttributeError, oname); PyErr_SetObject(PyExc_AttributeError, oname);
return NULL; return NULL;
...@@ -3523,7 +3527,7 @@ void ...@@ -3523,7 +3527,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.41 $"; char *rev="$Revision: 1.42 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.41 2000/12/26 15:20:23 jim Exp $ $Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.41 2000/12/26 15:20:23 jim Exp $\n" "$Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -1708,8 +1708,12 @@ ExtensionClass_FindInstanceAttribute(PyObject *inst, PyObject *oname, ...@@ -1708,8 +1708,12 @@ ExtensionClass_FindInstanceAttribute(PyObject *inst, PyObject *oname,
} }
UNLESS(r) UNLESS(r)
{ {
if (*name=='_' && name[1]=='_' && name[2]=='b' && if (*name=='_' && name[1]=='_'
strcmp(name+2,"bases__")==0) &&
( (name[2]=='b' && strcmp(name+2,"bases__")==0)
|| (name[2]=='d' && strcmp(name+2,"dict__")==0)
)
)
{ {
PyErr_SetObject(PyExc_AttributeError, oname); PyErr_SetObject(PyExc_AttributeError, oname);
return NULL; return NULL;
...@@ -3523,7 +3527,7 @@ void ...@@ -3523,7 +3527,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.41 $"; char *rev="$Revision: 1.42 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment