question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cache=True & generators?

See original GitHub issue

reproducing code:

import numba
import numpy as np

@numba.njit(cache=True)
def _thisfunc(vals):
    for v in vals:
        yield v

# calling code:
_thisfunc(np.random.rand(500))

results in:

C:\Anaconda3\lib\site-packages\numba\caching.py in _dump(self, obj)
    563 
    564     def _dump(self, obj):
--> 565         return pickle.dumps(obj, protocol=-1)
    566 
    567     @contextlib.contextmanager

PicklingError: Can't pickle <function _thisfunc at 0x0000014AF82B4D08>: it's not the same object as __main__._thisfunc

but with cache=False the function works. Is there any workaround for this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
stuartarchibaldcommented, Apr 5, 2022

@sklam fixed in #7957, support will be in Numba 0.56.

1reaction
esccommented, Apr 1, 2022

This issue has been opened relatively long ago, and it looks like a genuine bug. At the same time, yield constructs are now fully supported by numba. Is there a timescale for fixing this?

@mtazzari thank you for asking about this, I just double checked on current master and the issue still persists. There is currently no timescale or ETA for this being fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prebuilt Generators | Fig
Adds more control over the suggested files and folders allowing to filter them or perform fast edits to the generated suggestions. Example: filter...
Read more >
Jawr Generators
This generator generates javascript code with locale specific variants which are loaded depending on the user's specific language. Full documentation is here.
Read more >
10.5 rmarkdown's site generator | R Markdown - Bookdown
A main restriction of this site generator is that it assumes all Rmd documents ... To enable caching for an entire document, add...
Read more >
Using the generator for cache renewal
Using the generator for cache renewal - Sitemap Generator Forum. ... the generator to set a session variable ($_SESSION['cache] = true), ...
Read more >
Cache - webpack
... build speed. cache is set to type: 'memory' in development mode and disabled in production mode. cache: true is an alias to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found