[issue16272] C-API documentation clarification for tp_dictoffset

2021-03-05 Thread Eryk Sun


Change by Eryk Sun :


--
type:  -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2021-03-05 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg221020

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2019-03-15 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2014-06-19 Thread Mark Lawrence

Mark Lawrence added the comment:

@Chris can you prepare a patch for this?

--
nosy: +BreamoreBoy
versions:  -Python 2.6, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16272
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2014-06-19 Thread eryksun

eryksun added the comment:

It could also mention the generic getter and setter functions for the 
PyGetSetDef that were added in 3.3: PyType_GenericGetDict and 
PyType_GenericSetDict.

https://docs.python.org/3/c-api/object.html#c.PyType_GenericGetDict

--
nosy: +eryksun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16272
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2013-07-01 Thread Martin Kysel

Changes by Martin Kysel mar...@martinkysel.com:


--
nosy: +mkysel

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16272
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2012-10-25 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
nosy: +asvetlov

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16272
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16272] C-API documentation clarification for tp_dictoffset

2012-10-17 Thread Chris Colbert

New submission from Chris Colbert:

The documentation of the tp_dictoffset is a bit unclear when describing the 
responsibilities of a base type with a nonzero tp_dictoffset.
http://docs.python.org/c-api/typeobj.html

I feel there should some statement to the effect of:



If a type defines a nonzero tp_dictoffset, that type is responsible for 
defining a `__dict__` slot as part of the tp_getset structures. Failure to do 
so will result in the dict being inaccesible from Python via `obj.__dict__` 
from instances of the type or subtypes.



The reasoning is twofold:

1) `PyType_Ready` does not add the default getset members like `type_new` does. 
This prevents the instances of the type itself from retrieving `obj.__dict__`

2) `type_new` will provide the default `subtype_dict` getset member for 
subclasses, but this calls `get_builtin_base_with_dict` which will resolve to 
the most base type which is not heap allocated; in this case, the C type. Since 
this type has no `__dict__` getset member, the lookup fails.


Adding a bit of verbage about this gotcha would likely save some headaches in 
the future.

--
assignee: docs@python
components: Documentation
messages: 173222
nosy: Chris.Colbert, docs@python
priority: normal
severity: normal
status: open
title: C-API documentation clarification for tp_dictoffset
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16272
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com