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 2008年03月17日 22:10 by bethard, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| changed_comparisons.patch | bethard, 2008年03月18日 06:53 | |||
| Messages (9) | |||
|---|---|---|---|
| msg63792 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月17日 22:10 | |
Some comparisons were changed or removed in Python 3.0. In 2.6 you could compare types (e.g. ``str < int``) and dicts supported more than just equality. These comparisons should produce Py3K warnings. |
|||
| msg63901 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 06:53 | |
I'm attaching a patch that handles object comparisons, type comparisons, cell comparisons, and dict comparisons. All the tests pass (including the new ones I've added) but I'd appreciate it if someone could take a second look. Other things still remaining to be done: * Someone needs to decide the correct behavior for method-wrappers (descrobject.c), implement that in Python 2.6 and forward port it to 3.0. * The following objects have a good tp_richcompare in Python 3.0: codeobject.c, methodobject.c, sliceobject.c. Those tp_richcompares should be backported to 2.6. Then a warning can be added for LE, LT, GE and GT (with no warning for EQ or NE which won't change). I may have a little time tomorrow to work on the latter task. |
|||
| msg63948 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 17:27 | |
Revision 61529 adds warnings for object, type, cell and dict comparisons. The code, method and slice warnings are still needed. |
|||
| msg63954 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2008年03月18日 17:57 | |
Your patch kicks up warnings in Objects/cellobject.c because cell_compare returns an int, your patch may return NULL. |
|||
| msg63960 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 18:33 | |
On Tue, Mar 18, 2008 at 11:57 AM, Benjamin Peterson <report@bugs.python.org> wrote: > Benjamin Peterson <musiccomposition@gmail.com> added the comment: > > Your patch kicks up warnings in Objects/cellobject.c because > cell_compare returns an int, your patch may return NULL. Thanks. I'll fix that. Steve |
|||
| msg63962 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 18:38 | |
So I believe it should be returning -2 instead of NULL. Can someone verify that -2 means raise an exception for tp_compare? |
|||
| msg63963 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 19:04 | |
Ok, that warning should be gone now in trunk. |
|||
| msg63997 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 21:48 | |
I took a closer look at sliceobject.c and it looks like both 2.6 and 3.0 compare them basically as tuples. So there don't need to be any warnings about using < and > since these are still well defined. I'll have a patch for codeobject.c and methodobject.c soon. |
|||
| msg64000 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2008年03月18日 22:19 | |
Resolved in revision 61570. I can't get svnmerge block to work though. Since the code and method changes are just backports of Python 3, someone needs to run ``svnmerge.py block -r 61570``. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:32 | admin | set | github: 46626 |
| 2008年07月31日 01:57:34 | benjamin.peterson | set | status: open -> closed resolution: fixed |
| 2008年03月18日 22:19:37 | bethard | set | messages: + msg64000 |
| 2008年03月18日 21:48:11 | bethard | set | messages: + msg63997 |
| 2008年03月18日 19:04:48 | bethard | set | messages: + msg63963 |
| 2008年03月18日 18:38:56 | bethard | set | messages: + msg63962 |
| 2008年03月18日 18:33:42 | bethard | set | messages: + msg63960 |
| 2008年03月18日 17:57:41 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg63954 |
| 2008年03月18日 17:27:50 | bethard | set | messages: + msg63948 |
| 2008年03月18日 06:53:07 | bethard | set | files:
+ changed_comparisons.patch keywords: + patch messages: + msg63901 |
| 2008年03月17日 22:10:33 | bethard | create | |