gh-109218: Deprecate weird cases in the complex() constructor#119620
gh-109218: Deprecate weird cases in the complex() constructor#119620serhiy-storchaka merged 13 commits into
Conversation
* Passing a string as the "real" keyword argument is now an error; it should only be passed as a single positional argument. * Passing a complex number as the *real* or *imag* argument is now deprecated; it should only be passed as a single positional argument.
9ec7587 to
9035969
Compare
May 27, 2024 18:06
* Share common classes. * Use exactly representable floats and exact tests. * Check the sign of zero components. * Remove duplicated tests (mostly left after merging int and long). * Reorder tests in more consistent way. * Test more error messages. * Add tests for missed cases.
skirpichev
left a comment
There was a problem hiding this comment.
tmp == NULL condition on L1092 also now only partially covered.
Just checked coverage report after ./python -m test test_complex test_capi.test_complex
Sorry, something went wrong.
|
Thank you for your review @skirpichev. Much of coverage is added by test added in #119635. |
Sorry, something went wrong.
mdickinson
left a comment
There was a problem hiding this comment.
LGTM in principle, and works as expected in manual testing. I won't claim to have examined all the branching possibilities, but it looks as though @skirpichev is on top of that. :-)
Sorry, something went wrong.
skirpichev
left a comment
There was a problem hiding this comment.
LGTM, except for useless PyComplex_Check() branch in the actual_complex_new() and one missing branch coverage here.
The rest, probably, not worth for improving, as it will be eventually removed. Though, I think that removing inaccessible cases (various own_r branches) will make code more readable.
Sorry, something went wrong.
…ythonGH-119620) * Passing a string as the "real" keyword argument is now an error; it should only be passed as a single positional argument. * Passing a complex number as the "real" or "imag" argument is now deprecated; it should only be passed as a single positional argument.
…ythonGH-119620) * Passing a string as the "real" keyword argument is now an error; it should only be passed as a single positional argument. * Passing a complex number as the "real" or "imag" argument is now deprecated; it should only be passed as a single positional argument.
📚 Documentation preview 📚: https://cpython-previews--119620.org.readthedocs.build/