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.
Created on 2011年12月03日 12:08 by skrah, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| patch | arnaudc, 2011年12月17日 22:31 | Documentation changes for c-api/real.rst and c-api/complex.rst | review | |
| patch | arnaudc, 2011年12月17日 23:05 | review | ||
| diff_complex_rst | arnaudc, 2011年12月18日 01:13 | review | ||
| complex.rst-2.patch | arnaudc, 2011年12月18日 01:50 | review | ||
| Messages (14) | |||
|---|---|---|---|
| msg148789 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2011年12月03日 12:08 | |
A couple of -1.0 error return codes aren't documented, see for example PyFloat_AsDouble() and PyComplex_AsCComplex(). |
|||
| msg148790 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2011年12月03日 12:13 | |
Well, it's sort of documented implicitly: from http://docs.python.org/c-api/intro.html#exceptions "In general, when a function encounters an error, it sets an exception, discards any object references that it owns, and returns an error indicator. If not documented otherwise, this indicator is either NULL or -1, depending on the function’s return type." |
|||
| msg148799 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2011年12月03日 13:25 | |
Good point. - I just had to figure out if the pattern
Py_complex c = PyComplex_AsCComplex(w);
if (c.real == -1.0 && PyErr_Occurred()) {
...
will always be reliable in the future. The source of PyComplex_AsCComplex()
suggests that it will, on the other hand in getargs.c the pattern isn't
used.
The passage you quoted is quite clear, so I wouldn't mind if you
close this.
I'm not sure how many people read that passage though. :)
|
|||
| msg148810 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年12月03日 17:12 | |
I think it's still a good idea to spell it out explicitly in each function description. The document pointed by Mark is long enough that it's easy to overlook or forget that single important statement. |
|||
| msg149714 - (view) | Author: Arnaud Calmettes (arnaudc) | Date: 2011年12月17日 22:31 | |
Hi, Here is the patch I propose for this issue. This is my first attempt to contribute to Python, so please don't hit me too hard if I did something wrong. :) When browsing the source code of complexobject.c, I also noticed that the return values of the _Py_c_quot and _Py_c_pow (which return zero in case of error) weren't documented at http://docs.python.org/dev/c-api/complex.html#_Py_c_quot |
|||
| msg149716 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年12月17日 22:47 | |
There's a typo in the patch: it's PyErr_Occurred (two r's), not PyErr_Occured. Otherwise, looks good to me. |
|||
| msg149717 - (view) | Author: Arnaud Calmettes (arnaudc) | Date: 2011年12月17日 23:05 | |
I fixed the typo and the markup. |
|||
| msg149724 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年12月18日 00:29 | |
New changeset 68cbf6551710 by Antoine Pitrou in branch '3.2': Issue #13522: document error return values of some float and complex C API functions. http://hg.python.org/cpython/rev/68cbf6551710 New changeset 1f096611baf4 by Antoine Pitrou in branch 'default': Issue #13522: document error return values of some float and complex C API functions. http://hg.python.org/cpython/rev/1f096611baf4 New changeset 059e4d752fbe by Antoine Pitrou in branch '2.7': Issue #13522: document error return values of some float and complex C API functions. http://hg.python.org/cpython/rev/059e4d752fbe |
|||
| msg149726 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年12月18日 00:30 | |
Committed now. Thank you for the patch! |
|||
| msg149727 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年12月18日 00:46 | |
_Py_c_pow() doc is wrong: + If :attr:`exp.imag` is not null, or :attr:`exp.real` is negative, + this method returns zero and sets :c:data:`errno` to :c:data:`EDOM`. The function only fails if num=0 and exp.real < 0 or if num=0 and exp.imag != 0. |
|||
| msg149729 - (view) | Author: Arnaud Calmettes (arnaudc) | Date: 2011年12月18日 01:13 | |
Fixed. |
|||
| msg149732 - (view) | Author: Arnaud Calmettes (arnaudc) | Date: 2011年12月18日 01:50 | |
Previous patch was also wrong, sorry! |
|||
| msg149733 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年12月18日 01:54 | |
New changeset 67a4e8fe650e by Victor Stinner in branch 'default': Issue #13522: Fix _Py_co_pow() documentation http://hg.python.org/cpython/rev/67a4e8fe650e |
|||
| msg149743 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年12月18日 11:29 | |
New changeset edc981ce8748 by Victor Stinner in branch '3.2': Issue #13522: Fix _Py_co_pow() documentation http://hg.python.org/cpython/rev/edc981ce8748 New changeset 2863470caebb by Victor Stinner in branch '2.7': Issue #13522: Fix _Py_co_pow() documentation http://hg.python.org/cpython/rev/2863470caebb |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:24 | admin | set | github: 57731 |
| 2011年12月18日 11:29:06 | python-dev | set | messages: + msg149743 |
| 2011年12月18日 01:54:48 | vstinner | set | status: open -> closed resolution: fixed |
| 2011年12月18日 01:54:28 | python-dev | set | messages: + msg149733 |
| 2011年12月18日 01:50:30 | arnaudc | set | files:
+ complex.rst-2.patch keywords: + patch messages: + msg149732 |
| 2011年12月18日 01:13:14 | arnaudc | set | files:
+ diff_complex_rst messages: + msg149729 |
| 2011年12月18日 00:46:36 | vstinner | set | status: closed -> open nosy: + vstinner messages: + msg149727 resolution: fixed -> (no value) |
| 2011年12月18日 00:30:08 | pitrou | set | status: open -> closed resolution: fixed messages: + msg149726 stage: patch review -> resolved |
| 2011年12月18日 00:29:01 | python-dev | set | nosy:
+ python-dev messages: + msg149724 |
| 2011年12月17日 23:05:46 | arnaudc | set | files:
+ patch messages: + msg149717 |
| 2011年12月17日 22:47:04 | pitrou | set | messages:
+ msg149716 stage: needs patch -> patch review |
| 2011年12月17日 22:31:44 | arnaudc | set | files:
+ patch nosy: + arnaudc messages: + msg149714 |
| 2011年12月03日 17:12:11 | pitrou | set | nosy:
+ pitrou messages: + msg148810 |
| 2011年12月03日 13:25:51 | skrah | set | messages: + msg148799 |
| 2011年12月03日 12:13:07 | mark.dickinson | set | messages:
+ msg148790 versions: - Python 3.1 |
| 2011年12月03日 12:08:48 | skrah | create | |