[Xapian-tickets] [Xapian] #531: Python bindings attempt to use deprecated methods
Xapian
nobody at xapian.org
Sun Jan 30 21:59:50 GMT 2011
#531: Python bindings attempt to use deprecated methods
--------------------------------------+-------------------------------------
Reporter: rq | Owner: olly
Type: defect | Status: assigned
Priority: normal | Milestone: 1.2.5
Component: Xapian-bindings (Python) | Version: 1.2.4
Severity: normal | Keywords:
Blockedby: | Platform: All
Blocking: |
--------------------------------------+-------------------------------------
Changes (by olly):
* version: => 1.2.4
* milestone: => 1.2.5
Old description:
> According to http://xapian.org/docs/deprecation.htm, MSetItem.get_*()
> methods have been deprecated since 1.1. However, it seems like python-
> xapian itself attempts to make those calls when creating
> MSetItem[xapian.MSET_*] tuples, which causes an application attempting to
> use those tuples to err. See
> http://bugs.locamotion.org/show_bug.cgi?id=1766 for example. In this
> case, the Translate Toolkit did not use MSetItem.get_*() methods, but it
> still quit with an error when trying to use MSetItem[xapian.MSET_*].
> Changing the appropriate lines to use MSetItem.* properties fixed the
> problem.
>
> I suspect the real problem is in http://trac.xapian.org/browser/trunk
> /xapian-bindings/python/util.i#L195 and below, where
> MSetItem[xapian.MSET_*] tuples are being created. I'm no Python expert
> though, so I may be totally wrong here.
New description:
According to http://xapian.org/docs/deprecation.html, MSetItem.get_*()
methods have been deprecated since 1.1. However, it seems like python-
xapian itself attempts to make those calls when creating
MSetItem[xapian.MSET_*] tuples, which causes an application attempting to
use those tuples to err. See
http://bugs.locamotion.org/show_bug.cgi?id=1766 for example. In this case,
the Translate Toolkit did not use MSetItem.get_*() methods, but it still
quit with an error when trying to use MSetItem[xapian.MSET_*]. Changing
the appropriate lines to use MSetItem.* properties fixed the problem.
I suspect the real problem is in http://trac.xapian.org/browser/trunk
/xapian-bindings/python/util.i#L195 and below, where
MSetItem[xapian.MSET_*] tuples are being created. I'm no Python expert
though, so I may be totally wrong here.
--
Comment:
OK, I've found out a little more...
Although not documented in the Python bindings HTML page, this way of
using MSET_* '''was''' used by older versions of simpleindex.py (since
1.0.4 it's used the properties instead), so it is something that should
have continued to work. Also, MSET_DOCUMENT worked in this case -
{{{mset[0][MSET_DOCUMENT]}}} worked in 1.0.x, it's
{{{mset[0].items[MSET_DOCUMENT}}} which has never worked.
But this isn't an API we've advertised at all since 1.0.4, which should at
least reduce the number of users affected by this feature no longer
working.
Richard agreed on IRC that documenting the issue and recommending people
just use the properties instead was probably the best thing to do at this
point.
Sorry about this - we try hard to keep the API stable and flag
deprecations a whole release series in advance, but we messed up here.
I will update the deprecation document for 1.2.5 to say that:
* mset[0][xapian.MSET_DID], etc were inadvertently removed in 1.2.0 and
to use the
property interface instead.
* mset.items is now deprecated and to use the pythonic iterators and
their
property interface instead.
* similarly, deprecate eset.items.
And I'll document that MSET_DOCUMENT isn't actually useful in 1.2.x.
If anyone has a better plan, please speak up.
--
Ticket URL: <http://trac.xapian.org/ticket/531#comment:2>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list