summaryrefslogtreecommitdiffstats
path: root/Include/object.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1990-11-02 17:51:56 (GMT)
committerGuido van Rossum <guido@python.org>1990-11-02 17:51:56 (GMT)
commitc8564cde0405fd10067f40068ce6735b1bfcc7d5 (patch)
tree2d6360c7006951360a2ece77a31089cca0ed376d /Include/object.h
parent3d54f2d3d9da6552b2caab0a7cd5b90705456ce7 (diff)
downloadcpython-c8564cde0405fd10067f40068ce6735b1bfcc7d5.zip
cpython-c8564cde0405fd10067f40068ce6735b1bfcc7d5.tar.gz
cpython-c8564cde0405fd10067f40068ce6735b1bfcc7d5.tar.bz2
Be more careful with negative reference counts.
Diffstat (limited to 'Include/object.h')
-rw-r--r--Include/object.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Include/object.h b/Include/object.h
index 4656173..7147339 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -56,7 +56,7 @@ whose size is determined when the object is allocated.
#ifdef TRACE_REFS
#define OB_HEAD \
struct _object *_ob_next, *_ob_prev; \
- unsigned int ob_refcnt; \
+ int ob_refcnt; \
struct _typeobject *ob_type;
#define OB_HEAD_INIT(type) 0, 0, 1, type,
#else
@@ -200,7 +200,7 @@ extern long ref_total;
#endif
#define INCREF(op) (ref_total++, (op)->ob_refcnt++)
#define DECREF(op) \
- if (--ref_total, --(op)->ob_refcnt != 0) \
+ if (--ref_total, --(op)->ob_refcnt > 0) \
; \
else \
DELREF(op)
@@ -208,7 +208,7 @@ extern long ref_total;
#define NEWREF(op) ((op)->ob_refcnt = 1)
#define INCREF(op) ((op)->ob_refcnt++)
#define DECREF(op) \
- if (--(op)->ob_refcnt != 0) \
+ if (--(op)->ob_refcnt > 0) \
; \
else \
DELREF(op)