We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
>>> import gmpy2 >>> a = gmpy2.mpq(1,2) >>> b = gmpy2.mpq(2,3) >>> gmpy2.qdiv(a,b) mpq(3,4) >>> a # a gest modified!!! mpq(3,4)
The reason is that the function GMPy_MPQ_From_Rational does not return a copy of its argument if it is already a rational.
GMPy_MPQ_From_Rational
(see also sympy issue #12753)
The text was updated successfully, but these errors were encountered:
The following code in gmpy2_mpq_misc.c:
mpq_div(tempx->q, tempx->q, tempy->q); Py_DECREF((PyObject*)tempy);
should be changed to something like:
tempresult = (PyObject*)GMPy_MPZ_New(context); mpq_div(tempresult->q, tempx->q, tempy->q);
< do stuff >
Py_DECREF(tempresult);
Obviously needs error checking and other changes.
I can work on a complete fix in the next couple of days.
Sorry, something went wrong.
Thanks. Note that sympy is wrongly using qdiv and I will provide an easier fix for them.
qdiv
I've pushed a fix. Thanks for the report.
No branches or pull requests
The reason is that the function
GMPy_MPQ_From_Rational
does not return a copy of its argument if it is already a rational.(see also sympy issue #12753)
The text was updated successfully, but these errors were encountered: