This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Cython cannot compile 'a = 5/6' and return 'a = 0'
Type: compile error Stage: resolved
Components: Parser Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: lys.nikolaou, zz792641209
Priority: normal Keywords:

Created on 2021-05-18 14:44 by zz792641209, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
problem.py zz792641209, 2021-05-18 16:56
problem.py zz792641209, 2021-05-18 17:02
Messages (8)
msg393876 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-05-18 14:46
If this is really a Cython issue, you should report it on the Cython bug tracker. This bug tracker is for CPython.
msg393877 - (view) Author: Yao Zhang (zz792641209) Date: 2021-05-18 14:48
I'm not going to report the problem yet, I'm a rookie, and this is my first time to report the problem

------------------ 原始邮件 ------------------
发件人:                                                                                                                        "Python tracker"                                                                                    <report@bugs.python.org&gt;;
发送时间:&nbsp;2021年5月18日(星期二) 晚上10:46
收件人:&nbsp;"坏蛋"<792641209@qq.com&gt;;

主题:&nbsp;[issue44171] Cython cannot compile 'a = 5/6' and return 'a = 0'

New submission from Eric V. Smith <eric@trueblade.com&gt;:

If this is really a Cython issue, you should report it on the Cython bug tracker. This bug tracker is for CPython.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report@bugs.python.org&gt;
<https://bugs.python.org/issue44171&gt;
_______________________________________
msg393879 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-05-18 14:56
Closing as this is a Cython bug and not a CPython one. I also suspect this is triggering integer division and therefore is actually not a bug at all.
msg393880 - (view) Author: Yao Zhang (zz792641209) Date: 2021-05-18 16:35
However, in the source code, the source code runs normally, and when compiled and encapsulated with Cython, an exception occurs,Trigger divisible 'a = 5 // 6',this possibility does not exist.I checked it out :'a = 1,b = 5 / 6 + a',return :'a = 0'

------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "Python tracker"                                                                                    <report@bugs.python.org&gt;;
发送时间:&nbsp;2021年5月18日(星期二) 晚上10:56
收件人:&nbsp;"坏蛋"<792641209@qq.com&gt;;

主题:&nbsp;[issue44171] Cython cannot compile 'a = 5/6' and return 'a = 0'

Pablo Galindo Salgado <pablogsal@gmail.com&gt; added the comment:

Closing as this is a Cython bug and not a CPython one. I also suspect this is triggering integer division and therefore is actually not a bug at all.

----------
resolution:&nbsp; -&gt; not a bug
stage:&nbsp; -&gt; resolved
status: open -&gt; closed

_______________________________________
Python tracker <report@bugs.python.org&gt;
<https://bugs.python.org/issue44171&gt;
_______________________________________
msg393881 - (view) Author: Yao Zhang (zz792641209) Date: 2021-05-18 16:37
However, in the source code, the source code runs normally, and when compiled and encapsulated with Cython, an exception occurs,Trigger divisible 'a = 5 // 6',this possibility does not exist.I checked it out :'a = 1,b = 5 / 6 + a',return :'b = 0'

------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "Python tracker"                                                                                    <report@bugs.python.org&gt;;
发送时间:&nbsp;2021年5月19日(星期三) 凌晨0:35
收件人:&nbsp;"坏蛋"<792641209@qq.com&gt;;

主题:&nbsp;[issue44171] Cython cannot compile 'a = 5/6' and return 'a = 0'

Yao Zhang <792641209@qq.com&gt; added the comment:

However, in the source code, the source code runs normally, and when compiled and encapsulated with Cython, an exception occurs,Trigger divisible 'a = 5 // 6',this possibility does not exist.I checked it out :'a = 1,b = 5 / 6 + a',return :'a = 0'

------------------&amp;nbsp;原始邮件&amp;nbsp;------------------
发件人:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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p;nbsp;2021年5月18日(星期二) 晚上10:56
收件人:&amp;nbsp;"坏蛋"<792641209@qq.com&amp;gt;;

主题:&amp;nbsp;[issue44171] Cython cannot compile 'a = 5/6' and return 'a = 0'

Pablo Galindo Salgado <pablogsal@gmail.com&amp;gt; added the comment:

Closing as this is a Cython bug and not a CPython one. I also suspect this is triggering integer division and therefore is actually not a bug at all.

----------
resolution:&amp;nbsp; -&amp;gt; not a bug
stage:&amp;nbsp; -&amp;gt; resolved
status: open -&amp;gt; closed

_______________________________________
Python tracker <report@bugs.python.org&amp;gt;
<https://bugs.python.org/issue44171&amp;gt;
_______________________________________

----------

_______________________________________
Python tracker <report@bugs.python.org&gt;
<https://bugs.python.org/issue44171&gt;
_______________________________________
msg393884 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-05-18 16:41
Please report this to the Cython bug tracker: https://github.com/cython/cython/issues/

When you do that, you'll want to show the actual code you're having a problem with. You're using both "//" and "/" here. As Pablo said, you're probably having a problem with integer division ("//").
msg393886 - (view) Author: Yao Zhang (zz792641209) Date: 2021-05-18 16:56
Thank you for your patient answer, but I still don't understand.I have uploaded my file (*.py).I hope you can solve my problem. I want 'a=5/6' to return 'a= 0.833333333333333...... 'after compilation.

------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "Python tracker"                                                                                    <report@bugs.python.org&gt;;
发送时间:&nbsp;2021年5月19日(星期三) 凌晨0:41
收件人:&nbsp;"坏蛋"<792641209@qq.com&gt;;

主题:&nbsp;[issue44171] Cython cannot compile 'a = 5/6' and return 'a = 0'

Eric V. Smith <eric@trueblade.com&gt; added the comment:

Please report this to the Cython bug tracker: https://github.com/cython/cython/issues/

When you do that, you'll want to show the actual code you're having a problem with. You're using both "//" and "/" here. As Pablo said, you're probably having a problem with integer division ("//").

----------

_______________________________________
Python tracker <report@bugs.python.org&gt;
<https://bugs.python.org/issue44171&gt;
_______________________________________
msg393887 - (view) Author: Yao Zhang (zz792641209) Date: 2021-05-18 17:02
I want 'a=5/6' to return 'a= 0.833333333333333...... 'after compilation.
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88337
2021-05-18 17:16:18eric.smithsetnosy: - eric.smith
2021-05-18 17:14:19pablogsalsetnosy: - pablogsal
2021-05-18 17:02:35zz792641209setfiles: + problem.py

messages: + msg393887
2021-05-18 16:56:01zz792641209setfiles: + problem.py

messages: + msg393886
2021-05-18 16:41:42eric.smithsetmessages: + msg393884
2021-05-18 16:37:52zz792641209setmessages: + msg393881
2021-05-18 16:35:46zz792641209setmessages: + msg393880
2021-05-18 14:56:58pablogsalsetstatus: open -> closed
resolution: not a bug
messages: + msg393879

stage: resolved
2021-05-18 14:48:55zz792641209setmessages: + msg393877
2021-05-18 14:46:59eric.smithsetnosy: + eric.smith
messages: + msg393876
2021-05-18 14:44:09zz792641209create