Repository navigation
Conversation
…honnet#2282) NoopFormatter serializes nothing. An empty capsule makes the next Initialize call Deserialize and throw. Leave sys.clr_data unset.
A single fix does not need a new credits entry.
|
As it stands, we can't safely re- |
|
Pay attention: You're right, thanks for taking a look. I went back and tested master on net8.0, net9.0 and net10.0. Side question: is there anything left on #2282, or can that one be closed too? It still shows up as open when people search for the f*ckin' BinaryFormatter error, for real. |
What does this muthaf*ckin' implement/fix? Explain your changes.
When
BinaryFormattercannot run,RuntimeData.Stashfalls back toNoopFormatterand still published a zero-lengthsys.clr_datacapsule.NoopFormatter.Serializewrites nothing. The nextPythonEngine.Initializesaw that capsule and calledDeserialize, which throws.Stashnow returns before building or publishing the capsule when the formatter is aNoopFormatter. An existing capsule is cleared so a laterInitializebuilds a fresh runtime instead of restoring an empty one, for real. Runtimes whereBinaryFormatterstill works, including .NET Framework, keep the muthaf*ckin' real stash.Does this muthaf*ckin' close any currently open issues?
#2282
Any other comments?
#2639 already catches the
BinaryFormatterfailure and returnsNoopFormatter, soShutdownitself no longer throwsNotSupportedException. This muthaf*ckin' change stops that fallback from leaving a capsule the nextInitializecannot read.The motherf*ckin' new embed test calls
Py_Finalizeafter the assertion, thenInitialize. A secondShutdownin the same process deallocates types from the muthaf*ckin' previous runtime and hitsMetaType.tp_deallocin a debug build.GlobalTestsSetupwould do that second shutdown.Local run, with
PYTHONNET_PYDLLset:dotnet test src/embed_tests/Python.EmbeddingTest.csproj -f net10.0242 passed, 5 skipped, 0 failed.
net472was not run here. This motherf*ckin' machine has nomono.Checklist
AUTHORSCHANGELOG