From 18411f4b5fe870c438a5cb2a1255ff62caab3da7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 9 Aug 2004 17:43:02 +0000 Subject: [PATCH] Optimization bug fix from Stefan Seefeld (sseefeld-at-art.ca) [SVN r24357] --- src/object/class.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/object/class.cpp b/src/object/class.cpp index 1708d137..89890b96 100644 --- a/src/object/class.cpp +++ b/src/object/class.cpp @@ -301,12 +301,11 @@ namespace objects PyObject* d = type_->tp_dict; PyObject* instance_size_obj = PyObject_GetAttrString(d, "__instance_size__"); - long instance_size = 0; - if (instance_size != 0) - instance_size = PyInt_AsLong(instance_size_obj); + long instance_size = instance_size_obj ? PyInt_AsLong(instance_size_obj) : 0; if (instance_size < 0) instance_size = 0; + PyErr_Clear(); // Clear any errors that may have occurred. instance<>* result = (instance<>*)type_->tp_alloc(type_, instance_size);