Home Forums Nazca Hashme error

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6351
    JHazan
    Member

    Dear Developer, using my old Pdk that was compatible with Nazca 0.0.5, now I get this error every time I try to address a building block (white box).

    Exception: Can not call an @hashme-decorated function before the Cell() call inside another @hashme decorated function. Move the function call(s) after the ‘with Cell()’ context.

    Can you help me to fix this problem?

    #6353
    Ronald
    Keymaster

    Dear JHazan,

    The warning has been added to indicate that a second @hashme decorator has been activated before using the information generated by the first hashme in a with Cell() statement. Nazca warns now by raising an Exception. The hashme inspects the function it decorates and uses that to create a hash of call signature to add to the cell. That hash info is used in the first nd.Cell() call.

    You probably tried something like this

    import nazca as nd
    
    @nd.bb_util.hashme() # A
    def A():
        with nd.Cell():
            ...
    
    @nd.bb_util.hashme()
    def B():
        A()  # call A() which has a hashme, which deletes the B hash 
        with nd.Cell():  # B hash lost at this point
            ....

    The above overwrites the B hash due to the A call.
    Better is the following:

    @nd.bb_util.hashme()
    def A():
        with nd.Cell():
            ...
    
    @nd.bb_util.hashme()
    def B():
        with nd.Cell():  # use B hash before calling other hashed functions.
            A()
            ....

    Ronald

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.