[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11:

>>> from ctypes import *
>>> class r( BigEndianStructure ):
... _fields_ = [( "d0", c_uint32),
... ( "d1", c_bool )
...  ]
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/iritkatriel/src/cpython-654/Lib/ctypes/_endian.py", line 31, in 
__setattr__
fields.append((name, _other_endian(typ)) + rest)
 ^^
  File "/Users/iritkatriel/src/cpython-654/Lib/ctypes/_endian.py", line 21, in 
_other_endian
raise TypeError("This type does not support other endian: %s" % typ)

TypeError: This type does not support other endian: 

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 2.7

___
Python tracker 

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



[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2017-06-06 Thread Hassan El Karouni

Changes by Hassan El Karouni :


Added file: http://bugs.python.org/file46927/__init__.py

___
Python tracker 

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



[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2017-06-06 Thread Hassan El Karouni

Changes by Hassan El Karouni :


Added file: http://bugs.python.org/file46926/c_bool_bug.py

___
Python tracker 

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



[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2017-06-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Please post or upload minimal code that reproduces the problem for you.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2017-05-30 Thread Hassan El Karouni

New submission from Hassan El Karouni:

When trying to create a BigEndianStructure containing a c_bool field (on a 
windows machine), i get the following traceback:

  File "/home/elkarouh/anaconda2/lib/python2.7/ctypes/_endian.py", line 24, in 
_other_endian
raise TypeError("This type does not support other endian: %s" % typ)
TypeError: This type does not support other endian: 

I fixed the problem by patching __init__.py under the ctypes directory by 
adding the following two lines:

c_bool.__ctype_le__ = c_bool.__ctype_be__ = c_bool
_check_size(c_bool)

--
components: ctypes
messages: 294747
nosy: Hassan El Karouni
priority: normal
severity: normal
status: open
title: c_bool type not supported for BigEndianStructure on little-endian machine
type: compile error
versions: Python 2.7

___
Python tracker 

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