From 28614d839637f3d6e3f0c2a8ee50ffc0b4d4c6bf Mon Sep 17 00:00:00 2001 From: Jacob Bower Date: Fri, 28 Jun 2024 14:14:09 -0700 Subject: [PATCH] CinderX "compiling" against 3.12 Summary: Attempt to get as much of CinderX compiling against 3.12 as possible by hiding the parts broken by API changes behind `#ifdef`s. The goals are to start unblocking parallel work on the codebase, and highlight areas which need upgrade work. The focus of the work here is just to unblock compilation. Nothing should actually be upgraded, or refactored for upgrade by these changes. The most interesting parts of this diff are: * `Upgrade/upgrade_assert.h` - has an `UPGRADE_ASSERT()` macro which can be used in `#ifdef`s to stop execution when an unfixed area of code is entered. Also has a manually currated enum of "tags" which can be used with this macro to indicate broad category of upgrade work needed. * `Upgrade/upgrade_stubs.[h, cpp]` - Stubbed implementation of APIs missing from 3.10.cinder when building against 3.12. Every function here compiles down to a "stub" which just assert when called. * `Upgrade/upgrade_exports.h` - Similar to `upgrade_stubs.h` but the functions do actually exist in 3.12 but just aren't exported by `libpython3.12`. Other notes: * The orders of some `#include`s have been deliberately changed to avoid global name clashes with new macros. Reviewed By: alexmalyshev Differential Revision: D58312431 fbshipit-source-id: a0b1d5ca2ab399c9c3a944fbb0d088722ff4cea5 --- Include/cinder/hooks.h | 2 -- Python/cinderhooks.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/Include/cinder/hooks.h b/Include/cinder/hooks.h index 7c085f2b84b..eb66d94e3d7 100644 --- a/Include/cinder/hooks.h +++ b/Include/cinder/hooks.h @@ -173,8 +173,6 @@ CiAPI_DATA(Ci_HookType_PyJIT_GetCurrentCodeFlags) CiAPI_DATA(int64_t) __strobe_RuntimeFrameState_py_code; CiAPI_DATA(int64_t) __strobe_CodeRuntime_py_code; -CiAPI_DATA(PyObject*) CiExc_StaticTypeError; - #ifdef __cplusplus } // extern "C" #endif diff --git a/Python/cinderhooks.c b/Python/cinderhooks.c index d18ac98796b..064e4af2e88 100644 --- a/Python/cinderhooks.c +++ b/Python/cinderhooks.c @@ -55,8 +55,6 @@ Ci_HookType_PyJIT_GetBuiltins Ci_hook_PyJIT_GetBuiltins = NULL; Ci_HookType_PyJIT_GetGlobals Ci_hook_PyJIT_GetGlobals = NULL; Ci_HookType_PyJIT_GetCurrentCodeFlags Ci_hook_PyJIT_GetCurrentCodeFlags = NULL; -PyObject* CiExc_StaticTypeError = NULL; - // For backward compatibility, we need this in libpython rather than the // CinderX module. int _PyShadowFrame_WalkAndPopulate(