This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | Rhamphoryncus |
|---|---|
| Recipients | Rhamphoryncus, gvanrossum |
| Date | 2007年10月05日.17:18:00 |
| SpamBayes Score | 0.020169325 |
| Marked as misclassified | No |
| Message-id | <1191604681.49.0.616748526754.issue1237@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
typeobject.c:1842:type_new
type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots);
nslots may be 0.
typeobject.c:1966:type_new assigns this just-past-the-end address to
tp_members
type->tp_members = PyHeapType_GET_MEMBERS(et);
type_new later calls PyType_Ready, which calls add_members.
typeobject.c:3062:add_members
for (; memb->name != NULL; memb++) {
Interestingly, traverse_slots and clear_slots both use Py_Size rather
than name != NULL (so I was wrong about the extent of the problem.)
Both seem only to be used for heap types. add_members is used by both
heap types and static C types, so it needs to handle both behaviours.
One possible (if ugly) solution would be to switch iteration methods
depending on if Py_Size() is 0 or not, making sure type_new sets
tp_members to NULL if Py_Size() is 0. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2007年10月05日 17:18:01 | Rhamphoryncus | set | spambayes_score: 0.0201693 -> 0.020169325 recipients: + Rhamphoryncus, gvanrossum |
| 2007年10月05日 17:18:01 | Rhamphoryncus | set | spambayes_score: 0.0201693 -> 0.0201693 messageid: <1191604681.49.0.616748526754.issue1237@psf.upfronthosting.co.za> |
| 2007年10月05日 17:18:01 | Rhamphoryncus | link | issue1237 messages |
| 2007年10月05日 17:18:00 | Rhamphoryncus | create | |