• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thriftrw / thriftrw-python / 656
74%
master: 92%

Build:
Build:
LAST BUILD BRANCH: python-3.4
DEFAULT BRANCH: master
Ran 14 Nov 2017 02:31AM UTC
Jobs 1
Files 54
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
656

Pull #143

travis-ci

web-flow
Fix input too short errors being ignored

The `read_field_begin`, `read_map_begin`, `read_set_begin` and
`read_list_begin` methods of `ProtocolReader` return `cdef struct`s
(which translate to plain C structs) for performance reasons.
Unfortunately, that means that the generated C code does not know
whether an exception occurred while running those functions.

To fix this, we need to add an `except *` clause to these methods so
that cython generates code to check for exceptions and propagate them.

Before, `BinaryProtocolReader.read_field_begin` generated the following
section at the end,

```c
   /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("thriftrw.protocol.binary.BinaryProtocolReader.read_field_begin", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
```

With this change, it generates,

```c
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("thriftrw.protocol.binary.BinaryProtocolReader.read_field_begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
```

Note that the `__Pyx_WriteUnraisable` turned to `__Pyx_AddTraceback`.

---

Minor note about testing:

While investigating this, a bug was discovered in the test for the error
path. It is supposed to exercise the error on two code paths but instead
of doing,

    with pytest.raises(...):
        # code path 1

    with pytest.raises(...):
        # code path 2

The test was doing,

    with pytest.raises(...):
        # code path 1
        # code path 2

Which meant that the second code path wasn't actually exercised.
Pull Request #143: Fix input too short errors being ignored

158 of 165 branches covered (95.76%)

8 of 8 new or added lines in 2 files covered. (100.0%)

2177 of 2931 relevant lines covered (74.27%)

0.74 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
100.0
thriftrw/protocol/binary.pyx
4
100.0
thriftrw/protocol/core.pyx
Jobs
ID Job ID Ran Files Coverage
9 656.9 (TOX_ENV=cover) 14 Nov 2017 02:31AM UTC 0
74.27
Travis Job 656.9
Source Files on build 656
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #656
  • Pull Request #143
  • PR Base - abg/fix-build (#651)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc