Gustavo Sverzut Barbieri | 1 Oct 01:57 2007
Picon

Disabling docstrings in generated .so?

Hi,

Recently I've documented my project with epydoc strings so I could
generate API reference for users. (It works fine, except that
parameter introspection doesn't work and I had to create another tag
" <at> parm").

But since I'll also use this on an embedded device, it would be great
to wipe out these strings for this target.

Is it possible? Anyone plan to provide this feature? I'll start to
hack something here and send the patch ASAP.

--

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
Gustavo Sverzut Barbieri | 1 Oct 02:26 2007
Picon

Re: Disabling docstrings in generated .so?

On 9/30/07, Gustavo Sverzut Barbieri <barbieri@...> wrote:
> Hi,
>
> Recently I've documented my project with epydoc strings so I could
> generate API reference for users. (It works fine, except that
> parameter introspection doesn't work and I had to create another tag
> " <at> parm").
>
> But since I'll also use this on an embedded device, it would be great
> to wipe out these strings for this target.
>
> Is it possible? Anyone plan to provide this feature? I'll start to
> hack something here and send the patch ASAP.

Here is a first attempt, does it looks fine?

--

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
Attachment (cython-no_docstrings.patch): application/octet-stream, 5134 bytes
On 9/30/07, Gustavo Sverzut Barbieri <barbieri@...> wrote:
> Hi,
>
(Continue reading)

Gustavo Sverzut Barbieri | 1 Oct 05:36 2007
Picon

SlotDescriptor with version support (or: removing warnings with python-2.4)

Hi guys,

I still use python-2.4 since it's the default on Gentoo so I was
annoyed by warnings about "excess elements in struct initializer"
related to "nb_index", field not existent on python < 2.5.

Attached patch adds a PY_VERSION_HEX parameter to SlotDescriptor and
MethodSlot, if provided it will wrap the code with "#if PY_VERSION_HEX
<VALUE>" where <VALUE> is the provided value to PY_VERSION_HEX, it can
be something like ">= 0x02050000".

PS: patch may apply with offsets since I have generated it on top of
my other patch to remove docstrings.

--

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
Attachment (cython_SlotDescriptor_version_support.patch): application/octet-stream, 3055 bytes
Hi guys,

I still use python-2.4 since it's the default on Gentoo so I was
annoyed by warnings about "excess elements in struct initializer"
related to "nb_index", field not existent on python < 2.5.
(Continue reading)

Thomas Hunger | 1 Oct 11:38 2007
Picon

Re: Test suite?

> One way to do it would be doctests, i.e. write a .pyx module with a

I believe doctest is used to check if examples in the docs still work, 
not really as a unit-test suite.

> In any case, we need something portable here. I know that Greg has
> a test suite for Pyrex, but besides the functionality, it actually
> compares the generated source with an expected source file. That
> makes it possible to also check for things like GIL handling or
> increfs, but I think we shouldn't check the source, as it is highly
> likely to change considerably if Cython changes slightly. But we

I agree. Maybe we could do something like:

1) compile all pyx-modules in the test directory (via ./setup build)
2) Test the modules via doctest, unittest or any other of the many
   unit test frameworks. 

The "import unittest" distributed with every python is not great, but 
it does the job. But I really don't mind what we choose.

> http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-Test
>s-0.9.5.1.tar.gz

Thanks for the pointer. We could definitly use the pyx-source for 
tests.

Tom
Thomas Hunger | 1 Oct 11:38 2007
Picon

Re: has_body and defining in c classes

> > I have a project which defines a pxd with inheritance like this
> >
> > cdef class A:
> >     cdef double x
>
> This is a class definition.
>
> > cdef class B(A)
>
> This is a forward declaration, not a class definition. Cython will
> expect the real implementation later on but already knows how it
> will look like. If you don't provide an implementation inside the
> module, B will not become a member of the module.
>
> > One fix is to write
> >
> > cdef class B(A):
> >     pass
>
> Not a fix but the implementation of class B.

Thanks! I did not understand that before.

Tom

>
> Stefan

Gustavo Sverzut Barbieri | 1 Oct 16:02 2007
Picon

Fwd: Disabling docstrings in generated .so?

I've sent this mail to <cython-dev@...>, but seems that
it didn't reach the list, weird.

---------- Forwarded message ----------
From: Gustavo Sverzut Barbieri <barbieri@...>
Date: Sep 30, 2007 9:26 PM
Subject: Re: Disabling docstrings in generated .so?
To: cython-dev@...

On 9/30/07, Gustavo Sverzut Barbieri <barbieri@...> wrote:
> Hi,
>
> Recently I've documented my project with epydoc strings so I could
> generate API reference for users. (It works fine, except that
> parameter introspection doesn't work and I had to create another tag
> " <at> parm").
>
> But since I'll also use this on an embedded device, it would be great
> to wipe out these strings for this target.
>
> Is it possible? Anyone plan to provide this feature? I'll start to
> hack something here and send the patch ASAP.

Here is a first attempt, does it looks fine?

--
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
(Continue reading)

Gustavo Sverzut Barbieri | 1 Oct 16:03 2007
Picon

Fwd: SlotDescriptor with version support (or: removing warnings with python-2.4)

another message that I've sent and didn't reach the list.

---------- Forwarded message ----------
From: Gustavo Sverzut Barbieri <barbieri@...>
Date: Oct 1, 2007 12:36 AM
Subject: SlotDescriptor with version support (or: removing warnings
with python-2.4)
To: cython-dev@...

Hi guys,

I still use python-2.4 since it's the default on Gentoo so I was
annoyed by warnings about "excess elements in struct initializer"
related to "nb_index", field not existent on python < 2.5.

Attached patch adds a PY_VERSION_HEX parameter to SlotDescriptor and
MethodSlot, if provided it will wrap the code with "#if PY_VERSION_HEX
<VALUE>" where <VALUE> is the provided value to PY_VERSION_HEX, it can
be something like ">= 0x02050000".

PS: patch may apply with offsets since I have generated it on top of
my other patch to remove docstrings.

--

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
(Continue reading)

Thomas Hunger | 4 Oct 17:54 2007
Picon

Re: Fwd: SlotDescriptor with version support (or: removing warnings with python-2.4)

Hi,

> I still use python-2.4 since it's the default on Gentoo so I was
> annoyed by warnings about "excess elements in struct initializer"
> related to "nb_index", field not existent on python < 2.5.

Stefan Behnel did something like this, then me, now you. I think 
something similar might end up in the next release.

Tom
Gustavo Sverzut Barbieri | 4 Oct 19:17 2007
Picon

Re: Fwd: SlotDescriptor with version support (or: removing warnings with python-2.4)

On 10/4/07, Thomas Hunger <eac@...> wrote:
> Hi,
>
> > I still use python-2.4 since it's the default on Gentoo so I was
> > annoyed by warnings about "excess elements in struct initializer"
> > related to "nb_index", field not existent on python < 2.5.
>
> Stefan Behnel did something like this, then me, now you. I think
> something similar might end up in the next release.

Yes, I noticed this just after sending the patch. My bad! :-)

--

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
Carl Witty | 7 Oct 05:38 2007
Picon

incompatibility between Python and Cython (0.9.6.6)

I found an incompatibility between Python and Cython.  Cython compiles
"a < b" using PyObject_Cmp().  However, according to the Python/C API
Reference Manual (section 6.1), the true equivalent would be
PyObject_RichCompare(a, b, Py_LT).

This broke some of my code when I moved it from Python to Cython.

Carl Witty

Gmane