gh-107149: make new opcode util functions private rather than public and unstable (#112042)

This commit is contained in:
Irit Katriel 2023-11-14 00:31:02 +00:00 committed by GitHub
parent b28bb130bb
commit 36aab34fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 39 deletions

View file

@ -6,6 +6,7 @@
#include "compile.h"
#include "opcode.h"
#include "internal/pycore_code.h"
#include "internal/pycore_compile.h"
#include "internal/pycore_intrinsics.h"
/*[clinic input]
@ -78,7 +79,7 @@ static int
_opcode_is_valid_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=b0d918ea1d073f65 input=fe23e0aa194ddae0]*/
{
return PyUnstable_OpcodeIsValid(opcode);
return _PyCompile_OpcodeIsValid(opcode);
}
/*[clinic input]
@ -94,8 +95,8 @@ static int
_opcode_has_arg_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=7a062d3b2dcc0815 input=93d878ba6361db5f]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasArg(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasArg(opcode);
}
/*[clinic input]
@ -111,8 +112,8 @@ static int
_opcode_has_const_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=c646d5027c634120 input=a6999e4cf13f9410]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasConst(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasConst(opcode);
}
/*[clinic input]
@ -128,8 +129,8 @@ static int
_opcode_has_name_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=b49a83555c2fa517 input=448aa5e4bcc947ba]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasName(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasName(opcode);
}
/*[clinic input]
@ -145,8 +146,8 @@ static int
_opcode_has_jump_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=e9c583c669f1c46a input=35f711274357a0c3]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasJump(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasJump(opcode);
}
@ -168,8 +169,8 @@ static int
_opcode_has_free_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=d81ae4d79af0ee26 input=117dcd5c19c1139b]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasFree(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasFree(opcode);
}
@ -186,8 +187,8 @@ static int
_opcode_has_local_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=da5a8616b7a5097b input=9a798ee24aaef49d]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasLocal(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasLocal(opcode);
}
/*[clinic input]
@ -203,8 +204,8 @@ static int
_opcode_has_exc_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=41b68dff0ec82a52 input=db0e4bdb9bf13fa5]*/
{
return PyUnstable_OpcodeIsValid(opcode) &&
PyUnstable_OpcodeHasExc(opcode);
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasExc(opcode);
}
/*[clinic input]
@ -309,7 +310,7 @@ _opcode_get_intrinsic1_descs_impl(PyObject *module)
return NULL;
}
for (int i=0; i <= MAX_INTRINSIC_1; i++) {
PyObject *name = PyUnstable_GetUnaryIntrinsicName(i);
PyObject *name = _PyCompile_GetUnaryIntrinsicName(i);
if (name == NULL) {
Py_DECREF(list);
return NULL;
@ -336,7 +337,7 @@ _opcode_get_intrinsic2_descs_impl(PyObject *module)
return NULL;
}
for (int i=0; i <= MAX_INTRINSIC_2; i++) {
PyObject *name = PyUnstable_GetBinaryIntrinsicName(i);
PyObject *name = _PyCompile_GetBinaryIntrinsicName(i);
if (name == NULL) {
Py_DECREF(list);
return NULL;