re module apis return longs now

Bug #1097783 reported by Robie Basak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
genshi (Ubuntu)
Fix Released
High
Unassigned
python2.7 (Ubuntu)
Fix Released
High
Unassigned

Bug Description

In raring, some library functions are returning longs instead of ints. This is different from behaviour in quantal. This is causing an FTBFS in genshi due to doctest failures.

Building from upstream source exhibits correct behaviour, including from upstream orig tarballs and upstream 2.7 hg tip. But if I build using the packaging, I get the problem (including sid and experimental). So I presume the problem is in Debian's packaging. But the problem does not occur in a sid chroot, so is this Ubuntu toolchain related?

Test case:

import re
re.compile('.').match('.', 0).end()

Expected result: an int
Actual result: a long

Robie Basak (racb)
Changed in genshi (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in python2.7 (Ubuntu):
importance: Undecided → High
Revision history for this message
Barry Warsaw (barry) wrote :

This is an upstream change, as a byproduct of issue #10182

http://bugs.python.org/issue10182

In that bug, a complaint was made that match starts were being truncated on x64 Windows machines, so the types were changed to longs. I can reproduce this with hg tip of the 2.7 branch, and the world will see it whenever 2.7.4 is released. You see it in Ubuntu because we track hg tip, so you're getting this change before 2.7.4 is released.

It's arguably a backward incompatible change to Python 2.7 and perhaps it should be reverted (but it's a tough call). I'll update the Python issue, but I suggest you nosey yourself to it and engage on the change there.

I think your description on this bug is inaccurate since afaict it only affects the re module. I'll update that, but if you know of other apis that are affected, please let me know.

summary: - Regression: some python library functions return wrong types
+ re module apis return longs now
Revision history for this message
Barry Warsaw (barry) wrote :

Cool, so Benjamin reverted the API change in upstream hg by using PyInt* instead of PyLong* apis. You'll see this the next time Matthias syncs to upstream.

Changed in python2.7 (Ubuntu):
status: New → Fix Committed
Revision history for this message
Matthias Klose (doko) wrote :

fixed in 2.7.3-15ubuntu1

Changed in python2.7 (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Robie Basak (racb) wrote :

genshi successfully rebuilt in 0.6-3ubuntu1 using the fixed Python.

Changed in genshi (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.