Mercurial > cpython-lru_cache-weakref
comparison Python/ceval.c @ 64633:e080f11fca19
use Py_REFCNT
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Fri, 10 Sep 2010 23:52:42 +0000 |
| parents | 56844b716cd7 |
| children | 1764796e9eca |
comparison
equal
deleted
inserted
replaced
| 64632:f31e0c7c02e3 | 64633:e080f11fca19 |
|---|---|
| 4392 PyErr_SetString(PyExc_OverflowError, | 4392 PyErr_SetString(PyExc_OverflowError, |
| 4393 "strings are too large to concat"); | 4393 "strings are too large to concat"); |
| 4394 return NULL; | 4394 return NULL; |
| 4395 } | 4395 } |
| 4396 | 4396 |
| 4397 if (v->ob_refcnt == 2) { | 4397 if (Py_REFCNF(v) == 2) { |
| 4398 /* In the common case, there are 2 references to the value | 4398 /* In the common case, there are 2 references to the value |
| 4399 * stored in 'variable' when the += is performed: one on the | 4399 * stored in 'variable' when the += is performed: one on the |
| 4400 * value stack (in 'v') and one still stored in the | 4400 * value stack (in 'v') and one still stored in the |
| 4401 * 'variable'. We try to delete the variable now to reduce | 4401 * 'variable'. We try to delete the variable now to reduce |
| 4402 * the refcnt to 1. | 4402 * the refcnt to 1. |
| 4433 break; | 4433 break; |
| 4434 } | 4434 } |
| 4435 } | 4435 } |
| 4436 } | 4436 } |
| 4437 | 4437 |
| 4438 if (v->ob_refcnt == 1 && !PyUnicode_CHECK_INTERNED(v)) { | 4438 if (Py_REFCNF(v) == 1 && !PyUnicode_CHECK_INTERNED(v)) { |
| 4439 /* Now we own the last reference to 'v', so we can resize it | 4439 /* Now we own the last reference to 'v', so we can resize it |
| 4440 * in-place. | 4440 * in-place. |
| 4441 */ | 4441 */ |
| 4442 if (PyUnicode_Resize(&v, new_len) != 0) { | 4442 if (PyUnicode_Resize(&v, new_len) != 0) { |
| 4443 /* XXX if PyUnicode_Resize() fails, 'v' has been | 4443 /* XXX if PyUnicode_Resize() fails, 'v' has been |
