fix: only cache the internals pp after a successful lookup (#6190)

* fix: only cache the internals pp after a successful lookup

In get_pp(), last_istate_tls was set before get_or_create_pp_in_state_dict().
If that call threw, the thread cache matched the interpreter but held a null
pp, so later calls returned nullptr ("get_internals: get_pp() returned
nullptr"). Seen intermittently on MinGW in
test_import_in_subinterpreter_concurrently.

Assisted-by: ClaudeCode:claude-opus-5-5

* test: cover internals cache retries after failed lookup

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2 files changed