Home Forums Nazca Hashme error Reply To: Hashme error

#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