Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12ce485

Browse files
committed
Add helper macro to get the number of free variables for a PyCodeObject.
1 parent ccae837 commit 12ce485

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Include/compile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef struct {
4646
extern DL_IMPORT(PyTypeObject) PyCode_Type;
4747

4848
#define PyCode_Check(op) ((op)->ob_type == &PyCode_Type)
49+
#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))
4950

5051
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
5152

0 commit comments

Comments
 (0)