=?eucgb2312_cn?b?UmU6IFJlZ2FyZGluZyBucGFycmF5IHJlc2hhcGUo?= =?eucgb2312_cn?b?KSBhbmQgcmVmY291bnQgKMzawfUp?=

Stefano Miccoli via NumPy-Discussion <[email protected]>
Newsgroups gmane.comp.python.numeric.general
Message-ID <[email protected]>

On 30 Sep 2025, at 18:00, [email protected] wrote:

It seems that B2's ref of A2 is stolen by this assignment out = B2.  And In A3 , B3 case, we deleteout first and it seems that the ref in out is returned back to B3.

I'm not sure if this is the intended behavior and I cannot find any material or documentation about this.

Any thoughts or suggestions would be helpful!

Teng Liu


The statement `B2 = A2.reshape((10, 10))` increments the refcount of A2 in an indirect way: it is B2.base that holds the reference to A2. In fact, `B2.base is A2` is True. Therefore, incrementing the refcount of B2 (with `out2 = B2`) will not increment also the refcount of A2.

Hope this helps, Stefano

_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.