Bugs item #1598620, was opened at 2006-11-17 13:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1598620&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Lenard Lindstrom (kermode)
Assigned to: Nobody/Anonymous (nobody)
Summary: ctypes Structure allows recursive definition

Initial Comment:
Ctypes version 1.0.1 and Python 2.4:

A Partially declared structure can be used as a type
in its own field declarations:

Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] 
on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> from ctypes import Structure, c_int, sizeof, __version__
>>> __version__
'1.0.1'
>>> class S(Structure):
...     pass
...
>>> S._fields_ = [('i', c_int), ('s', S)]
>>> sizeof(S)
4
>>> o=S(7)
>>> o.s.i=12
>>> o.s.s.i=20
>>> o.i
7
>>> o.s.i
12
>>> o.s.s.i
20
>>> sizeof(o)
4


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1598620&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to