Regarding your suggestion, there is helper function that does that:

Just for those googling for answers:,

I can also add that 

from PyObjCTools.Conversion import fromPythonDecimal

Does this conversion for you from Decimal To NSDecimalNumber.

Code is located at:


On Thu, Dec 1, 2011 at 8:06 AM, Marc Van Olmen <marcvanolmen@gmail.com> wrote:
hi Aahz,

i got an answer offline that confirmed a bug in Lion:

:>>>   aNSDecimalNumber.compare_(aPythonDecimal)

This also causes infinite recusion, this time on the Python side. With some luck it is related to the issue you ran into using bindings.

I currently found a workaround  in my code. I haven't tried yours yet.

Thanks for the input!


On Tue, Nov 29, 2011 at 9:17 PM, Aahz <aahz@pythoncraft.com> wrote:
On Tue, Nov 22, 2011, Marc Van Olmen wrote:
> for our project we haven't upgraded to latest version of pyobjc I just
> notice we run with 2.2b3 but we have the following bug on Lion Only:
> When bindings try to compare a decimal number that originally came from
> Python code. It goes in endless recursive calls...

Nobody else has responded, so I'll just suggest that you should
explicitly convert between Python Decimal and NSDecimalNumber.
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"....Normal is what cuts off your sixth finger and your tail..."  --Siobhan