You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to find an entry point named 'PyNumber_Divide' when trying to call an overridden division operator #802
System.EntryPointNotFoundException: 'Unable to find an entry point named 'PyNumber_Divide' in DLL 'python36'.'
at Python.Runtime.Runtime.PyNumber_Divide(IntPtr o1, IntPtr o2)
at Python.Runtime.PyObject.TryBinaryOperation(BinaryOperationBinder binder, Object arg, Object& result)
at CallSite.Target(Closure , CallSite , Object , Int32 )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
It works for + 2 in place of / 2, but might affect other operators too.
Workaround
The workaround is to do .__div__(2) instead of / 2
@denfromufa I don't think #86 is directly related. The fact that PyNumber_Divide wrapper exists already seems to be an issue on its own.
Existence of #86 just indicates TryBinaryOperation is very incomplete.
Activity
den-run-ai commentedon Jan 16, 2019
@lostmsu there are some other funny things with
dynamic- see #86. Can you make sure that this is reproducible without usingdynamicin pythonnet?lostmsu commentedon Jan 17, 2019
@denfromufa I don't think #86 is directly related. The fact that
PyNumber_Dividewrapper exists already seems to be an issue on its own.Existence of #86 just indicates
TryBinaryOperationis very incomplete.den-run-ai commentedon Jan 17, 2019
den-run-ai commentedon Jan 17, 2019
@lostmsu the issue is that python 3 does not have this method, it is only in Python 2:
https://docs.python.org/2/c-api/number.html#c.PyNumber_Divide
Instead probably this one should be used:
https://docs.python.org/3/c-api/number.html#c.PyNumber_TrueDivide
Let me know if you like to submit a PR?
lostmsu commentedon Jan 17, 2019
@denfromufa I might get to work on this, but not soon enough :(
filmor commentedon Jan 18, 2019
Ooh, this is a nasty issue, I'll look into it.
Switch to using TrueDivide instead of Divide everywhere
Switch to using TrueDivide instead of Divide everywhere
Switch to using TrueDivide instead of Divide everywhere