Skip to content

Commit 046f911

Browse files
authored
Merge branch 'main' into call-len
2 parents 4b43b5a + e4561da commit 046f911

File tree

11 files changed

+1094
-191
lines changed

11 files changed

+1094
-191
lines changed

Include/cpython/funcobject.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ static inline PyObject* PyFunction_GET_GLOBALS(PyObject *func) {
9797
}
9898
#define PyFunction_GET_GLOBALS(func) PyFunction_GET_GLOBALS(_PyObject_CAST(func))
9999

100+
static inline PyObject* PyFunction_GET_BUILTINS(PyObject *func) {
101+
return _PyFunction_CAST(func)->func_builtins;
102+
}
103+
#define PyFunction_GET_BUILTINS(func) PyFunction_GET_BUILTINS(_PyObject_CAST(func))
104+
100105
static inline PyObject* PyFunction_GET_MODULE(PyObject *func) {
101106
return _PyFunction_CAST(func)->func_module;
102107
}

Include/internal/pycore_code.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,57 @@ extern int _Py_ClearUnusedTLBC(PyInterpreterState *interp);
570570
#endif
571571

572572

573+
typedef struct {
574+
int total;
575+
struct co_locals_counts {
576+
int total;
577+
struct {
578+
int total;
579+
int numposonly;
580+
int numposorkw;
581+
int numkwonly;
582+
int varargs;
583+
int varkwargs;
584+
} args;
585+
int numpure;
586+
struct {
587+
int total;
588+
// numargs does not contribute to locals.total.
589+
int numargs;
590+
int numothers;
591+
} cells;
592+
struct {
593+
int total;
594+
int numpure;
595+
int numcells;
596+
} hidden;
597+
} locals;
598+
int numfree; // nonlocal
599+
struct co_unbound_counts {
600+
int total;
601+
struct {
602+
int total;
603+
int numglobal;
604+
int numbuiltin;
605+
int numunknown;
606+
} globals;
607+
int numattrs;
608+
int numunknown;
609+
} unbound;
610+
} _PyCode_var_counts_t;
611+
612+
PyAPI_FUNC(void) _PyCode_GetVarCounts(
613+
PyCodeObject *,
614+
_PyCode_var_counts_t *);
615+
PyAPI_FUNC(int) _PyCode_SetUnboundVarCounts(
616+
PyThreadState *,
617+
PyCodeObject *,
618+
_PyCode_var_counts_t *,
619+
PyObject *globalnames,
620+
PyObject *attrnames,
621+
PyObject *globalsns,
622+
PyObject *builtinsns);
623+
573624
PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);
574625

575626

Lib/_pyrepl/unix_console.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ def _my_getstr(cap: str, optional: bool = False) -> bytes | None:
197197
self.event_queue = EventQueue(self.input_fd, self.encoding)
198198
self.cursor_visible = 1
199199

200+
signal.signal(signal.SIGCONT, self._sigcont_handler)
201+
202+
def _sigcont_handler(self, signum, frame):
203+
self.restore()
204+
self.prepare()
205+
200206
def __read(self, n: int) -> bytes:
201207
return os.read(self.input_fd, n)
202208

0 commit comments

Comments
 (0)