[Pkg-bazaar-maint] Bug#845335: bzr: Broken with python2.7 2.7.12-7

Dmitry Shachnev mitya57 at debian.org
Tue Nov 22 15:40:03 UTC 2016

Package: bzr
Version: 2.7.0+bzr6619-2
Severity: grave

After the latest python2.7 update, I get this:

  $ bzr pull
  bzr: ERROR: exceptions.TypeError: first argument must be string or compiled pattern

  Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 930, in exception_to_return_code
      return the_callable(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1121, in run_bzr
      ret = run(*run_argv)
    File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 673, in run_argv_aliases
      return self.run(**all_cmd_args)
    File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 697, in run
      return self._operation.run_simple(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 136, in run_simple
      self.cleanups, self.func, *args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
      result = func(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/bzrlib/builtins.py", line 1210, in run
      self.outf.write(gettext("Using saved parent location: %s\n") % display_url)
    File "/usr/lib/python2.7/dist-packages/bzrlib/lazy_import.py", line 117, in __call__
      return obj(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/bzrlib/i18n.py", line 40, in gettext
    File "/usr/lib/python2.7/dist-packages/bzrlib/i18n.py", line 92, in install
      _translations = install_translations(lang)
    File "/usr/lib/python2.7/dist-packages/bzrlib/i18n.py", line 114, in install_translations
    File "/usr/lib/python2.7/gettext.py", line 554, in translation
      t = _translations.setdefault(key, class_(fp))
    File "/usr/lib/python2.7/gettext.py", line 255, in __init__
    File "/usr/lib/python2.7/gettext.py", line 391, in _parse
      self.plural = c2py(plural)
    File "/usr/lib/python2.7/gettext.py", line 177, in c2py
      result, nexttok = _parse(_tokenize(plural))
    File "/usr/lib/python2.7/gettext.py", line 114, in _parse
      nexttok = next(tokens)
    File "/usr/lib/python2.7/gettext.py", line 85, in _tokenize
      for mo in re.finditer(_token_pattern, plural):
    File "/usr/lib/python2.7/re.py", line 190, in finditer
      return _compile(pattern, flags).finditer(string)
    File "/usr/lib/python2.7/re.py", line 247, in _compile
      raise TypeError, "first argument must be string or compiled pattern"
  TypeError: first argument must be string or compiled pattern

  bzr 2.8.0dev1 on python 2.7.12 (Linux-4.8.0-1-amd64-x86_64-with-debian-
  arguments: ['/usr/bin/bzr', 'pull']
  plugins: bash_completion[2.8.0dev1], changelog_merge[2.8.0dev1],
      grep[2.8.0dev1], launchpad[2.8.0dev1], netrc_credential_store[2.8.0dev1],
      news_merge[2.8.0dev1], po_merge[2.8.0dev1], weave_fmt[2.8.0dev1]
  encoding: 'utf-8', fsenc: 'UTF-8', lang: 'de_DE.UTF-8'

It seems that bzrlib tries to replace re.compile with its own function
(see reset_compile() in bzrlib/lazy_regex.py), and new Python 2 does not like

In particular, _token_pattern in gettext is an instance of LazyRegex class,
and that does not pass the sre_compile.isstring() check (and so re._compile
raises an exception when it gets that as an argument).

A workaround is downgrading python2.7 to the previous version (i.e. 2.7.12-3
from testing), or running Bzr with LC_ALL=C.UTF-8.

Dmitry Shachnev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-bazaar-maint/attachments/20161122/7f6999cd/attachment.sig>

More information about the Pkg-bazaar-maint mailing list