| 1469 | func.__module__ = None |
| 1470 | |
| 1471 | class NonModuleObject: |
| 1472 | def __ini__(self): |
| 1473 | self.some_attr = None |
| 1474 | |
| 1475 | def __getattr__(self, name): |
| 1476 | # We whitelist func so that a _whichmodule(func, None) call |
| 1477 | # returns the NonModuleObject instance if a type check on the |
| 1478 | # entries of sys.modules is not carried out, but manipulating |
| 1479 | # this instance thinking it really is a module later on in the |
| 1480 | # pickling process of func errors out |
| 1481 | if name == "func": |
| 1482 | return func |
| 1483 | else: |
| 1484 | raise AttributeError |
| 1485 | |
| 1486 | non_module_object = NonModuleObject() |
| 1487 |
no outgoing calls