[Xapian-tickets] [Xapian] #703: Python 3 sortable_serialise() broken on 32 bit

Xapian nobody at xapian.org
Wed Jan 6 16:12:22 GMT 2016


#703: Python 3 sortable_serialise() broken on 32 bit
--------------------+-------------------------
 Reporter:  barry   |             Owner:  olly
     Type:  defect  |            Status:  new
 Priority:  normal  |         Milestone:
Component:  Other   |           Version:
 Severity:  normal  |        Resolution:
 Keywords:          |        Blocked By:
 Blocking:          |  Operating System:  All
--------------------+-------------------------
Description changed by barry:

Old description:

> sortable_serialise() on Python 3 (Xapian 1.3) has two bugs on 32 bit
> systems.  You can see this with the following example:
>
> {{{
> $ python3
> Python 3.5.1+ (default, Jan  5 2016, 11:13:30)
> [GCC 5.3.1 20160101] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from xapian import *
> >>> sortable_serialise(14215209984)
> OverflowError: Python int too large to convert to C long
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> SystemError: <built-in function sortable_serialise> returned a result
> with an error set
> >>>
> }}}
>
> First, the conversion of the int to the C API's double can't handle the
> 33+-bit size of the value, thus you get the OverflowError.  However,
> sortable_serialise() also doesn't properly check for and handle the
> exception, but instead returns a non-NULL result which triggers the
> SystemError once control percolates back up to the eval loop.

New description:

 sortable_serialise() on Python 3 (Xapian 1.3) has two bugs on 32 bit
 systems.  You can see this with the following example:

 {{{
 $ python3
 Python 3.5.1+ (default, Jan  5 2016, 11:13:30)
 [GCC 5.3.1 20160101] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> from xapian import *
 >>> sortable_serialise(14215209984)
 OverflowError: Python int too large to convert to C long

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 SystemError: <built-in function sortable_serialise> returned a result with
 an error set
 >>>
 }}}

 First, the conversion of the int to the C API's double can't handle the
 33+-bit size of the value, thus you get the `OverflowError`.  However,
 sortable_serialise() also doesn't properly check for and handle the
 exception, but instead returns a non-NULL result which triggers the
 `SystemError` once control percolates back up to the eval loop.

--

--
Ticket URL: <http://trac.xapian.org/ticket/703#comment:1>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list