[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-09-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-09-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset 990b2d043cdfaafc3378550f7d27259410a6b918 by Antoine Pitrou (Pauli 
Virtanen) in branch '2.7':
[2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int 
(GH-31) (#3242)
https://github.com/python/cpython/commit/990b2d043cdfaafc3378550f7d27259410a6b918


--

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset 2d1653aa43cf02e6b74f9d4f178fac9969a293e2 by Antoine Pitrou (Pauli 
Virtanen) in branch '3.6':
[3.6] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int 
(GH-31) (#3241)
https://github.com/python/cpython/commit/2d1653aa43cf02e6b74f9d4f178fac9969a293e2


--

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-30 Thread Pauli Virtanen

Changes by Pauli Virtanen :


--
pull_requests: +3286

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

At this point, 2.7 and 3.6 do.

--

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-30 Thread Pauli Virtanen

Pauli Virtanen added the comment:

Created backport PR for 3.6: https://github.com/python/cpython/pull/3241
Which versions take backports?

--

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-30 Thread Pauli Virtanen

Changes by Pauli Virtanen :


--
pull_requests: +3284

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Pauli, do you want to submit backport PRs? This can be done using the 
cherry_picker script: 
https://devguide.python.org/committing/?highlight=cherry_picker#backporting-changes-to-an-older-version

--

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset 07f1658aa09f6798793c473c72b2951b7fefe220 by Antoine Pitrou (Pauli 
Virtanen) in branch 'master':
bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (#31)
https://github.com/python/cpython/commit/07f1658aa09f6798793c473c72b2951b7fefe220


--

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-06-06 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee: theller -> 
stage:  -> patch review
versions: +Python 2.7, Python 3.6, Python 3.7 -Python 3.1, Python 3.2, Python 
3.3

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-06-06 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Added the names from the experts list to this ticket.

--
nosy: +amaury.forgeotdarc, belopolsky, csabella, meador.inge

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-02-14 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue10746] ctypes c_long & c_bool have incorrect PEP-3118 type codes

2017-02-14 Thread Pauli Virtanen

Pauli Virtanen added the comment:

Converted patch to Github PR + some cleanup.

--
pull_requests: +61

___
Python tracker 

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2014-06-17 Thread Mark Lawrence

Mark Lawrence added the comment:

Could someone do a patch review on this please.

--
nosy: +BreamoreBoy

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2011-08-10 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy: +skrah

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2010-12-21 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
nosy: +pitrou

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2010-12-21 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +mark.dickinson

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2010-12-20 Thread Pauli Virtanen

New submission from Pauli Virtanen p...@iki.fi:

Currently on Python 3.x:

 import ctypes
 memoryview(ctypes.c_long()).format
'l'

This is invalid on 64-bit platforms: the above means 32-bit little-endian 
float. The '' endian specification turns on the standard size mode 
(similarly as for the struct module), which makes type character have a 
platform-independent meaning.

Unfortunately, the struct module format syntax does *not* allow specifying 
native-size non-native-endian items. So just replacing '' by '^' cannot be in 
general be done.

Suggested fix attached. It adds a converter function that maps the 
platform-dependent ctypes codes to struct module standard-size codes; handling 
c_long and c_bool specially.

***

After this patch (and the one in http://bugs.python.org/issue10744 ):

 import numpy as np
 from ctypes import *
 class Point(Structure):
... _fields_ = [(x, c_long), (y, c_long)]
... 
 class StructWithArrays(Structure):
... _fields_ = [(x, c_long * 3 * 2), (y, Point * 4)]
... 
 x = StructWithArrays()
 y = np.asarray(x)
 y.dtype
dtype([('x', 'i8', (2, 3)), ('y', [('x', 'i8'), ('y', 'i8')], (4,))])
 y['x'] = [[1,2,3],[4,5,6]]
 y['y']['x'] = np.arange(4) + 10
 y['y']['y'] = np.arange(4) + 20
 x.x[0][0]
1
 x.x[0][1]
2
 x.x[0][2]
3
 x.y[0].x
10
 x.y[1].x
11
 x.y[0].y
20
 x.y[1].y
21

--
files: 001-ctypes-fix-pep-3118-type-codes-for-c-long-and-c-bool.patch
keywords: patch
messages: 124411
nosy: pv
priority: normal
severity: normal
status: open
title: ctypes c_long  c_bool have incorrect PEP-3118 type codes
Added file: 
http://bugs.python.org/file20124/001-ctypes-fix-pep-3118-type-codes-for-c-long-and-c-bool.patch

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



[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes

2010-12-20 Thread Pauli Virtanen

Changes by Pauli Virtanen p...@iki.fi:


--
assignee:  - theller
components: +ctypes
nosy: +theller
type:  - behavior
versions: +Python 3.1, Python 3.2, Python 3.3

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