File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3714,17 +3714,15 @@ _PyLong_Init(void)
37143714 /* The element is already initialized, most likely
37153715 * the Python interpreter was initialized before.
37163716 */
3717- /* _Py_NewReference((PyObject*)v);
3718- * XXX: It sets the ref count to 1 but it may be
3719- * larger. Emulate new reference w/o setting refcnt
3720- * to 1.
3721- */
3717+ Py_ssize_t refcnt ;
37223718 PyObject * op = (PyObject * )v ;
3723- _Py_INC_REFTOTAL ;
3724- op -> ob_refcnt = (op -> ob_refcnt < 1 ) ? 1 : op -> ob_refcnt ;
3725- _Py_AddToAllObjects (op , 1 );
3726- _Py_INC_TPALLOCS (op );
37273719
3720+ refcnt = Py_REFCNT (op ) < 0 ? 0 : Py_REFCNT (op );
3721+ _Py_NewReference (op );
3722+ /* _Py_NewReference sets the ref count to 1 but
3723+ * the ref count might be larger. Set the refcnt
3724+ * to the original refcnt + 1 */
3725+ Py_REFCNT (op ) = refcnt + 1 ;
37283726 assert (Py_SIZE (op ) == size );
37293727 assert (v -> ob_digit [0 ] == abs (ival ));
37303728 }
You can’t perform that action at this time.
0 commit comments