A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2008-October/082916.html below:

[Python-Dev] porting pycxx and pysvn to python 3.0 hit a problem

[Python-Dev] porting pycxx and pysvn to python 3.0 hit a problem [Python-Dev] porting pycxx and pysvn to python 3.0 hit a problemBarry Scott barry at barrys-emacs.org
Tue Oct 7 23:52:32 CEST 2008
On Oct 5, 2008, at 19:47, Martin v. Löwis wrote:

>> Why does "key in wc_status_kind_wc" work when I use an object  
>> returned
>> by keys() by not when I use pysvn.wc_status_kind.unversioned?
>
> This is too little detail to come up with an explanation. Do your
> objects support __eq__.
>
> Regards,
> Martin
>

I wrote a smaller version of the code that fails and had a session with
gdb.

My object implements tp_compare but lookdict() uses richcompare.
If richcompare is not implemented do_richcompare() falls back to
comparing PyObject * pointers - which is cause of the KeyError
as the objects cmp() eq but have different PyObect * values.

This is a change from V2 python where to be a key implementing
tp_hash and tp_compare is sufficient.

In V3 is it your intention that to be a key you must implement
tp_hash and tp_richcompare? If not I'll raise a bug against
3.0 on this issue.

Barry

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4