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

2017-06-06 Thread Hassan El Karouni

Changes by Hassan El Karouni <elkar...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30510>
___
___
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 <elkar...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30510>
___
___
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue30510>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24944] traceback when using tempfile module on windows

2015-08-27 Thread Hassan El Karouni

New submission from Hassan El Karouni:

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import tempfile
 tempfile.mkstemp()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python27\lib\tempfile.py, line 308, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
  File C:\Python27\lib\tempfile.py, line 240, in _mkstemp_inner
_set_cloexec(fd)
  File C:\Python27\lib\tempfile.py, line 50, in _set_cloexec
flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
AttributeError: 'module' object has no attribute 'F_GETFD'


On line 51 in tempfile.py, an AttributeError exception is not caught. The 
problem is caused by the fact that on Windows, the fcntl module is supposed not 
to exist, but in my case, a dummy module with the same name was put on the 
path. This means that line 50 is run thru when making the mkstemp() call.
The fix is to catch the AttributeError exception on line 51.
The bug might also affect Python 3 but this is to be checked.

--
components: Library (Lib)
messages: 249228
nosy: Hassan El Karouni
priority: normal
severity: normal
status: open
title: traceback when using tempfile module on windows
type: crash
versions: Python 2.7

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