[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2018-07-04 Thread Armin Rigo


Armin Rigo  added the comment:

cffi supports complex numbers since release 1.11---for direct calls using the 
API mode.  That means that neither CFFI's ABI mode, nor ctypes, can possibly 
work yet.  The problem is still libffi's own support, which is still not 
implemented (apart on a very uncommon CPU architecture, the s390).

--

___
Python tracker 

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2018-07-04 Thread Reid


Reid  added the comment:

I concur with rutsky.  Complex numbers are essential in the physical sciences, 
and the complex type is part of the c99 standard.  Trying to shoehorn complex 
support by a user-defined type makes use of the builtin methods for the 
standard complex type clunky.

--
nosy: +rkmountainguy
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2017-01-29 Thread Armin Rigo

Armin Rigo added the comment:

* Tom: the issue is unrelated to cffi, but both ctypes and cffi could proceed 
to support C complexes, now that libffi support has been added.

* Mark: the problem is that the text you quote from the C standard fixes the 
representation of a complex in memory, but doesn't say anything about directly 
passing a complex as argument or return value to a function call.  Platforms 
use custom ways to do that.  The text you quote says a complex is an array of 
two real numbers; but passing an array as argument to a function works by 
passing a pointer to the first element.  Typically, this is not how complexes 
are passed: instead, some pointerless form of "passing two real numbers" is 
used.

--
nosy: +arigo

___
Python tracker 

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2017-01-22 Thread Mark Dickinson

Mark Dickinson added the comment:

Thanks, Tom. Re-opening.

--
resolution: postponed -> 
status: closed -> open

___
Python tracker 

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2017-01-21 Thread Tom Krauss

Tom Krauss added the comment:

I'm trying to add support for this in cffi, which uses ctypes... apparently 
this is now supported in libffi (https://github.com/libffi/libffi, v3.2 Nov 
2014). 
It would be nice if this issue could be re-opened, or another one created for 
the same purpose.

--
nosy: +Tom Krauss

___
Python tracker 

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-27 Thread Mark Dickinson

Mark Dickinson added the comment:

Postponing as suggested.

--
resolution:  - postponed
status: open - closed

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-14 Thread Meador Inge

Changes by Meador Inge mead...@gmail.com:


--
nosy: +meador.inge

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-13 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-11 Thread Mark Dickinson

Mark Dickinson added the comment:

 But I'm unsure is this is expected behavior or luck, and on some
 platform this code will not work due to different complex numbers
 internal representation.

What platform?  Isn't the complex number representation standard?  E.g., C99 
6.2.5p13 says: Each complex type has the same representation and alignment 
requirements as an array type containing exactly two elements of the 
corresponding real type; the first element is equal to the real part, and the 
second element to the imaginary part, of the complex number.

--
nosy: +mark.dickinson

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-11 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
stage:  - test needed
versions: +Python 3.4

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-10 Thread Vladimir Rutsky

Vladimir Rutsky added the comment:

Yes, I managed to pass and operate with matrices of complex numbers to pure C 
and Fortran programs by using Numpy and their ctype adapters (only for whole 
matrices, they don't provide c_complex type; in general see 
http://www.scipy.org/Cookbook/Ctypes for details).

I suppose pure python solution that suggested in provided by you link works too:

class Complex64(Structure):
_fields_ = [(real, c_float), (imag, c_float)]

But I'm unsure is this is expected behavior or luck, and on some platform this 
code will not work due to different complex numbers internal representation.

Any way this should be implemented in libffi first, and then in ctypes, so this 
feature request should be postponed, IMO.

--

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

libffi still has no support for _Complex.

Did you try with a pure Python solution, like the one suggested in 
http://objectmix.com/python/112374-re-ctypes-c99-complex-numbers.html

--
nosy: +amaury.forgeotdarc

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



[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2013-01-08 Thread Vladimir Rutsky

New submission from Vladimir Rutsky:

It would be nice if Python will be able to access variables with C99 complex 
types through ctypes module.

--
components: ctypes
messages: 179378
nosy: rutsky
priority: normal
severity: normal
status: open
title: Add support for C99 complex type (_Complex) as ctypes.c_complex
type: enhancement

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