[ python-Bugs-1597570 ] "Report website bug" -> Forbidden :(

2006-11-17 Thread SourceForge.net
Bugs item #1597570, was opened at 2006-11-16 10:19
Message generated for change (Comment added) made by pylucid
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1597570&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: Documentation
Group: Not a Bug
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Jens Diemer (pylucid)
Assigned to: Nobody/Anonymous (nobody)
Summary: "Report website bug" -> Forbidden :(

Initial Comment:
I would report a enhancement for the python.org site. But if i go to 
http://pydotorg.python.org/pydotorg/newticket i see only:

"""
Forbidden

TICKET_CREATE privileges are required to perform this operation
"""

:(

--

>Comment By: Jens Diemer (pylucid)
Date: 2006-11-17 10:12

Message:
Logged In: YES 
user_id=1330780
Originator: YES

Hm. Now i see:
"""
Note: self-registering on Trac is temporarily disabled. Please email
sdeibel at wingware dot com to request registration.
"""


Anyhow, the "Forbidden error page" is not Userfiendly :(

--

Comment By: Georg Brandl (gbrandl)
Date: 2006-11-16 16:07

Message:
Logged In: YES 
user_id=849994
Originator: NO

The pydotorg requires registration, which is boldly pointed out on the
wiki page that the "report website bug" link refers to.

--

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



[ python-Bugs-1597570 ] "Report website bug" -> Forbidden :(

2006-11-17 Thread SourceForge.net
Bugs item #1597570, was opened at 2006-11-16 09:19
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1597570&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: Documentation
Group: Not a Bug
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Jens Diemer (pylucid)
Assigned to: Nobody/Anonymous (nobody)
Summary: "Report website bug" -> Forbidden :(

Initial Comment:
I would report a enhancement for the python.org site. But if i go to 
http://pydotorg.python.org/pydotorg/newticket i see only:

"""
Forbidden

TICKET_CREATE privileges are required to perform this operation
"""

:(

--

>Comment By: Georg Brandl (gbrandl)
Date: 2006-11-17 09:22

Message:
Logged In: YES 
user_id=849994
Originator: NO

I think you're not a user but a programmer. As such, you are at least
expected to read things through before clicking links ;)

--

Comment By: Jens Diemer (pylucid)
Date: 2006-11-17 09:12

Message:
Logged In: YES 
user_id=1330780
Originator: YES

Hm. Now i see:
"""
Note: self-registering on Trac is temporarily disabled. Please email
sdeibel at wingware dot com to request registration.
"""


Anyhow, the "Forbidden error page" is not Userfiendly :(

--

Comment By: Georg Brandl (gbrandl)
Date: 2006-11-16 15:07

Message:
Logged In: YES 
user_id=849994
Originator: NO

The pydotorg requires registration, which is boldly pointed out on the
wiki page that the "report website bug" link refers to.

--

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



[ python-Bugs-1597014 ] Can't exclude words before capture group

2006-11-17 Thread SourceForge.net
Bugs item #1597014, was opened at 2006-11-15 14:27
Message generated for change (Comment added) made by ctimmerman
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1597014&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: Regular Expressions
Group: Python 2.4
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Cees Timmerman (ctimmerman)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: Can't exclude words before capture group

Initial Comment:
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2

Tried:

>>> re.findall(r'(?!def)\b(\S+)\(', "def bla(): dof blu()")

>>> re.findall(r'(?:def){0}\b(\S+)\(', "def bla(): dof blu()")

Result:

['bla', 'blu']

Expected:

['blu']


Why doesn't (?!) work like it does here?:

>>> re.findall(r'\b(\S+): (?!bad)', "bob: bad; suzy: good")
['suzy']


Wouldn't it be nice if (^) worked?

>>> re.findall(r'\b(\S+): (^bad)', "bob: bad; suzy: good")
[]

[^()] does, sorta. Also not before a capture group:

>>> re.findall(r'\b(\S+): [^(bad)]', "bob: bad; suzy: good")
['suzy']
>>> re.findall(r'[^(def)]\b(\S+)\(', "def bla(): dof blu()")
['bla', 'blu']
>>> re.findall(r'[^(def)] (\S+)\(', "def bla(): dof blu()")
[]
>>> re.findall(r'(^def) (\S+)\(', "def bla(): dof blu()")
[('def', 'bla')]


--

>Comment By: Cees Timmerman (ctimmerman)
Date: 2006-11-17 10:50

Message:
Logged In: YES 
user_id=1646092
Originator: YES

I tried (^ because [^ works. (^ doesn't seem to do anything. To match ^
inside () you need to use (\^), anyway.

--

Comment By: Georg Brandl (gbrandl)
Date: 2006-11-15 17:20

Message:
Logged In: YES 
user_id=849994
Originator: NO

What you want is
>>> re.findall(r'(?https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1597014&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1597014 ] Can't exclude words before capture group

2006-11-17 Thread SourceForge.net
Bugs item #1597014, was opened at 2006-11-15 14:27
Message generated for change (Comment added) made by ctimmerman
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1597014&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: Regular Expressions
Group: Python 2.4
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Cees Timmerman (ctimmerman)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: Can't exclude words before capture group

Initial Comment:
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2

Tried:

>>> re.findall(r'(?!def)\b(\S+)\(', "def bla(): dof blu()")

>>> re.findall(r'(?:def){0}\b(\S+)\(', "def bla(): dof blu()")

Result:

['bla', 'blu']

Expected:

['blu']


Why doesn't (?!) work like it does here?:

>>> re.findall(r'\b(\S+): (?!bad)', "bob: bad; suzy: good")
['suzy']


Wouldn't it be nice if (^) worked?

>>> re.findall(r'\b(\S+): (^bad)', "bob: bad; suzy: good")
[]

[^()] does, sorta. Also not before a capture group:

>>> re.findall(r'\b(\S+): [^(bad)]', "bob: bad; suzy: good")
['suzy']
>>> re.findall(r'[^(def)]\b(\S+)\(', "def bla(): dof blu()")
['bla', 'blu']
>>> re.findall(r'[^(def)] (\S+)\(', "def bla(): dof blu()")
[]
>>> re.findall(r'(^def) (\S+)\(', "def bla(): dof blu()")
[('def', 'bla')]


--

>Comment By: Cees Timmerman (ctimmerman)
Date: 2006-11-17 11:35

Message:
Logged In: YES 
user_id=1646092
Originator: YES

Btw, thanks for the explanation, and I think you meant (?<[!=]

My final pattern:
>>> re.findall(r'(?>> re.findall(r'(?https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1597014&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1598357 ] import curses fails

2006-11-17 Thread SourceForge.net
Bugs item #1598357, was opened at 2006-11-17 08:40
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=1598357&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: Windows
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: thorvinrhuebarb (thorvinrhuebarb)
Assigned to: Nobody/Anonymous (nobody)
Summary: import curses fails

Initial Comment:
I am new to python and teaching myself.

I downloaded and installed python 2.5 for windows from the main page, accepting 
all defaults. 

python is installed in c:\Python25

I am able to import everything else I have tried sucessfully. "sys", "os", self 
written code.

There is a "curses" subfolder in the c:\Python25\Lib folder it contains
.py versions of all of the following files
__init__
ascii
has_key
panel
textpad
wrapper

The documentation includes curses in the "Generic Operating System Services"


>From what I have read this should indicate that  can uses curses in windows 
>(even though this was not the case in previous versions of python).


When I attempt to "import curses" I get the following result.

>>> import curses

Traceback (most recent call last):
  File "", line 1, in 
import curses
  File "C:\Python25\Lib\curses\__init__.py", line 15, in 
from _curses import *
ImportError: No module named _curses


I am unsure if this is an error in documentation and curses does not in fact 
work with windows or if there is an error in the default windows installation.



--

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



[ python-Bugs-1598357 ] import curses fails

2006-11-17 Thread SourceForge.net
Bugs item #1598357, was opened at 2006-11-17 08:40
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1598357&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: Windows
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: thorvinrhuebarb (thorvinrhuebarb)
>Assigned to: A.M. Kuchling (akuchling)
Summary: import curses fails

Initial Comment:
I am new to python and teaching myself.

I downloaded and installed python 2.5 for windows from the main page, accepting 
all defaults. 

python is installed in c:\Python25

I am able to import everything else I have tried sucessfully. "sys", "os", self 
written code.

There is a "curses" subfolder in the c:\Python25\Lib folder it contains
.py versions of all of the following files
__init__
ascii
has_key
panel
textpad
wrapper

The documentation includes curses in the "Generic Operating System Services"


>From what I have read this should indicate that  can uses curses in windows 
>(even though this was not the case in previous versions of python).


When I attempt to "import curses" I get the following result.

>>> import curses

Traceback (most recent call last):
  File "", line 1, in 
import curses
  File "C:\Python25\Lib\curses\__init__.py", line 15, in 
from _curses import *
ImportError: No module named _curses


I am unsure if this is an error in documentation and curses does not in fact 
work with windows or if there is an error in the default windows installation.



--

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-11-17 08:45

Message:
Logged In: YES 
user_id=11375
Originator: NO

The C curses library is not available for Windows.  (Ports are available,
but I've never seen anyone build Python with them and make the resulting
binary available.)

The 'curses' directory is present, but using it relies on an underlying C
extension for Python called '_curses'; it's _curses that can't be built
for Windows.


--

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



[ python-Bugs-1598181 ] subprocess.py: O(N**2) bottleneck

2006-11-17 Thread SourceForge.net
Bugs item #1598181, was opened at 2006-11-17 01:40
Message generated for change (Settings changed) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1598181&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: Ralf W. Grosse-Kunstleve (rwgk)
>Assigned to: Peter Åstrand (astrand)
Summary: subprocess.py: O(N**2) bottleneck

Initial Comment:
subprocess.py (Python 2.5, current SVN, probably all versions) contains this 
O(N**2) code:

  bytes_written = os.write(self.stdin.fileno(), input[:512])
  input = input[bytes_written:]

For large but reasonable "input" the second line is rate limiting. Luckily, it 
is very easy to remove this bottleneck. I'll upload a simple patch. Below is a 
small script that demonstrates the huge speed difference. The output on my 
machine is:

creating input
0.888417959213
slow slicing input
61.1553330421
creating input
0.863168954849
fast slicing input
0.0163860321045
done

The numbers are times in seconds.

This is the source:

import time
import sys
size = 100
t0 = time.time()
print "creating input"
input = "\n".join([str(i) for i in xrange(size)])
print time.time()-t0
t0 = time.time()
print "slow slicing input"
n_out_slow = 0
while True:
  out = input[:512]
  n_out_slow += 1
  input = input[512:]
  if not input:
break
print time.time()-t0
t0 = time.time()
print "creating input"
input = "\n".join([str(i) for i in xrange(size)])
print time.time()-t0
t0 = time.time()
print "fast slicing input"
n_out_fast = 0
input_done = 0
while True:
  out = input[input_done:input_done+512]
  n_out_fast += 1
  input_done += 512
  if input_done >= len(input):
break
print time.time()-t0
assert n_out_fast == n_out_slow
print "done"


--

Comment By: Ralf W. Grosse-Kunstleve (rwgk)
Date: 2006-11-17 01:43

Message:
Logged In: YES 
user_id=71407
Originator: YES

Sorry, I didn't know the tracker would destroy the indentation.
I'm uploading the demo source as a separate file.


--

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



[ python-Bugs-1598361 ] Misspelled submodule names for email module.

2006-11-17 Thread SourceForge.net
Bugs item #1598361, was opened at 2006-11-17 15:48
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=1598361&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: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dmytro O. Redchuk (truefox)
Assigned to: Nobody/Anonymous (nobody)
Summary: Misspelled submodule names for email module.

Initial Comment:
There are at http://docs.python.org/lib/module-email.html and below some errors 
in submodule names:
--
# taken from
# http://docs.python.org/lib/module-email.message.html :
>>> from email.generator import Generator
--
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named generator
>>> from email.Generator import Generator
>>> 

The same for email.Message, email.Header and, probably, others (they start with 
lowercase letters).



--

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



[ python-Bugs-1583946 ] SSL "issuer" and "server" names cannot be parsed

2006-11-17 Thread SourceForge.net
Bugs item #1583946, was opened at 2006-10-24 14:32
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1583946&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: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: John Nagle (nagle)
Assigned to: Nobody/Anonymous (nobody)
Summary: SSL "issuer" and "server" names cannot be parsed

Initial Comment:
(Python 2.5 library)

The Python SSL object offers two methods from
obtaining the info from an SSL certificate, "server()"
and "issuer()".  These return strings.

The actual values in the certificate are a series
of key /value pairs in ASN.1 binary format.  But what
"server()" and "issuer()" return are single strings,
with the key/value pairs separated by "/". 

However, "/" is a valid character in certificate
data. So parsing such strings is ambiguous, and
potentially exploitable.

This is more than a theoretical problem.  The
issuer field of Verisign certificates has a "/" in the
middle of a text field:

"/O=VeriSign Trust Network/OU=VeriSign,
Inc./OU=VeriSign International Server CA - Class
3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY
LTD.(c)97 VeriSign".

Note the 

  "OU=Terms of use at www.verisign.com/rpa (c)00"

with a "/" in the middle of the value field.  Oops.

Worse, this is potentially exploitable.  By
ordering a low-level certificate with a "/" in the
right place, you can create the illusion (at least for
flawed implementations like this one) that the
certificate belongs to someone else.  Just order a
certificate from GoDaddy, enter something like this in
the "Name" field

"Myphonyname/C=US/ST=California/L=San Jose/O=eBay
Inc./OU=Site Operations/CN=signin.ebay.com"

and Python code will be spoofed into thinking you're eBay.

   Fortunately, browsers don't use Python code.

   The actual bug is in

python/trunk/Modules/_ssl.c

at

if ((self->server_cert =
SSL_get_peer_certificate(self->ssl))) {
   
X509_NAME_oneline(X509_get_subject_name(self->server_cert),
  self->server, X509_NAME_MAXLEN);
   
X509_NAME_oneline(X509_get_issuer_name(self->server_cert),
  self->issuer, X509_NAME_MAXLEN);

The "X509_name_oneline" function takes an X509_NAME
structure, which is the certificate system's
representation of a list, and flattens it into a
printable string.  This is a debug function, not one
for use in production code.  The SSL documentation for
"X509_name_oneline" says:   

"The functions X509_NAME_oneline() and
X509_NAME_print() are legacy functions which produce a
non standard output form, they don't handle multi
character fields and have various quirks and
inconsistencies.  Their use is strongly discouraged in
new applications."

What OpenSSL callers are supposed to do is call
X509_NAME_entry_count() to get the number of entries in
an X509_NAME structure, then get each entry with
X509_NAME_get_entry().  A few more calls will obtain
the name/value pair from the entry, as UTF8 strings,
which should be converted to Python UNICODE strings.
OpenSSL has all the proper support, but Python's shim
doesn't interface to it correctly. 

X509_NAME_oneline() doesn't handle Unicode; it converts
non-ASCII values to "\xnn" format. Again, it's for
debug output only.

So what's needed are two new functions for Python's SSL
sockets to replace "issuer" and "server".  The new
functions should return lists of Unicode strings
representing the key/value pairs. (A list is needed,
not a dictionary; two strings with the same key
are both possible and common.)

The reason this now matters is that new "high
assurance" certs, the ones that tell you how much a
site can be trusted, are now being deployed, and to use
them effectively, you need that info.  Support for them
is in Internet Explorer 7, so they're going to be
widespread soon. Python needs to catch up.

And, of course, this needs to be fixed as part of
Unicode support.  


John Nagle
Animats


--

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-11-17 08:56

Message:
Logged In: YES 
user_id=11375
Originator: NO

The request is bug #1425 in the OpenSSL request tracker (go to openssl.org
> Support for a link).


--

Comment By: John Nagle (nagle)
Date: 2006-11-08 02:02

Message:
Logged In: YES 
user_id=5571

I've submitted a request (titled "Request: make
X509_NAME_oneline() use same formatter as
X509_NAME_print_ex()") to the OpenSSL developers to fix this
on their side.  If they fix that, delimiters will be escaped
per the standard.

The OpenSSL people should also export the functionality of
getting this i

[ python-Bugs-1598361 ] Misspelled submodule names for email module.

2006-11-17 Thread SourceForge.net
Bugs item #1598361, was opened at 2006-11-17 13:48
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1598361&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: Documentation
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Dmytro O. Redchuk (truefox)
Assigned to: Nobody/Anonymous (nobody)
Summary: Misspelled submodule names for email module.

Initial Comment:
There are at http://docs.python.org/lib/module-email.html and below some errors 
in submodule names:
--
# taken from
# http://docs.python.org/lib/module-email.message.html :
>>> from email.generator import Generator
--
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named generator
>>> from email.Generator import Generator
>>> 

The same for email.Message, email.Header and, probably, others (they start with 
lowercase letters).



--

>Comment By: Georg Brandl (gbrandl)
Date: 2006-11-17 19:46

Message:
Logged In: YES 
user_id=849994
Originator: NO

This is not a bug, you're looking at the docs for Python 2.5, and there
the email submodules are accessible by lower case names too.
In the 2.4 docs there's still the old titlecased name.

--

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



[ python-Bugs-1598620 ] ctypes Structure allows recursive definition

2006-11-17 Thread SourceForge.net
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



[ python-Bugs-1598620 ] ctypes Structure allows recursive definition

2006-11-17 Thread SourceForge.net
Bugs item #1598620, was opened at 2006-11-17 22:26
Message generated for change (Settings changed) made by theller
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: Thomas Heller (theller)
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