[issue15459] ctypes Structures with subclassed types in the _fields_ list

2019-07-30 Thread Tommy Sparber


Tommy Sparber  added the comment:

This bug is still present using Python 3.7.
I'm also not sure how to fix the leakage of the internal bitfield size encoding.

--
nosy: +tsparber
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue15459] ctypes Structures with subclassed types in the _fields_ list

2012-08-02 Thread Meador Inge

Meador Inge added the comment:

OK, I finally had some time to look at this.  The attached patch does fix the 
issue.  However, it has a nasty side effect in that the encoded bitfield size 
stays with the field member object:

   >>> class SubByte(c_ubyte): pass
   ... 
   >>> class A(Structure):
   ..._fields_ = [("x", SubByte, 5)]
   ... 
   >>> sizeof(A().x)
   327680

Before the patch things look like:

   >>> class SubByte(c_ubyte): pass
   ... 
   >>> class A(Structure):
   ..._fields_ = [("x", SubByte, 5)]
   ... 
   >>> sizeof(A().x)
   1

Leaking the internal bitfield size encoding seems like a deal breaker to me.

--
type:  -> behavior

___
Python tracker 

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



[issue15459] ctypes Structures with subclassed types in the _fields_ list

2012-07-26 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge
stage:  -> patch review
versions: +Python 3.2 -Python 3.4

___
Python tracker 

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



[issue15459] ctypes Structures with subclassed types in the _fields_ list

2012-07-26 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue15459] ctypes Structures with subclassed types in the _fields_ list

2012-07-26 Thread Thomas Heller

Thomas Heller  added the comment:

The attached patch for branch default fixes this issue.  It also contains a 
unittest.

--
Added file: http://bugs.python.org/file26530/bitfields.patch

___
Python tracker 

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



[issue15459] ctypes Structures with subclassed types in the _fields_ list

2012-07-26 Thread Thomas Heller

New submission from Thomas Heller :

When a ctypes Structure uses a subclass of c_int, c_short, c_byte in the 
_fields_ list to define bitfields, the results are wrong.

The attached script showbug.py demonstrates this behaviour.

--
components: ctypes
files: showbug.py
keywords: needs review, patch
messages: 166496
nosy: theller
priority: normal
severity: normal
status: open
title: ctypes Structures with subclassed types in the _fields_ list
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file26529/showbug.py

___
Python tracker 

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