[Patches] [ python-Patches-603548 ] Python object refcount accessors
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 03 Sep 2002 11:52:48 -0700
Patches item #603548, was opened at 2002-09-02 11:10
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=603548&group_id=5470
Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Rolf Kalbermatter (labviewer)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Python object refcount accessors
Initial Comment:
It could be useful for more generic clients of the Python
core to not have to worry about the actual layout of
Py_ObjectHEAD and other things. So I propose to add
the two additional functions:
int PyObject_IncRef(PyObject *ob)
int PyObject_DecRef(PyObject *ob)
Those functions could also be added to the Python 2.2 if
any bug fix might be pending for it.
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-09-03 14:52
Message:
Logged In: YES
user_id=6380
Switching between the DEBUG and non-DEBUG Python DLL is not
supported. There are too many things that wouldn't work;
Py_INCREF is just the tip of the iceberg. So I'm rejecting this.
----------------------------------------------------------------------
Comment By: Rolf Kalbermatter (labviewer)
Date: 2002-09-03 12:41
Message:
Logged In: YES
user_id=66382
I do not object the existing macros and in absence of those
proposed functions use them now, but they create
unneccessary dependencies on the used Python core DLL by
accessing data members of the Py_ObjectHEAD structure
directly. This is especially a problem since the offset of those
members changes depending if the DLL is compiled in
DEBUG or non-DEBUG mode and therefore requires the
client to be compiled exactly the same. Also they access
additional Python data references in DEBUG mode.
In my case I wanted to embed Python in another application
and since I only use Python core DLL functions, I thought I
would allow configuration of the Python DLL to use and load it
dynamically with LoadLibrary() and access the functions with
GetProcAddress(). Although this works already fine the
implicit access to PyObject structure members limits the
flexibility seriously.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-09-02 11:33
Message:
Logged In: YES
user_id=31435
What's your objection to the existing Py_INCREF() and
Py_DECREF()? Or didn't you know about them?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=603548&group_id=5470