Merge lp:~gz/bzr/2.4_new_cython_compat_837221 into lp:bzr/2.4

Proposed by Martin Packman
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6052
Proposed branch: lp:~gz/bzr/2.4_new_cython_compat_837221
Merge into: lp:bzr/2.4
Diff against target: 38 lines (+5/-1)
3 files modified
bzrlib/_dirstate_helpers_pyx.pyx (+1/-0)
doc/en/release-notes/bzr-2.4.txt (+3/-0)
setup.py (+1/-1)
To merge this branch: bzr merge lp:~gz/bzr/2.4_new_cython_compat_837221
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+78393@code.launchpad.net

Commit message

Fix compatibility with Cython 0.15 or later and development versions

Description of the change

Backports the compatibility fix for new Cython versions from:

<https://code.launchpad.net/~denys.duchier/bzr/bzr.cython015/+merge/73421>

It seems people are increasingly running into this as there have been multiple reports, and we forgot it had been fixed already.

Does a slightly different thing to get the right pyrex_version_info tuple for development versions, just strips the plus.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/6/2011 2:13 PM, Martin Packman wrote:
> Martin Packman has proposed merging
> lp:~gz/bzr/2.4_new_cython_compat_837221 into lp:bzr/2.4.
>
> Requested reviews: bzr-core (bzr-core) Related bugs: Bug #837221 in
> Bazaar: ""Variable referenced before initialization" using Cython
> 0.15 to compile extensions"
> https://bugs.launchpad.net/bzr/+bug/837221
>
> For more details, see:
> https://code.launchpad.net/~gz/bzr/2.4_new_cython_compat_837221/+merge/78393
>
> Backports the compatibility fix for new Cython versions from:
>
> <https://code.launchpad.net/~denys.duchier/bzr/bzr.cython015/+merge/73421>
>
> It seems people are increasingly running into this as there have
> been multiple reports, and we forgot it had been fixed already.
>
> Does a slightly different thing to get the right pyrex_version_info
> tuple for development versions, just strips the plus.

 merge: approve

If you are here, can you poke around and fix all the other warnings
given by Cython 0.15?

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6NnFkACgkQJdeBCYSNAAMx2wCfXjNvxWnXalmReLxm7Wm3Dg/E
CkEAn1fBump+IzYwJnRuy6fCKL5XcD1p
=KqSX
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

All I'm seeing in addition with trunk cython is a couple of warnings about dead code where there's RuntimeError raised but the old code hasn't been deleted or commented:

warning: bzrlib/_groupcompress_pyx.pyx:328:54: Unreachable code
warning: bzrlib/_groupcompress_pyx.pyx:512:8: Unreachable code

Was there anything else you were thinking of?

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/6/2011 3:31 PM, Martin Packman wrote:
> All I'm seeing in addition with trunk cython is a couple of
> warnings about dead code where there's RuntimeError raised but the
> old code hasn't been deleted or commented:
>
> warning: bzrlib/_groupcompress_pyx.pyx:328:54: Unreachable code
> warning: bzrlib/_groupcompress_pyx.pyx:512:8: Unreachable code
>
> Was there anything else you were thinking of?

When I tried to use Cython 0.15 to build the installers, there were
maybe 8 warnings about uninitialized variables, this seems to only fix
one of them.

Note that you have to build from scratch, as cython won't rebuild the
.c files if they are newer than the .pyx files.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6NtpAACgkQJdeBCYSNAAOqWwCgyMMUXGl78t4m+T9buRQD55sX
EncAoJhoUAYQ68Ru1w5WBM2dx6Nj0Mwv
=NtgW
-----END PGP SIGNATURE-----

Revision history for this message
Martin Packman (gz) wrote :
Download full text (3.3 KiB)

As mentioned on IRC, it seems in Cython 0.15.1 they undid a lot of those new warnings:

<http://trac.cython.org/cython_trac/ticket/714>

Good thing too, I went back and tried 0.15 just now to see if there were any other cases that needed fixing, and every single warning is about outparam style calls. Worse, the 'changed' variable that actually did cause a bug is not mentioned at all:

warning: bzrlib/_bencode_pyx.pyx:160:40: local variable 'next_tail' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:210:60: local variable 'hash_offset' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:215:62: local variable 'text_offset' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:215:73: local variable 'hash_val' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:252:72: local variable 'index' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:301:65: local variable 'index' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:319:73: local variable 'index' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:360:42: local variable 'delta_size' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:360:68: local variable 'delta' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:471:66: local variable 'cp_off' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:471:76: local variable 'cp_size' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:500:25: local variable 'cp_off' referenced before assignment
warning: bzrlib/_groupcompress_pyx.pyx:500:34: local variable 'cp_size' referenced before assignment
warning: bzrlib/_knit_load_data_pyx.pyx:69:40: local variable 'integer_end' referenced before assignment
warning: bzrlib/_knit_load_data_pyx.pyx:164:64: local variable 'int_parent' referenced before assignment
warning: bzrlib/_knit_load_data_pyx.pyx:224:58: local variable 'pos' referenced before assignment
warning: bzrlib/_knit_load_data_pyx.pyx:225:62: local variable 'size' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:220:43: local variable 'pos' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:220:61: local variable 'temp_node' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:276:53: local variable 'temp_key' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:276:72: local variable 'temp_parent_keys' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:289:61: local variable 'temp_node' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:303:61: local variable 'temp_node' referenced before assignment
warning: bzrlib/_known_graph_pyx.pyx:464:65: local variable 'temp_node' referenced before assignment
warning: bzrlib/_dirstate_helpers_pyx.pyx:578:34: local variable 'size' referenced before assignment
warning: bzrlib/_dirstate_helpers_pyx.pyx:592:35: local variable 'size' referenced before assignment
warning: bzrlib/_dirstate_helpers_pyx.pyx:634:46: local variable 'cur_size' referenced before assignment
warning: bzrlib/_chk_map_pyx.pyx:171:32: local variable 'next' referenced before...

Read more...

Revision history for this message
Martin Packman (gz) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/_dirstate_helpers_pyx.pyx'
2--- bzrlib/_dirstate_helpers_pyx.pyx 2011-09-28 16:19:52 +0000
3+++ bzrlib/_dirstate_helpers_pyx.pyx 2011-10-06 12:11:23 +0000
4@@ -1795,6 +1795,7 @@
5 advance_entry = -1
6 advance_path = -1
7 result = None
8+ changed = None
9 path_handled = 0
10 if current_entry is None:
11 # unversioned - the check for path_handled when the path
12
13=== modified file 'doc/en/release-notes/bzr-2.4.txt'
14--- doc/en/release-notes/bzr-2.4.txt 2011-10-04 18:43:55 +0000
15+++ doc/en/release-notes/bzr-2.4.txt 2011-10-06 12:11:23 +0000
16@@ -35,6 +35,9 @@
17 * Fixed loading of external merge tools from config to properly decode
18 command-lines which contain embedded quotes. (Gordon Tyler, #828803)
19
20+* Include declaration of 'changed' to avoid an UnboundLocalError in dirstate
21+ pyrex code with new Cython versions. (Denys Duchier, #837221)
22+
23 * Prevent several kinds of OverflowError and other fallout from failing to fit
24 stat fields into four bytes in dirstate pack_stat implementations.
25 (Martin Packman, #683191 #706957)
26
27=== modified file 'setup.py'
28--- setup.py 2011-06-16 18:34:26 +0000
29+++ setup.py 2011-10-06 12:11:23 +0000
30@@ -198,7 +198,7 @@
31 from distutils.command.build_ext import build_ext
32 else:
33 have_pyrex = True
34- pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
35+ pyrex_version_info = tuple(map(int, pyrex_version.rstrip("+").split('.')))
36
37
38 class build_ext_if_possible(build_ext):

Subscribers

People subscribed via source and target branches