Migrate static PyTypeObject to inline, delete PyTypeCache workarounds
All 27 PyTypeObject declarations in namespace mcrfpydef headers changed from `static` to `inline` (C++17), ensuring a single global instance across translation units. This fixes the root cause of stale-type-pointer segfaults where only the McRFPy_API.cpp copy was PyType_Ready'd. Replaced ~20 PyTypeCache call sites and 2 PyRAII::PyTypeRef lookups with direct &mcrfpydef::Type references. Deleted PyTypeCache.h/.cpp, PyObjectUtils.h, and PyRAII.h (all were workarounds for the static bug). 228/228 tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6fdf7279ce
commit
bb72040396
37 changed files with 74 additions and 600 deletions
|
|
@ -3,7 +3,6 @@
|
|||
#include "McRFPy_Automation.h"
|
||||
// Note: McRFPy_Libtcod.h removed in #215 - functionality moved to mcrfpy.bresenham()
|
||||
#include "McRFPy_Doc.h"
|
||||
#include "PyTypeCache.h" // Thread-safe cached Python types
|
||||
#include "platform.h"
|
||||
#include "PyAnimation.h"
|
||||
#include "PyDrawable.h"
|
||||
|
|
@ -756,14 +755,6 @@ PyObject* PyInit_mcrfpy()
|
|||
// - line() functionality replaced by mcrfpy.bresenham()
|
||||
// - compute_fov() redundant with Grid.compute_fov()
|
||||
|
||||
// Initialize PyTypeCache for thread-safe type lookups
|
||||
// This must be done after all types are added to the module
|
||||
if (!PyTypeCache::initialize(m)) {
|
||||
// Failed to initialize type cache - this is a critical error
|
||||
// Error message already set by PyTypeCache::initialize
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//McRFPy_API::mcrf_module = m;
|
||||
return m;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue