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

hgrecco / pint / 1331
91%

Build:
DEFAULT BRANCH: master
Ran 09 Dec 2019 06:54PM UTC
Jobs 13
Files 192
Run time 5min
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
1331

push

travis-ci

web-flow
Merge #923

923: Preserve caches on context switch v2 r=hgrecco a=crusaderky

Fix bug in #909 where, every time a context is reactivated, it creates a brand new entry in UnitRegistry._caches - thus not only nullifying the whole point of the PR, but also creating a nasty memory leak for users that invoke ``.to`` with an inline context many times.

Not sure what went wrong with the first PR - if I rerun the included benchmark, it doesn't reproduce the same results anymore and clearly shows that nothing is cached.

Same benchmark with this PR:
```python
import pint
ureg = pint.UnitRegistry()
src = ureg('1 m')
dst = ureg.Unit('km')
%timeit src.to(dst)
%timeit -n 1 -r 1 src.to(dst, 'chemistry')
%timeit src.to(dst, 'chemistry')
ureg.enable_contexts('chemistry')
%timeit src.to(dst)
```
29.9 µs ± 1.4 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
57.3 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)
76.9 µs ± 1.69 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
43.7 µs ± 955 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

Co-authored-by: Guido Imperiale <crusaderky@gmail.com>

34720 of 40621 relevant lines covered (85.47%)

11.07 hits per line

Jobs
ID Job ID Ran Files Coverage
1 1331.1 (PKGS="python=3.6") 09 Dec 2019 06:54PM UTC 0
77.79
Travis Job 1331.1
2 1331.2 (PKGS="python=3.7") 09 Dec 2019 06:54PM UTC 0
77.79
Travis Job 1331.2
3 1331.3 (PKGS="python=3.8") 09 Dec 2019 06:54PM UTC 0
78.16
Travis Job 1331.3
4 1331.4 (PKGS="python=3.6 uncertainties=3.0") 09 Dec 2019 06:55PM UTC 0
87.92
Travis Job 1331.4
5 1331.5 (PKGS="python=3.7 uncertainties=3.0") 09 Dec 2019 06:55PM UTC 0
87.92
Travis Job 1331.5
6 1331.6 (PKGS="python=3.6 numpy=1.14") 09 Dec 2019 06:56PM UTC 0
85.97
Travis Job 1331.6
7 1331.7 (PKGS="python=3.7 numpy=1.14") 09 Dec 2019 06:56PM UTC 0
86.06
Travis Job 1331.7
8 1331.8 (PKGS="python=3.8 numpy=1.17") 09 Dec 2019 06:57PM UTC 0
86.27
Travis Job 1331.8
9 1331.9 (PKGS="python=3.6 numpy=1.14 uncertainties=3.0") 09 Dec 2019 06:57PM UTC 0
87.83
Travis Job 1331.9
10 1331.10 (PKGS="python=3.7 numpy=1.14 uncertainties=3.0") 09 Dec 2019 06:57PM UTC 0
87.92
Travis Job 1331.10
11 1331.11 (PKGS="python=3.6 numpy uncertainties") 09 Dec 2019 06:58PM UTC 0
87.92
Travis Job 1331.11
12 1331.12 (PKGS="python=3.7 numpy uncertainties") 09 Dec 2019 06:59PM UTC 0
87.92
Travis Job 1331.12
13 1331.13 (PKGS="python=3.8 numpy uncertainties") 09 Dec 2019 06:59PM UTC 0
88.1
Travis Job 1331.13
Source Files on build 1331
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1331
  • a741670e on github
  • Prev Build on master (#1316)
  • Next Build on master (#1336)
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