pyd icon indicating copy to clipboard operation
pyd copied to clipboard

Problem with string[] wrapping?

Open Laeeth opened this issue 10 years ago • 3 comments

=== kiss.d struct BigRecord { int i; string[] values; }

import pyd.pyd; extern(C) void PydMain() { def!(doit,PyName!"doit", BigRecord function(bool))(); module_init(); wrap_struct!(BigRecord,Member!("i"),Member!("values")); }

BigRecord doit(bool arg) { BigRecord record; record.i=(arg)?2:-2; record.values=["hello","there","my friend"]; return record; } === setup.py from pyd.support import setup, Extension

projName = 'countdown'

setup( name=projName, version='0.1', ext_modules=[ Extension(projName, [ "kiss.d"], build_deimos=True, d_lump=True ) ], )

== build [laeeth@console kiss]$ python setup.py build --compiler=ldc running build running build_ext building 'countdown' extension ldc2 -relocation-model=pic -c -singleobj -d-version=PydPythonExtension -d-version=Python_2_4_Or_Later -d-version=Python_2_5_Or_Later -d-version=Python_2_6_Or_Later -d-version=Python_2_7_Or_Later -d-version=Python_Unicode_UCS4 -d-debug -I /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure -of build/temp.linux-x86_64-2.7/infra/temp.o kiss.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/class_wrap.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/ctor_wrap.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/def.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/embedded.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/exception.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/extra.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/func_wrap.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/make_object.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/make_wrapper.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/op_wrap.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/pyd.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/pydobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/references.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/struct_wrap.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/thread.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/util/conv.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/util/typeinfo.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/util/typelist.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/util/multi_index.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/util/replace.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/meta/Demangle.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/meta/Nameof.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/abstract_.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/ast.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/boolobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/bufferobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/bytearrayobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/bytesobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/cellobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/ceval.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/classobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/cobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/codecs.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/code.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/compile.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/complexobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/cStringIO.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/datetime.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/descrobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/dictobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/enumobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/errcode.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/eval.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/fileobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/floatobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/frameobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/funcobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/genobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/grammar.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/import_.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/intobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/intrcheck.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/iterobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/listobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/longintrepr.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/longobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/marshal.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/memoryobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/methodobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/modsupport.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/moduleobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/node.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/object.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/objimpl.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/parsetok.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pgenheaders.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pyarena.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pyatomic.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pycapsule.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pydebug.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pyerrors.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pymem.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pyport.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pystate.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pystrcmp.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pystrtod.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/Python.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pythonrun.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/pythread.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/rangeobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/setobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/sliceobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/stringobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/structmember.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/structseq.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/symtable.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/sysmodule.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/timefuncs.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/traceback.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/tupleobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/unicodeobject.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/deimos/python/weakrefobject.d build/temp.linux-x86_64-2.7/infra/pydmain.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/d/python_so_linux_boilerplate.d /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/make_object.d(773): Error: cannot implicitly convert expression (python_to_d(item)) of type string to dchar[] /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/make_object.d(740): Error: function pyd.make_object.python_iter_to_d!(string[]).python_iter_to_d no return exp; or assert(0); at end of function /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/make_object.d(482): Error: template instance pyd.make_object.python_iter_to_d!(string[]) error instantiating /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/struct_wrap.d-mixin-73(73): instantiated from here: python_to_d!(string[]) /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/struct_wrap.d(105): instantiated from here: wrapped_member!(BigRecord_, "values", "rw") /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/class_wrap.d(1503): instantiated from here: call!("BigRecord", BigRecord_) /home/laeeth/anaconda/lib/python2.7/site-packages/pyd/infrastructure/pyd/class_wrap.d(1474): instantiated from here: _wrap_class!(BigRecord, "BigRecord", "", "", Member!"i", Member!"values") kiss.d(12): instantiated from here: wrap_struct!(BigRecord, Member!"i", Member!"values") error: command 'ldc2' failed with exit status 1

Laeeth avatar Mar 18 '15 18:03 Laeeth

2a08d53a0a3aefb260346ef998a4fc81e72bbd73 should fix, please confirm

ariovistus avatar Mar 19 '15 01:03 ariovistus

Tku. Will do so shortly. In case you didn't see, I made a start on moving the wiki over. It is confusing to have two sets of docs (bitbucket and readthedocs) both of which are out of date (I think) and aren't associated with the right location for current release. It would be good to kill bitbucket site in due course.

All the wiki files from bitbucket are moved, but probably links broken and needs tidying up.

Docx could do with improvement too. There are good examples in unit tests not in the docs, and more should be said about numpy. Also makes sense to have a chapter on linking Cython with D (easy when you know how) since people will come to pyd as first port of call. I will do what I can on this front as I get the time.

Laeeth

Sent from my iPad

On 19 Mar 2015, at 01:22, ariovistus [email protected] wrote:

2a08d53 should fix, please confirm

— Reply to this email directly or view it on GitHub.

Laeeth avatar Mar 20 '15 04:03 Laeeth

All good points. I'd like to have documentation in readthedocs though. Sphinx seems to be pretty good at pulling your source code into your documentation...

ariovistus avatar Mar 21 '15 02:03 ariovistus