Last active
September 28, 2017 19:44
-
-
Save filipevarjao/470d2ee0665fbc3671ad8897187ef441 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct _object { | |
_PyObject_HEAD_EXTRA | |
Py_ssize_t ob_refcnt; | |
int color; /* the color of local mark-scan where 0 black, 1 red 2 green */ | |
struct _typeobject *ob_type; | |
} PyObject; | |
#define _Py_CHECK_REFCNT(OP) \ | |
{ if (((PyObject*)OP)->ob_refcnt < 0) \ | |
_Py_NegativeRefcount(__FILE__, __LINE__, \ | |
(PyObject *)(OP)); \ | |
else | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can assign the color just writing:
((PyObject*)OP)->color = 0