summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-12-30 19:34:10 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-12-30 19:34:10 (GMT)
commit0f02d3933bff50042dd914d5d17831af7093cf55 (patch)
tree68365aea879cae3caa8b4267e45922ec2fa49c18 /Doc/c-api
parentb7953f00b186baee159a2d5dfe1e80ca0ef00a29 (diff)
downloadcpython-0f02d3933bff50042dd914d5d17831af7093cf55.zip
cpython-0f02d3933bff50042dd914d5d17831af7093cf55.tar.gz
cpython-0f02d3933bff50042dd914d5d17831af7093cf55.tar.bz2
check if the attribute is set before deleting it with T_OBJECT_EX (fixes #7604)
Also, add a note to the docs about the better behavior of T_OBJECT_EX as compared to T_OBJECT.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/structures.rst5
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index c4fb218..c2847e8 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -281,7 +281,10 @@ definition with the same method name.
:cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX` differ in that
:cmacro:`T_OBJECT` returns ``None`` if the member is *NULL* and
- :cmacro:`T_OBJECT_EX` raises an :exc:`AttributeError`.
+ :cmacro:`T_OBJECT_EX` raises an :exc:`AttributeError`. Try to use
+ :cmacro:`T_OBJECT_EX` over :cmacro:`T_OBJECT` because :cmacro:`T_OBJECT_EX`
+ handles use of the :stmt:`del` statement on that attribute more correctly
+ than :cmacro:`T_OBJECT`.
:attr:`flags` can be 0 for write and read access or :cmacro:`READONLY` for
read-only access. Using :cmacro:`T_STRING` for :attr:`type` implies