Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ambiguous overloaded method
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bibi21000  
View profile  
 More options Aug 29 2012, 3:38 pm
From: bibi21000 <bibi21...@gmail.com>
Date: Wed, 29 Aug 2012 12:38:29 -0700 (PDT)
Local: Wed, Aug 29 2012 3:38 pm
Subject: ambiguous overloaded method

Hi all
I try to update python-openzwave and I've got some problems. The first is
an ambiguous overloaded method when trying to compile
I try to compile it on 0.14 (oneiric) and 0.15 (precise)
Here is the pyx :

ctypedef unsigned int uint32
ctypedef unsigned long uint64
ctypedef int int32
ctypedef int int16
ctypedef unsigned char uint8

    def setValue(self, id, value):
        '''
Sets the value of a device valueid.
Due to the possibility of a device being asleep, the command is assumed to
suceeed, and the value
held by the node is updated directly.  This will be reverted by a future
status message from the device
if the Z-Wave message actually failed to get through.  Notification
callbacks will be sent in both cases.
@param id the ID of a value.
@param value the value to set
        '''
        cdef float type_float
        cdef bint type_bool
        cdef uint8 type_byte
        cdef int32 type_int
        cdef int16 type_short
        cdef string type_string

        if values_map.find(id) != values_map.end():
            datatype = PyValueTypes[values_map.at(id).GetType()]

            if datatype == "Bool":
                type_bool = value
                self.manager.SetValue(values_map.at(id), type_bool)
            elif datatype == "Byte":
                type_byte = value
                self.manager.SetValue(values_map.at(id),
type_byte)            
            elif datatype == "Decimal":
                type_float = value
                self.manager.SetValue(values_map.at(id), type_float)
            # TODO: this gives me an "ambiguous overloaded method", I don't
understand why.
            elif datatype == "Int":
                type_int = value
                self.manager.SetValue(values_map.at(id), type_int)
            #elif datatype == "Short":
            #    type_short = value
            #    self.manager.SetValue(values_map.at(id), type_short)
            elif datatype == "String":
                type_string = string(value)
                self.manager.SetValue(values_map.at(id), type_string)

The C headers

        bool SetValue( ValueID const& _id, bool const _value );

        bool SetValue( ValueID const& _id, uint8 const _value );

        bool SetValue( ValueID const& _id, float const _value );

        bool SetValue( ValueID const& _id, int32 const _value );

        bool SetValue( ValueID const& _id, int16 const _value );

        bool SetValue( ValueID const& _id, string const& _value );

And the result of the compilation :

Error compiling Cython file:
------------------------------------------------------------
...
                type_float = value
                self.manager.SetValue(values_map.at(id), type_float)
            # TODO: this gives me an "ambiguous overloaded method", I don't
understand why.
            elif datatype == "Int":
                type_int = value
                self.manager.SetValue(values_map.at(id), type_int)
                                    ^
------------------------------------------------------------

openzwave.pyx:1229:37: ambiguous overloaded method

Any idea ?
This code is not mine and I'm a cython newbie : maybe there is a more
simple way to do it ; let me know
TIA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Behnel  
View profile  
 More options Aug 30 2012, 7:01 am
From: Stefan Behnel <stefan...@behnel.de>
Date: Thu, 30 Aug 2012 13:01:22 +0200
Local: Thurs, Aug 30 2012 7:01 am
Subject: Re: [cython-users] ambiguous overloaded method
bibi21000, 29.08.2012 21:38:

Apparently, the author(s) had the same problem:

https://github.com/maartendamen/py-openzwave/blob/master/openzwave.py...

It's based on these declarations further above in the file:

        bint SetValue(ValueID& valueid, bint value)
        bint SetValue(ValueID& valueid, uint8 value)
        bint SetValue(ValueID& valueid, float value)
        bint SetValue(ValueID& valueid, int32 value)
        bint SetValue(ValueID& valueid, int16 value)
        bint SetValue(ValueID& valueid, string value)

Note that the first parameter that is passed into the method is not a C++
reference type but the plain value type. Just a guess, but that might lead
to a slight difference in the signature matching that prevents an exact
match. IMHO, it shouldn't.

As a work-around, use the github version of their code.

Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bibi21000  
View profile  
 More options Aug 30 2012, 2:55 pm
From: bibi21000 <bibi21...@gmail.com>
Date: Thu, 30 Aug 2012 11:55:31 -0700 (PDT)
Local: Thurs, Aug 30 2012 2:55 pm
Subject: Re: [cython-users] ambiguous overloaded method

Le jeudi 30 août 2012 13:01:25 UTC+2, Stefan Behnel a écrit :

Yes. As I've said in the previous post, I try to update it.
You've surely seen that it is no longer maintained. It use an very old
release of openzwave which have a poor set of functions and doesn't compile
on recent distribs (precise for example)

problem only appears with int32 and int16

From cython documentation :

   1.

   If the header file uses typedef names such as word to refer to
   platform-dependent flavours of numeric types, you will need a corresponding
   ctypedef<http://docs.cython.org/src/userguide/language_basics.html#ctypedef>statement, but you don’t need to match the type exactly, just use something
   of the right general kind (int, float, etc). For example,:

   ctypedef int word

    will work okay whatever the actual size of a word is (provided the
   header file defines it correctly). Conversion to and from Python types, if
   any, will also be used for this new type

Sould it be the problem ?
cython uses the same type to map int16 and "int32" so it couldn't find the
right method after that ?

As a work-around, use the github version of their code.


?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Behnel  
View profile  
 More options Aug 30 2012, 3:22 pm
From: Stefan Behnel <stefan...@behnel.de>
Date: Thu, 30 Aug 2012 21:22:39 +0200
Local: Thurs, Aug 30 2012 3:22 pm
Subject: Re: [cython-users] ambiguous overloaded method
bibi21000, 30.08.2012 20:55:

Ah, right - I missed this on first sight:

"""
ctypedef unsigned int uint32
ctypedef unsigned long uint64
ctypedef int int32
ctypedef int int16
ctypedef unsigned char uint8
"""

Sure, this is wrong. Change the int16 ctypedef from int to short and it
should work.

>> As a work-around, use the github version of their code.
> ?

... instead of a release version. But even better, fix the above and send
them a pull request.

Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Behnel  
View profile  
 More options Aug 30 2012, 5:03 pm
From: Stefan Behnel <stefan...@behnel.de>
Date: Thu, 30 Aug 2012 23:03:50 +0200
Local: Thurs, Aug 30 2012 5:03 pm
Subject: Re: [cython-users] ambiguous overloaded method
bibi21000, 30.08.2012 22:40:

You're welcome. If you want to do it really right, get rid of the above
declarations all together and use cimports from the libc.stdint module instead.

https://github.com/cython/cython/blob/master/Cython/Includes/libc/std...

Bon courage,

Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bibi21000  
View profile  
 More options Aug 31 2012, 3:31 pm
From: bibi21000 <bibi21...@gmail.com>
Date: Fri, 31 Aug 2012 12:31:35 -0700 (PDT)
Local: Fri, Aug 31 2012 3:31 pm
Subject: Re: [cython-users] ambiguous overloaded method

Le jeudi 30 août 2012 23:03:52 UTC+2, Stefan Behnel a écrit :

I'll take a look at this

> Bon courage,

Merci


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bibi21000  
View profile  
 More options Sep 18 2012, 5:51 pm
From: bibi21000 <bibi21...@gmail.com>
Date: Tue, 18 Sep 2012 14:51:35 -0700 (PDT)
Local: Tues, Sep 18 2012 5:51 pm
Subject: Re: [cython-users] ambiguous overloaded method

Me again.
Everything works fine on cython 0.14.1 but does not compile on cython 0.16.

The full code is here :
http://code.google.com/p/python-openzwave/source/browse/lib/libopenzw...

   1. running build_ext
   2. cythoning lib/libopenzwave.pyx to lib/libopenzwave.cpp
   3.  
   4. Error compiling Cython file:
   5. ------------------------------------------------------------
   6. ...
   7.         if values_map.find(id) != values_map.end():
   8.             datatype = PyValueTypes[values_map.at(id).GetType()]
   9.  
   10.             if datatype == "Bool":
   11.                 type_bool = value
   12.                 cret = self.manager.SetValue(values_map.at(id),
   type_bool)
   13.                                            ^
   14. ------------------------------------------------------------
   15.  
   16. lib/libopenzwave.pyx:1584:44: ambiguous overloaded method
   17.  
   18. Error compiling Cython file:
   19. ------------------------------------------------------------
   20. ...
   21.                 type_bool = value
   22.                 cret = self.manager.SetValue(values_map.at(id),
   type_bool)
   23.                 ret = 1 if cret else 0
   24.             elif datatype == "Byte":
   25.                 type_byte = value
   26.                 cret = self.manager.SetValue(values_map.at(id),
   type_byte)
   27.                                            ^
   28. ------------------------------------------------------------
   29.  
   30. lib/libopenzwave.pyx:1588:44: ambiguous overloaded method
   31.  
   32. Error compiling Cython file:
   33. ------------------------------------------------------------
   34. ...
   35.                 type_float = value
   36.                 cret = self.manager.SetValue(values_map.at(id),
   type_float)
   37.                 ret = 1 if cret else 0
   38.             elif datatype == "Int":
   39.                 type_int = value
   40.                 cret = self.manager.SetValue(values_map.at(id),
   type_int)
   41.                                            ^
   42. ------------------------------------------------------------
   43.  
   44. lib/libopenzwave.pyx:1596:44: ambiguous overloaded method
   45.  
   46. Error compiling Cython file:
   47. ------------------------------------------------------------
   48. ...
   49.                 type_int = value
   50.                 cret = self.manager.SetValue(values_map.at(id),
   type_int)
   51.                 ret = 1 if cret else 0
   52.             elif datatype == "Short":
   53.                 type_short = value
   54.                 cret = self.manager.SetValue(values_map.at(id),
   type_short)
   55.                                            ^
   56. ------------------------------------------------------------
   57.  
   58. lib/libopenzwave.pyx:1600:44: ambiguous overloaded method

I've moved all ctype declaration in a separate pxd file :
http://code.google.com/p/python-openzwave/source/browse/lib/mylibc.pxd
So I can use the standard
https://github.com/cython/cython/blob/master/Cython/Includes/libc/std... now. Will it solve my problem ?

Le vendredi 31 août 2012 21:31:35 UTC+2, bibi21000 a écrit :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bibi21000  
View profile  
 More options Sep 27 2012, 8:58 am
From: bibi21000 <bibi21...@gmail.com>
Date: Thu, 27 Sep 2012 05:58:26 -0700 (PDT)
Local: Thurs, Sep 27 2012 8:58 am
Subject: Re: [cython-users] ambiguous overloaded method

well, I try to use the standard integer types (exact match size) but doesn't compile with 0.16
one user reports that compilation is ok with 0.15
any idea ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »