Skip to content

Commit d7e8b4d

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Fix OSS builds after 3.14 import
Summary: 3.14 upstream has changed `_Py_Instrumentation_GetLine` resulting in: ``` In file included from /home/runner/work/cinderx/cinderx/cinderx/UpstreamBorrow/borrowed-3.14.gen_cached.c:13: /home/runner/work/cinderx/cinderx/cinderx/../cinderx/UpstreamBorrow/borrowed.h:83:37: error: conflicting types for ‘_Ci_Instrumentation_GetLine’; have ‘int(PyCodeObject *, _PyCoLineInstrumentationData *, int)’ 83 | #define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/runner/work/cinderx/cinderx/cinderx/UpstreamBorrow/borrowed-3.14.gen_cached.c:4854:1: note: in expansion of macro ‘_Py_Instrumentation_GetLine’ 4854 | _Py_Instrumentation_GetLine(PyCodeObject *code, _PyCoLineInstrumentationData *line_data, int index) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/runner/work/cinderx/cinderx/cinderx/../cinderx/UpstreamBorrow/borrowed.h:83:37: note: previous declaration of ‘_Ci_Instrumentation_GetLine’ with type ‘int(PyCodeObject *, int)’ 83 | #define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` We don't actually call this externally, we just need it as a dependency to other instrumentation functions. Let's just put the redefine in the borrowed file so we don't hit errors. Reviewed By: grantlouisherman Differential Revision: D103439294 fbshipit-source-id: 4c65a1aa0870105590d906dd208345b950d9ba6f
1 parent ea821f7 commit d7e8b4d

5 files changed

Lines changed: 8 additions & 1 deletion

File tree

cinderx/UpstreamBorrow/borrowed-3.14.c.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ void _PyErr_SetObject(PyThreadState* tstate, PyObject* type, PyObject* value) {
479479
// @Borrow function _PyBuildSlice_ConsumeRefs from Objects/sliceobject.c [3.14]
480480

481481
#define get_line_delta instrumentation_get_line_delta
482+
#define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine
483+
482484
// @Borrow var MOST_SIGNIFICANT_BITS from Python/instrumentation.c [3.14]
483485
// @Borrow var INSTRUMENTED_OPCODES from Python/instrumentation.c [3.14]
484486
// @Borrow var EVENT_FOR_OPCODE from Python/instrumentation.c [3.14]

cinderx/UpstreamBorrow/borrowed-3.14.free-threading.c.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ void _PyErr_SetObject(PyThreadState* tstate, PyObject* type, PyObject* value) {
425425
// @Borrow function _PyBuildSlice_ConsumeRefs from Objects/sliceobject.c [3.14]
426426

427427
#define get_line_delta instrumentation_get_line_delta
428+
#define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine
429+
428430
// @Borrow var MOST_SIGNIFICANT_BITS from Python/instrumentation.c [3.14]
429431
// @Borrow var INSTRUMENTED_OPCODES from Python/instrumentation.c [3.14]
430432
// @Borrow var EVENT_FOR_OPCODE from Python/instrumentation.c [3.14]

cinderx/UpstreamBorrow/borrowed-3.14.free-threading.gen_cached.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3832,6 +3832,8 @@ _PyBuildSlice_ConsumeRefs(PyObject *start, PyObject *stop)
38323832
}
38333833

38343834
#define get_line_delta instrumentation_get_line_delta
3835+
#define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine
3836+
38353837
static const int8_t MOST_SIGNIFICANT_BITS[16] = {
38363838
-1, 0, 1, 1,
38373839
2, 2, 2, 2,

cinderx/UpstreamBorrow/borrowed-3.14.gen_cached.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3979,6 +3979,8 @@ _PyBuildSlice_ConsumeRefs(PyObject *start, PyObject *stop)
39793979
}
39803980

39813981
#define get_line_delta instrumentation_get_line_delta
3982+
#define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine
3983+
39823984
static const int8_t MOST_SIGNIFICANT_BITS[16] = {
39833985
-1, 0, 1, 1,
39843986
2, 2, 2, 2,

cinderx/UpstreamBorrow/borrowed.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
#define _Py_call_instrumentation_jump _Ci_call_instrumentation_jump
8181
#define _Py_call_instrumentation_instruction \
8282
_Ci_call_instrumentation_instruction
83-
#define _Py_Instrumentation_GetLine _Ci_Instrumentation_GetLine
8483
#define _Py_call_instrumentation_line _Ci_call_instrumentation_line
8584
#define _Py_call_instrumentation_exc2 _Ci_call_instrumentation_exc2
8685
#define _PyNumber_InPlacePowerNoMod _CiNumber_InPlacePowerNoMod

0 commit comments

Comments
 (0)