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

agronholm / cbor2 / 23406195774
95%

Build:
DEFAULT BRANCH: master
Ran 22 Mar 2026 03:25PM UTC
Jobs 1
Files 8
Run time 1min
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

22 Mar 2026 03:24PM UTC coverage: 94.565% (+0.02%) from 94.55%
23406195774

push

github

web-flow
Stack allocate small strings (#270)

* normalize str_errors='error' to 'strict'

'error' was never a valid Python string error handler. Accept it for
backwards compatibility but normalize to 'strict' internally. Update
error messages to only mention valid options.

* fix str_errors handling in C string decoder

The C implementation of decode_definite_short_string was not respecting
the str_errors setting - it always used PyUnicode_FromStringAndSize which
only supports strict mode. Now uses PyUnicode_DecodeUTF8 with the
str_errors field passed directly.

Store str_errors as const char* (NULL for strict, "replace" for replace)
instead of PyObject*. This eliminates a conditional in the hot path since
PyUnicode_DecodeUTF8 accepts NULL to mean strict mode.

Fixes #255

* use fp_read directly in string decoder

Skip creating an intermediate Python bytes object by using fp_read
directly into a PyMem_Malloc buffer. This avoids Python allocator and
reference counting overhead.

* stack allocate small strings in C decoder

Use a stack buffer for strings <= 256 bytes to avoid heap allocation
overhead. Larger strings continue to use PyMem_Malloc.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>

1044 of 1104 relevant lines covered (94.57%)

10.33 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
14
95.91
0.03% _decoder.py
Jobs
ID Job ID Ran Files Coverage
1 23406195774.1 22 Mar 2026 03:25PM UTC 8
94.57
GitHub Action Run
Source Files on build 23406195774
  • Tree
  • List 8
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #23406195774
  • 2b53b281 on github
  • Prev Build on master (#23389519491)
  • Next Build on master (#23406651050)
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