Skip to content

Commit 18411f4

Browse files
committed
Optimization bug fix from Stefan Seefeld (sseefeld-at-art.ca)
[SVN r24357]
1 parent 2c383e7 commit 18411f4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/object/class.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,11 @@ namespace objects
301301
PyObject* d = type_->tp_dict;
302302
PyObject* instance_size_obj = PyObject_GetAttrString(d, "__instance_size__");
303303

304-
long instance_size = 0;
305-
if (instance_size != 0)
306-
instance_size = PyInt_AsLong(instance_size_obj);
304+
long instance_size = instance_size_obj ? PyInt_AsLong(instance_size_obj) : 0;
307305

308306
if (instance_size < 0)
309307
instance_size = 0;
308+
310309
PyErr_Clear(); // Clear any errors that may have occurred.
311310

312311
instance<>* result = (instance<>*)type_->tp_alloc(type_, instance_size);

0 commit comments

Comments
 (0)