From atash at google.com Mon Dec 14 21:15:13 2015 From: atash at google.com (Masood Malekghassemi) Date: Mon, 14 Dec 2015 18:15:13 -0800 Subject: [Cython] Cython coverage and having the package root in a child directory of the coverage working directory Message-ID: tl;dr: How ought one fix file tracing paths for Cython coverage? Hello y'all, I'm currently trying to integrate C code into the GRPC Python project wherein said code is outside of my control, and belonging to the umbrella GRPC project. The Python+Cython code exists in a subdirectory (i.e. the package_dirs for setup.py includes an entry '': 'src/python/grpcio'). Everything works great, *except* for the Cython coverage plugin. For some strange reason, when the _c_files_map of the Plugin object is created, it appears to assume that the files it's reading are coming directly off of the invocation site of coverage.py as opposed to where the files actually are. Going a bit deeper: in the generated .c file for the .pyx, the package directory stem 'src/python/grpcio' is missing from comments on __Pyx_TraceLine(...): /* "grpc/_cython/cygrpc.pyx":53 * grpc_shutdown() * * _module_state = _ModuleState() # <<<<<<<<<<<<<< * */ This doesn't appear to be a problem for .pxi files, however: /* "src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi":32 * cimport cpython * * import time # <<<<<<<<<<<<<< * * */ We cannot simply move the Cython files around to being relative to umbrella root, as that would involve changing the umbrella project structure beyond the parameters of our current desiderata. I'm currently working around this problem by just ignoring the .pyx file (it contains little code anyway), and keeping only the .pxi files. I'd like to fix this (it doesn't seem difficult), but haven't looked into where one ought to start yet. An aside: we're using .pxi files instead of .pxds now due to some inexplicable behavior wherein a .pxd induces an expectation that a module exists when it doesn't. We're not splitting the extension out into multiple modules because there must now be only one copy of the statically linked gRPC core (wherein static linkage is among recent desiderata for distribution purposes). Context: https://github.com/grpc/grpc/tree/350345ffc70c93295ad5b78b306f9668a6332589 (steps to see what's happening: make; CONFIG=opt ./tools/run_tests/run_python.sh. The relevant C file may be examined under src/python/grpcio/grpc/_cython following the build). Thanks for reading! -------------- next part -------------- An HTML attachment was scrubbed... URL: From xnox at ubuntu.com Wed Dec 16 00:18:29 2015 From: xnox at ubuntu.com (Dimitri John Ledkov) Date: Wed, 16 Dec 2015 05:18:29 +0000 Subject: [Cython] cython 0.23.4 test failure, async_iter_pep492 (), asyncio_generators, test_async_def_future.py Message-ID: Hello, Building 0.23.4 fails on ubuntu with python 3.5. Full build log is at: https://launchpadlibrarian.net/228728126/buildlog_ubuntu-xenial-amd64.cython_0.23.4-0ubuntu1_BUILDING.txt.gz First with 2.7, run.asyncio_generators are skipped. Then there is a successful run of asyncio_generators (?!) and then a failed one (?!) The what i think relevant portion of the build log is as follows: async_iter_pep492 () Doctest: async_iter_pep492 ... ok test_aiter_raises (async_iter_pep492) Doctest: async_iter_pep492.test_aiter_raises ... ok test_broken_anext (async_iter_pep492) Doctest: async_iter_pep492.test_broken_anext ... ok test_for_1 (async_iter_pep492) Doctest: async_iter_pep492.test_for_1 ... ok test_for_2 (async_iter_pep492) Doctest: async_iter_pep492.test_for_2 ... ok test_for_3 (async_iter_pep492) Doctest: async_iter_pep492.test_for_3 ... ok test_with_for (async_iter_pep492) Doctest: async_iter_pep492.test_with_for ... ok runTest (__main__.EndToEndTest) End-to-end asyncio_generators ... FAIL runTest (__main__.CythonRunTestCase) compiling (c) and running attr ... attr () Doctest: attr ... /usr/bin/python3.5 test_async_def_future.py Traceback (most recent call last): File "test_async_def_future.py", line 16, in runloop() File "test_async_def_future.py", line 14, in runloop assert events == expected, events AssertionError: ['setup', 'setval', None] ok Any help resolving this would help. Is this a broken python3.5? or cython? or both? -- Regards, Dimitri. From barcc at gmx.de Sat Dec 26 05:59:44 2015 From: barcc at gmx.de (B. Clausius) Date: Sat, 26 Dec 2015 11:59:44 +0100 Subject: [Cython] strange error message Message-ID: <567E7320.8070606@gmx.de> Hi cython devs, a strange error message, showing cython internals: $ cat gldraw.pxd ctypedef float vec4[4] ctypedef vec4 mat4[4] $ cat glarea.pyx cimport gldraw cdef struct Data: gldraw.mat4 matrix cdef Data data cdef void sync(): data.changed = True # <- this wrong line produces the error $ cython glarea.pyx Error compiling Cython file: ------------------------------------------------------------ ... void PyTuple_SET_ITEM(object p, Py_ssize_t pos, object o) void PyList_SET_ITEM(object p, Py_ssize_t pos, object o) @cname("__Pyx_carray_to_py_vec4") cdef inline list __Pyx_carray_to_py_vec4(vec4 *v, Py_ssize_t length): ^ ------------------------------------------------------------ carray.to_py:112:41: 'vec4' is not a type identifier Error compiling Cython file: ------------------------------------------------------------ ... PyList_SET_ITEM(l, i, value) return l @cname("__Pyx_carray_to_tuple_vec4") cdef inline tuple __Pyx_carray_to_tuple_vec4(vec4 *v, Py_ssize_t length): ^ ------------------------------------------------------------ carray.to_py:124:45: 'vec4' is not a type identifier $ cython --version Cython version 0.23.3 Best regards, B.C. From devel at baptiste-carvello.net Mon Dec 28 11:12:55 2015 From: devel at baptiste-carvello.net (Baptiste Carvello) Date: Mon, 28 Dec 2015 17:12:55 +0100 Subject: [Cython] strange error message In-Reply-To: <567E7320.8070606@gmx.de> References: <567E7320.8070606@gmx.de> Message-ID: Hi, not a cython dev, but I believe I hit the very same problem (I'm going on vacation now, full report in January). You may fix the compilation error by adding the following unused import: >>> from gldraw import vec4 Please tell me if it works for you, Baptiste Le 26/12/2015 11:59, B. Clausius a ?crit : > Hi cython devs, > > a strange error message, showing cython internals: > > $ cat gldraw.pxd > ctypedef float vec4[4] > ctypedef vec4 mat4[4] > > $ cat glarea.pyx > cimport gldraw > > cdef struct Data: > gldraw.mat4 matrix > > cdef Data data > > cdef void sync(): > data.changed = True # <- this wrong line produces the error > > $ cython glarea.pyx > > Error compiling Cython file: > ------------------------------------------------------------ > ... > void PyTuple_SET_ITEM(object p, Py_ssize_t pos, object o) > void PyList_SET_ITEM(object p, Py_ssize_t pos, object o) > > > @cname("__Pyx_carray_to_py_vec4") > cdef inline list __Pyx_carray_to_py_vec4(vec4 *v, Py_ssize_t length): > ^ > ------------------------------------------------------------ > > carray.to_py:112:41: 'vec4' is not a type identifier > > Error compiling Cython file: > ------------------------------------------------------------ > ... > PyList_SET_ITEM(l, i, value) > return l > > > @cname("__Pyx_carray_to_tuple_vec4") > cdef inline tuple __Pyx_carray_to_tuple_vec4(vec4 *v, Py_ssize_t length): > ^ > ------------------------------------------------------------ > > carray.to_py:124:45: 'vec4' is not a type identifier > > $ cython --version > Cython version 0.23.3 > > Best regards, > > B.C. > From devel at baptiste-carvello.net Mon Dec 28 16:15:45 2015 From: devel at baptiste-carvello.net (Baptiste Carvello) Date: Mon, 28 Dec 2015 22:15:45 +0100 Subject: [Cython] strange error message In-Reply-To: References: <567E7320.8070606@gmx.de> Message-ID: Le 28/12/2015 17:12, Baptiste Carvello a ?crit : > Hi, > > not a cython dev, but I believe I hit the very same problem (I'm going > on vacation now, full report in January). > > You may fix the compilation error by adding the following unused import: >>>> from gldraw import vec4 sorry, that's a cimport, i.e. >>> from gldraw cimport vec4 > > Please tell me if it works for you, > > Baptiste From robertwb at gmail.com Wed Dec 30 19:00:54 2015 From: robertwb at gmail.com (Robert Bradshaw) Date: Wed, 30 Dec 2015 16:00:54 -0800 Subject: [Cython] strange error message In-Reply-To: References: <567E7320.8070606@gmx.de> Message-ID: On Mon, Dec 28, 2015 at 1:15 PM, Baptiste Carvello wrote: > Le 28/12/2015 17:12, Baptiste Carvello a ?crit : >> Hi, >> >> not a cython dev, but I believe I hit the very same problem (I'm going >> on vacation now, full report in January). >> >> You may fix the compilation error by adding the following unused import: >>>>> from gldraw import vec4 > > sorry, that's a cimport, i.e. > >>>> from gldraw cimport vec4 +1, that's the solution. We should make the error better...