Hi,

I have been writing a C++ extension for Python recently, and am currently 
fixing the reference counting throughout the extension. As I am very new to 
this topic, my question may have a simple answer, but I was unable to find any 
mention of the behavior online.

When using the PyObject_GetItem(obj, key) function, I noticed inconsistent 
behavior with various types of obj (for reference, key is always a str object). 
When obj is a standard dictionary, the key's reference count remains unchanged, 
as expected. However, when obj is a pandas DataFrame object, the key's 
reference count increases by 2. This could very well be by design of the 
DataFrame object doing some internal caching of the string, but does not appear 
in the documentation, so I thought I would bring up the issue.

Thanks,

Eric Edmond
University of Michigan | Class of 2016

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to