Skip to content

Commit

Permalink
Add test from numba#7356
Browse files Browse the repository at this point in the history
  • Loading branch information
sklam committed Sep 20, 2021
1 parent 6a25ed7 commit 8f6ffdc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions numba/tests/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import unittest
from multiprocessing import get_context

import numba
from numba.core.errors import TypingError
from numba.tests.support import TestCase
from numba.core.target_extension import resolve_dispatcher_from_str
Expand Down Expand Up @@ -258,6 +259,24 @@ class Klass:
proc.join(timeout=10)
self.assertEqual(proc.exitcode, 0)

def test_dynamic_class_issue_7356(self):
cfunc = numba.njit(issue_7356)
self.assertEqual(cfunc(), (100, 100))


class DynClass(object):
# For testing issue #7356
a = None


def issue_7356():
with numba.objmode(before="intp"):
DynClass.a = 100
before = DynClass.a
with numba.objmode(after="intp"):
after = DynClass.a
return before, after


def check_main_class_reset_on_unpickle():
# Load module and get its global dictionary
Expand Down

0 comments on commit 8f6ffdc

Please sign in to comment.