[Cython] Cython bugfix release

Yaroslav Halchenko lists at onerussian.com
Tue Jul 22 20:20:53 CEST 2014


On Mon, 21 Jul 2014, Julian Taylor wrote:

> I haven't tried it but its possibly related to the C locale the debian
> builders use. Try with LC_ALL=C

that is the one set

> @Yaroslav if this the the case, the workaround would be building with
> LC_ALL=C.UTF-8

good hint, although would not serve us as a workaround but rather possibly
reveals the actual problem if ran in interactive mode (if I pipe the output --
the same error)... 

the original error happens in the code which reacts to unsuccessful execution
of GdbDebuggerTestCaseand apparently has a problem with that unicode string
(although it was decoded from UTF-8 without errors).  To say the truth, unicode
handling philosophical understanding is not my strongest skill, BUT it seems to
spit out the actual error without failing if I explicitly encode that errmsg
back into UTF-8 and write that.  Alternative more generic implementation there
could be get a custom writer for stderr:

class TestAll(GdbDebuggerTestCase):

    def test_all(self):
        if not test_gdb():
            return

        out, err = self.p.communicate()
        err = err.decode('UTF-8')

        exit_status = self.p.returncode
        import codecs
        stderr = codecs.getwriter('utf8')(sys.stderr)

        if exit_status == 1:
            stderr.write(err)
        elif exit_status >= 2:
            border = u'*' * 30
            start  = u'%s   v INSIDE GDB v   %s' % (border, border)
            end    = u'%s   ^ INSIDE GDB ^   %s' % (border, border)
            errmsg = u'\n%s\n%s%s' % (start, err, end)
            
            stderr.write(errmsg)


With such code it spits out errmsg reliably:

python runtests.py --no-refnanny -v -v --exclude="parallel" --work-dir=build/work-dir TestLibCython
Python 2.7.8 (default, Jul  4 2014, 13:08:34)
[GCC 4.9.0]

Running tests against Cython 0.20.2
Backends: c,cpp

test_all (Cython.Debugger.Tests.TestLibCython.TestAll) ...
******************************   v INSIDE GDB v   ******************************
warning: .cygdbinit: No such file or directory
EE...Function "__pyx_pw_8codefile_5outer_1inner" not defined.
Python Exception <type 'exceptions.KeyError'> (u'a',):
EFSystemError: ../Objects/moduleobject.c:50: bad argument to internal function
E...SystemError: ../Objects/moduleobject.c:50: bad argument to internal function
Python Exception <class 'gdb.error'> The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(PyModule_GetDict) will be abandoned.
When the function is done executing, GDB will silently stop.:
ESystemError: ../Objects/moduleobject.c:50: bad argument to internal function
Python Exception <class 'gdb.error'> The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(PyModule_GetDict) will be abandoned.
When the function is done executing, GDB will silently stop.:
EE.EEE.E.FFF
======================================================================
ERROR: test_cyset (Cython.Debugger.Tests.test_libcython_in_gdb.CySet)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/cython-0.20.2/Cython/Debugger/Tests/test_libcython_in_gdb.py", line 38, in wrapper
    return func(self, *args, **kwargs)
  File "/tmp/buildd/cython-0.20.2/Cython/Debugger/Tests/test_libcython_in_gdb.py", line 387, in test_cyset
    gdb.execute('cy set a = $cy_eval("{None: []}")')
  File "/tmp/buildd/cython-0.20.2/Cython/Debugger/libpython.py", line 1860, in execute
    _execute(command, from_tty)
error: Selected frame does not correspond with a Cython function we know about.

======================================================================
ERROR: test_backtrace (Cython.Debugger.Tests.test_libcython_in_gdb.TestBacktrace)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/cython-0.20.2/Cython/Debugger/Tests/test_libcython_in_gdb.py", line 38, in wrapper
    return func(self, *args, **kwargs)
  File "/tmp/buildd/cython-0.20.2/Cython/Debugger/Tests/test_libcython_in_gdb.py", line 292, in test_backtrace
    result = gdb.execute('cy bt', to_string=True)
  File "/tmp/buildd/cython-0.20.2/Cython/Debugger/libpython.py", line 1857, in execute
    _execute(command, from_tty)
error: Error occurred in Python command: 'FakeRepr' object has no attribute '__getitem__'

.... MORE ....


> On 21.07.2014 19:46, Robert Bradshaw wrote:
> > I wasn't able to reproduce this myself, which is why I haven't done
> > anything about it yet...


> > On Sat, Jul 19, 2014 at 9:39 PM, Yaroslav Halchenko
> > <lists at onerussian.com <mailto:lists at onerussian.com>> wrote:

> >     that was quite an underwhelming response,  now it is "official"
> >     https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755340
> >     and I haven't had yet a chance to recheck master... anyone has a clue
> >     before I start digging?

> >     On Thu, 19 Jun 2014, Yaroslav Halchenko wrote:

> >     > and the same issue in current(ish) master:

> >     > ======================================================================
> >     > ERROR: test_all (Cython.Debugger.Tests.TestLibCython.TestAll)
> >     > ----------------------------------------------------------------------
> >     > Traceback (most recent call last):
> >     >   File
> >     "/tmp/buildd/cython-0.20.2+git216-ga96882e/Cython/Debugger/Tests/TestLibCython.py",
> >     line 280, in test_all
> >     >     sys.stderr.write(errmsg)
> >     > UnicodeEncodeError: 'ascii' codec can't encode characters in
> >     position 21001-21004: ordinal not in range(128)

> >     > ----------------------------------------------------------------------
> >     > Ran 8348 tests in 2674.102s



> >     > On Wed, 18 Jun 2014, Yaroslav Halchenko wrote:

> >     > > FWIW -- 0.20.2 was just uploaded to Debian sid, thus should be
> >     available
> >     > > to Debian folks soon too

> >     > > while trying 0.20.1 across debian/ubuntus I ran into this failure


> >     ======================================================================
> >     > > ERROR: test_all (Cython.Debugger.Tests.TestLibCython.TestAll)

> >     ----------------------------------------------------------------------
> >     > > Traceback (most recent call last):
> >     > >   File
> >     "/tmp/buildd/cython-0.20.2/Cython/Debugger/Tests/TestLibCython.py",
> >     line 281, in test_all
> >     > >     sys.stderr.write(errmsg)
> >     > > UnicodeEncodeError: 'ascii' codec can't encode characters in
> >     position 18851-18854: ordinal not in range(128)

> >     > > on debian wheezy i386.  it didn't happen on amd64 and on both
> >     architectures
> >     > > under debian jessie (testing) and it seemed to happen while
> >     testing with
> >     > > python2.6

> >     > > On Mon, 16 Jun 2014, Robert Bradshaw wrote:

> >     > > > I just pushed another bugfix release for the 0.20.x line,
> >     available on
> >     > > > github, cython.org <http://cython.org>, or and pypi.

> >     > > > == Features added ==

> >     > > > * Some optimisations for set/frozenset instantiation.
> >     > > > * Support for C++ unordered_set and unordered_map.

> >     > > > == Bugs fixed ==

> >     > > > * Access to attributes of optimised builtin methods (e.g.
> >     > > > [].append.__name__) could fail to compile.
> >     > > > * Memory leak when extension subtypes add a memory view as
> >     attribute
> >     > > > to those of the parent type without having Python object
> >     attributes or
> >     > > > a user provided dealloc method.
> >     > > > * Compiler crash on readonly properties in "binding" mode.
> >     > > > * Auto-encoding with c_string_encoding=ascii failed in Py3.3.
> >     > > > * Crash when subtyping freelist enabled Cython extension types
> >     with
> >     > > > Python classes that use __slots__.
> >     > > > * Freelist usage is restricted to CPython to avoid problems
> >     with other
> >     > > > Python implementations.
> >     > > > * Memory leak in memory views when copying overlapping,
> >     contiguous slices.
> >     > > > * Format checking when requesting non-contiguous buffers from
> >     > > > cython.array objects was disabled in Py3.
> >     > > > * C++ destructor calls in extension types could fail to
> >     compile in clang.
> >     > > > * Buffer format validation failed for sequences of strings in
> >     structs.
> >     > > > * Docstrings on extension type attributes in .pxd files were
> >     rejected.

> >     > > > == Contributors ==

> >     > > > Andreas van Cranenburgh
> >     > > > Ian Bell
> >     > > > Lars Buitinck
> >     > > > Martin Quarda
> >     > > > Mikhail Korobov
> >     > > > Robert Bradshaw
> >     > > > Stefan Behnel
> >     > > > _______________________________________________
> >     > > > cython-devel mailing list
> >     > > > cython-devel at python.org <mailto:cython-devel at python.org>
> >     > > > https://mail.python.org/mailman/listinfo/cython-devel
> >     --
> >     Yaroslav O. Halchenko, Ph.D.
> >     http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
> >     Research Scientist,            Psychological and Brain Sciences Dept.
> >     Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
> >     Phone: +1 (603) 646-9834 <tel:%2B1%20%28603%29%20646-9834>          
> >                 Fax: +1 (603) 646-1419 <tel:%2B1%20%28603%29%20646-1419>
> >     WWW:   http://www.linkedin.com/in/yarik
> >     _______________________________________________
> >     cython-devel mailing list
> >     cython-devel at python.org <mailto:cython-devel at python.org>
> >     https://mail.python.org/mailman/listinfo/cython-devel




> > _______________________________________________
> > cython-devel mailing list
> > cython-devel at python.org
> > https://mail.python.org/mailman/listinfo/cython-devel


> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel


-- 
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        


More information about the cython-devel mailing list