Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add _PyCode_GetVarCounts().
  • Loading branch information
ericsnowcurrently committed Apr 29, 2025
commit d95aef5b2e9f90be8cadee1a3bc43400c1904bf9
43 changes: 43 additions & 0 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,49 @@ extern int _Py_ClearUnusedTLBC(PyInterpreterState *interp);
#endif


typedef struct {
int total;
struct co_locals_counts {
int total;
struct {
int total;
int numposonly;
int numposorkw;
int numkwonly;
int varargs;
int varkwargs;
} args;
int numpure;
struct {
int total;
// numargs does not contribute to locals.total.
int numargs;
int numothers;
} cells;
struct {
int total;
int numpure;
int numcells;
} hidden;
} locals;
int numfree; // nonlocal
struct co_unbound_counts {
int total;
int numglobal;
int numattrs;
int numunknown;
} unbound;
} _PyCode_var_counts_t;

PyAPI_FUNC(void) _PyCode_GetVarCounts(
PyCodeObject *,
_PyCode_var_counts_t *);
PyAPI_FUNC(int) _PyCode_SetUnboundVarCounts(
PyCodeObject *,
_PyCode_var_counts_t *,
PyObject *global,
PyObject *attrs);

PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);


Expand Down
Loading
Loading