If an exception's chain or context can refer to a pointer from a different
VM, a crash would typically result.
This couldn't turn up on UNIX testing because the VM is never torn
down and rebuilt like it is on hardware.
Because in the 'static' case the GeneratorObject is now fully initialized
whenever it's raised, the initialization can be dropped, which reduces
the flash size slightly.
Closes: #7565
cpython actually makes sure the newly chained exception doesn't create
a cycle (even indirectly); see _PyErr_SetObject use of "Floyd's cycle
detection algo". We'll go for the simpler solution of just checking
one level deep until it's clear we need to do more.
Closes: #7414
This may help address #7409 if the underlying cause is the deterministic
volume ID. However, not all boards have working urandom (samd21
at least does not) so a couple of fallbacks are attempted when it fails.
I verified that on a pico_w, each `storage.erase_filesystem()` gives
a distinct 32-bit volume ID (pico_w's urandom can never fail)
The conversion of characters like _space_ in qstrs is a bit
ad-hoc. Because "_not_" stands for the logical negation character ¬
the recently added message was displayed incorrectly:
```
>>> socket.getaddrinfo('does.not.exist', 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
gaierror: (-2, 'Name or service_space¬space_known')
```
I had noticed this, but evidently failed to include the fix in
the problem in #7269.
MP_REGISTER_MODULE would use identifiers like
"MODULE_DEF_MP_QSTR___FUTURE__" which would in turn cause
a QSTR to be generated for it. This wasn't desirable, because the
qstr would never be used.
This clears out quite a bit of flash storage on the proxlight trinkey.
This adds the __cause__, __context__ and __suppress_context__
members to exception objects and makes e.g., `raise exc from cause`
set them in the same way as standard Python.