From webhook-mailer at python.org Fri May 1 00:30:18 2020 From: webhook-mailer at python.org (Noah Doersing) Date: Fri, 01 May 2020 04:30:18 -0000 Subject: [Python-checkins] Change 'exception happened' to 'exception occurred' in two places (#19767) Message-ID: https://github.com/python/cpython/commit/8bcfd31cc01e068bca78aa42a87c24aea6ebc6b1 commit: 8bcfd31cc01e068bca78aa42a87c24aea6ebc6b1 branch: master author: Noah Doersing committer: GitHub date: 2020-04-30T21:30:10-07:00 summary: Change 'exception happened' to 'exception occurred' in two places (#19767) files: M Doc/tutorial/errors.rst M Lib/socketserver.py diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index ab23df9f3ff9a..0ce96466e8c28 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -67,7 +67,7 @@ The rest of the line provides detail based on the type of exception and what caused it. The preceding part of the error message shows the context where the exception -happened, in the form of a stack traceback. In general it contains a stack +occurred, in the form of a stack traceback. In general it contains a stack traceback listing source lines; however, it will not display lines read from standard input. diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 1ad028fa4d08c..57c1ae6e9e8be 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -374,7 +374,7 @@ def handle_error(self, request, client_address): """ print('-'*40, file=sys.stderr) - print('Exception happened during processing of request from', + print('Exception occurred during processing of request from', client_address, file=sys.stderr) import traceback traceback.print_exc() From webhook-mailer at python.org Fri May 1 05:33:52 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 May 2020 09:33:52 -0000 Subject: [Python-checkins] bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820) Message-ID: https://github.com/python/cpython/commit/252346acd937ddba4845331994b8ff4f90349625 commit: 252346acd937ddba4845331994b8ff4f90349625 branch: master author: Victor Stinner committer: GitHub date: 2020-05-01T11:33:44+02:00 summary: bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820) An isolated subinterpreter cannot spawn threads, spawn a child process or call os.fork(). * Add private _Py_NewInterpreter(isolated_subinterpreter) function. * Add isolated=True keyword-only parameter to _xxsubinterpreters.create(). * Allow again os.fork() in "non-isolated" subinterpreters. files: A Misc/NEWS.d/next/Library/2020-04-30-22-04-58.bpo-40453.ggz7sl.rst M Doc/c-api/init_config.rst M Include/cpython/initconfig.h M Include/cpython/pylifecycle.h M Lib/test/test__xxsubinterpreters.py M Lib/test/test_embed.py M Modules/_posixsubprocess.c M Modules/_threadmodule.c M Modules/_winapi.c M Modules/_xxsubinterpretersmodule.c M Modules/posixmodule.c M Programs/_testembed.c M Python/initconfig.c M Python/pylifecycle.c diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index 49507c8bad3ed..fc82c3eb59024 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -1004,6 +1004,8 @@ Private provisional API: * :c:member:`PyConfig._init_main`: if set to 0, :c:func:`Py_InitializeFromConfig` stops at the "Core" initialization phase. +* :c:member:`PyConfig._isolated_interpreter`: if non-zero, + disallow threads, subprocesses and fork. .. c:function:: PyStatus _Py_InitializeMain(void) diff --git a/Include/cpython/initconfig.h b/Include/cpython/initconfig.h index 8326c235702bd..df93a5539d48b 100644 --- a/Include/cpython/initconfig.h +++ b/Include/cpython/initconfig.h @@ -409,6 +409,10 @@ typedef struct { /* If equal to 0, stop Python initialization before the "main" phase */ int _init_main; + + /* If non-zero, disallow threads, subprocesses, and fork. + Default: 0. */ + int _isolated_interpreter; } PyConfig; PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config); diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h index a01e9c94f12d7..eb523b82e182d 100644 --- a/Include/cpython/pylifecycle.h +++ b/Include/cpython/pylifecycle.h @@ -65,6 +65,8 @@ PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn); PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn); PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category); +PyAPI_FUNC(PyThreadState *) _Py_NewInterpreter(int isolated_subinterpreter); + #ifdef __cplusplus } #endif diff --git a/Lib/test/test__xxsubinterpreters.py b/Lib/test/test__xxsubinterpreters.py index 80eff19152f15..e17bfde2c2f75 100644 --- a/Lib/test/test__xxsubinterpreters.py +++ b/Lib/test/test__xxsubinterpreters.py @@ -794,6 +794,7 @@ def f(): self.assertEqual(out, 'it worked!') def test_create_thread(self): + subinterp = interpreters.create(isolated=False) script, file = _captured_script(""" import threading def f(): @@ -804,7 +805,7 @@ def f(): t.join() """) with file: - interpreters.run_string(self.id, script) + interpreters.run_string(subinterp, script) out = file.read() self.assertEqual(out, 'it worked!') diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 0bdfae1b7e387..3d60b2f330c62 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -406,6 +406,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'check_hash_pycs_mode': 'default', 'pathconfig_warnings': 1, '_init_main': 1, + '_isolated_interpreter': 0, } if MS_WINDOWS: CONFIG_COMPAT.update({ @@ -766,6 +767,8 @@ def test_init_from_config(self): 'check_hash_pycs_mode': 'always', 'pathconfig_warnings': 0, + + '_isolated_interpreter': 1, } self.check_all_configs("test_init_from_config", config, preconfig, api=API_COMPAT) diff --git a/Misc/NEWS.d/next/Library/2020-04-30-22-04-58.bpo-40453.ggz7sl.rst b/Misc/NEWS.d/next/Library/2020-04-30-22-04-58.bpo-40453.ggz7sl.rst new file mode 100644 index 0000000000000..f20c666d3e27f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-04-30-22-04-58.bpo-40453.ggz7sl.rst @@ -0,0 +1,3 @@ +Add ``isolated=True`` keyword-only parameter to +``_xxsubinterpreters.create()``. An isolated subinterpreter cannot spawn +threads, spawn a child process or call ``os.fork()``. diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 60dd78d92a4f5..add2962189b1c 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -663,6 +663,14 @@ subprocess_fork_exec(PyObject* self, PyObject *args) return NULL; } + PyInterpreterState *interp = PyInterpreterState_Get(); + const PyConfig *config = _PyInterpreterState_GetConfig(interp); + if (config->_isolated_interpreter) { + PyErr_SetString(PyExc_RuntimeError, + "subprocess not supported for isolated subinterpreters"); + return NULL; + } + /* We need to call gc.disable() when we'll be calling preexec_fn */ if (preexec_fn != Py_None) { PyObject *result; diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index b3d90b22c5a66..77baba4847897 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -1085,6 +1085,14 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) "optional 3rd arg must be a dictionary"); return NULL; } + + PyInterpreterState *interp = _PyInterpreterState_GET(); + if (interp->config._isolated_interpreter) { + PyErr_SetString(PyExc_RuntimeError, + "thread is not supported for isolated subinterpreters"); + return NULL; + } + boot = PyMem_NEW(struct bootstate, 1); if (boot == NULL) return PyErr_NoMemory(); diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 1b28adb0b3983..e1672c478522e 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -1080,6 +1080,14 @@ _winapi_CreateProcess_impl(PyObject *module, return NULL; } + PyInterpreterState *interp = PyInterpreterState_Get(); + const PyConfig *config = _PyInterpreterState_GetConfig(interp); + if (config->_isolated_interpreter) { + PyErr_SetString(PyExc_RuntimeError, + "subprocess not supported for isolated subinterpreters"); + return NULL; + } + ZeroMemory(&si, sizeof(si)); si.StartupInfo.cb = sizeof(si); diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 15e80559ec6f6..de11c090870f9 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -1999,16 +1999,20 @@ _global_channels(void) { } static PyObject * -interp_create(PyObject *self, PyObject *args) +interp_create(PyObject *self, PyObject *args, PyObject *kwds) { - if (!PyArg_UnpackTuple(args, "create", 0, 0)) { + + static char *kwlist[] = {"isolated", NULL}; + int isolated = 1; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|$i:create", kwlist, + &isolated)) { return NULL; } // Create and initialize the new interpreter. PyThreadState *save_tstate = PyThreadState_Swap(NULL); // XXX Possible GILState issues? - PyThreadState *tstate = Py_NewInterpreter(); + PyThreadState *tstate = _Py_NewInterpreter(isolated); PyThreadState_Swap(save_tstate); if (tstate == NULL) { /* Since no new thread state was created, there is no exception to @@ -2547,8 +2551,8 @@ channel__channel_id(PyObject *self, PyObject *args, PyObject *kwds) } static PyMethodDef module_functions[] = { - {"create", (PyCFunction)interp_create, - METH_VARARGS, create_doc}, + {"create", (PyCFunction)(void(*)(void))interp_create, + METH_VARARGS | METH_KEYWORDS, create_doc}, {"destroy", (PyCFunction)(void(*)(void))interp_destroy, METH_VARARGS | METH_KEYWORDS, destroy_doc}, {"list_all", interp_list_all, diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 3d3f6ac969926..0163b0757aefa 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6243,9 +6243,10 @@ os_fork_impl(PyObject *module) /*[clinic end generated code: output=3626c81f98985d49 input=13c956413110eeaa]*/ { pid_t pid; - - if (_PyInterpreterState_GET() != PyInterpreterState_Main()) { - PyErr_SetString(PyExc_RuntimeError, "fork not supported for subinterpreters"); + PyInterpreterState *interp = _PyInterpreterState_GET(); + if (interp->config._isolated_interpreter) { + PyErr_SetString(PyExc_RuntimeError, + "fork not supported for isolated subinterpreters"); return NULL; } if (PySys_Audit("os.fork", NULL) < 0) { diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 2cf0d71b470bf..5c83678f650d0 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -603,6 +603,8 @@ static int test_init_from_config(void) Py_FrozenFlag = 0; config.pathconfig_warnings = 0; + config._isolated_interpreter = 1; + init_from_config_clear(&config); dump_config(); diff --git a/Python/initconfig.c b/Python/initconfig.c index 58cca562f336d..185935c05fb28 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -632,6 +632,7 @@ _PyConfig_InitCompatConfig(PyConfig *config) config->check_hash_pycs_mode = NULL; config->pathconfig_warnings = -1; config->_init_main = 1; + config->_isolated_interpreter = 0; #ifdef MS_WINDOWS config->legacy_windows_stdio = -1; #endif @@ -850,6 +851,7 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2) COPY_WSTR_ATTR(check_hash_pycs_mode); COPY_ATTR(pathconfig_warnings); COPY_ATTR(_init_main); + COPY_ATTR(_isolated_interpreter); #undef COPY_ATTR #undef COPY_WSTR_ATTR @@ -949,6 +951,7 @@ config_as_dict(const PyConfig *config) SET_ITEM_WSTR(check_hash_pycs_mode); SET_ITEM_INT(pathconfig_warnings); SET_ITEM_INT(_init_main); + SET_ITEM_INT(_isolated_interpreter); return dict; diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 7909cdbf5b772..5726a559cfcb7 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1526,7 +1526,7 @@ Py_Finalize(void) */ static PyStatus -new_interpreter(PyThreadState **tstate_p) +new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter) { PyStatus status; @@ -1573,6 +1573,7 @@ new_interpreter(PyThreadState **tstate_p) if (_PyStatus_EXCEPTION(status)) { goto error; } + interp->config._isolated_interpreter = isolated_subinterpreter; status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { @@ -1606,10 +1607,10 @@ new_interpreter(PyThreadState **tstate_p) } PyThreadState * -Py_NewInterpreter(void) +_Py_NewInterpreter(int isolated_subinterpreter) { PyThreadState *tstate = NULL; - PyStatus status = new_interpreter(&tstate); + PyStatus status = new_interpreter(&tstate, isolated_subinterpreter); if (_PyStatus_EXCEPTION(status)) { Py_ExitStatusException(status); } @@ -1617,6 +1618,12 @@ Py_NewInterpreter(void) } +PyThreadState * +Py_NewInterpreter(void) +{ + return _Py_NewInterpreter(0); +} + /* Delete an interpreter and its last thread. This requires that the given thread state is current, that the thread has no remaining frames, and that it is its interpreter's only remaining thread. From webhook-mailer at python.org Fri May 1 07:32:31 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 11:32:31 -0000 Subject: [Python-checkins] bpo-40334: Simplify type handling in the PEG c_generator (GH-19818) Message-ID: https://github.com/python/cpython/commit/b796b3fb48283412d3caf52323c69690e5818d3d commit: b796b3fb48283412d3caf52323c69690e5818d3d branch: master author: Pablo Galindo committer: GitHub date: 2020-05-01T12:32:26+01:00 summary: bpo-40334: Simplify type handling in the PEG c_generator (GH-19818) files: M Parser/pegen/parse.c M Tools/peg_generator/pegen/c_generator.py M Tools/peg_generator/pegen/parser_generator.py diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 9c941ca1ee2ec..2be5e384ae532 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -676,7 +676,7 @@ file_rule(Parser *p) int mark = p->mark; { // statements? $ void *a; - void *endmarker_var; + Token * endmarker_var; if ( (a = statements_rule(p), 1) && @@ -738,7 +738,7 @@ eval_rule(Parser *p) { // expressions NEWLINE* $ asdl_seq * _loop0_1_var; expr_ty a; - void *endmarker_var; + Token * endmarker_var; if ( (a = expressions_rule(p)) && @@ -774,10 +774,10 @@ func_type_rule(Parser *p) asdl_seq * _loop0_2_var; void *a; expr_ty b; - void *endmarker_var; - void *literal; - void *literal_1; - void *literal_2; + Token * endmarker_var; + Token * literal; + Token * literal_1; + Token * literal_2; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -850,10 +850,10 @@ type_expressions_rule(Parser *p) asdl_seq * a; expr_ty b; expr_ty c; - void *literal; - void *literal_1; - void *literal_2; - void *literal_3; + Token * literal; + Token * literal_1; + Token * literal_2; + Token * literal_3; if ( (a = _gather_3_rule(p)) && @@ -882,8 +882,8 @@ type_expressions_rule(Parser *p) { // ','.expression+ ',' '*' expression asdl_seq * a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = _gather_5_rule(p)) && @@ -906,8 +906,8 @@ type_expressions_rule(Parser *p) { // ','.expression+ ',' '**' expression asdl_seq * a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = _gather_7_rule(p)) && @@ -1031,7 +1031,7 @@ statement_newline_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // compound_stmt NEWLINE stmt_ty a; - void *newline_var; + Token * newline_var; if ( (a = compound_stmt_rule(p)) && @@ -1059,7 +1059,7 @@ statement_newline_rule(Parser *p) p->mark = mark; } { // NEWLINE - void *newline_var; + Token * newline_var; if ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) ) @@ -1082,7 +1082,7 @@ statement_newline_rule(Parser *p) p->mark = mark; } { // $ - void *endmarker_var; + Token * endmarker_var; if ( (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) ) @@ -1112,7 +1112,7 @@ simple_stmt_rule(Parser *p) int mark = p->mark; { // small_stmt !';' NEWLINE stmt_ty a; - void *newline_var; + Token * newline_var; if ( (a = small_stmt_rule(p)) && @@ -1132,7 +1132,7 @@ simple_stmt_rule(Parser *p) } { // ';'.small_stmt+ ';'? NEWLINE asdl_seq * a; - void *newline_var; + Token * newline_var; void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( @@ -1263,7 +1263,7 @@ small_stmt_rule(Parser *p) p->mark = mark; } { // 'pass' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 502)) ) @@ -1325,7 +1325,7 @@ small_stmt_rule(Parser *p) p->mark = mark; } { // 'break' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 506)) ) @@ -1348,7 +1348,7 @@ small_stmt_rule(Parser *p) p->mark = mark; } { // 'continue' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 507)) ) @@ -1540,7 +1540,7 @@ assignment_rule(Parser *p) expr_ty a; expr_ty b; void *c; - void *literal; + Token * literal; if ( (a = _PyPegen_name_token(p)) && @@ -1572,7 +1572,7 @@ assignment_rule(Parser *p) void *a; expr_ty b; void *c; - void *literal; + Token * literal; if ( (a = _tmp_20_rule(p)) && @@ -1697,7 +1697,7 @@ augassign_rule(Parser *p) AugOperator* res = NULL; int mark = p->mark; { // '+=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 36)) ) @@ -1712,7 +1712,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '-=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 37)) ) @@ -1727,7 +1727,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '*=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 38)) ) @@ -1742,7 +1742,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '@=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 50)) ) @@ -1757,7 +1757,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '/=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 39)) ) @@ -1772,7 +1772,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '%=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 40)) ) @@ -1787,7 +1787,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '&=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 41)) ) @@ -1802,7 +1802,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '|=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 42)) ) @@ -1817,7 +1817,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '^=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 43)) ) @@ -1832,7 +1832,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '<<=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 44)) ) @@ -1847,7 +1847,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '>>=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 45)) ) @@ -1862,7 +1862,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '**=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 46)) ) @@ -1877,7 +1877,7 @@ augassign_rule(Parser *p) p->mark = mark; } { // '//=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 48)) ) @@ -1915,7 +1915,7 @@ global_stmt_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'global' ','.NAME+ asdl_seq * a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 508)) && @@ -1963,7 +1963,7 @@ nonlocal_stmt_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'nonlocal' ','.NAME+ asdl_seq * a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 509)) && @@ -2057,7 +2057,7 @@ assert_stmt_rule(Parser *p) { // 'assert' expression [',' expression] expr_ty a; void *b; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 505)) && @@ -2107,7 +2107,7 @@ del_stmt_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'del' del_targets asdl_seq* a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 503)) && @@ -2191,7 +2191,7 @@ import_name_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'import' dotted_as_names asdl_seq* a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 513)) && @@ -2243,8 +2243,8 @@ import_from_rule(Parser *p) asdl_seq * a; expr_ty b; asdl_seq* c; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (keyword = _PyPegen_expect_token(p, 514)) && @@ -2277,8 +2277,8 @@ import_from_rule(Parser *p) { // 'from' (('.' | '...'))+ 'import' import_from_targets asdl_seq * a; asdl_seq* b; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (keyword = _PyPegen_expect_token(p, 514)) && @@ -2322,8 +2322,8 @@ import_from_targets_rule(Parser *p) int mark = p->mark; { // '(' import_from_as_names ','? ')' asdl_seq* a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( @@ -2357,7 +2357,7 @@ import_from_targets_rule(Parser *p) p->mark = mark; } { // '*' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 16)) ) @@ -2535,7 +2535,7 @@ dotted_name_raw(Parser *p) { // dotted_name '.' NAME expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = dotted_name_rule(p)) && @@ -2592,8 +2592,8 @@ if_stmt_rule(Parser *p) expr_ty a; asdl_seq* b; stmt_ty c; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 510)) && @@ -2627,8 +2627,8 @@ if_stmt_rule(Parser *p) expr_ty a; asdl_seq* b; void *c; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 510)) && @@ -2686,8 +2686,8 @@ elif_stmt_rule(Parser *p) expr_ty a; asdl_seq* b; stmt_ty c; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 515)) && @@ -2721,8 +2721,8 @@ elif_stmt_rule(Parser *p) expr_ty a; asdl_seq* b; void *c; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 515)) && @@ -2768,8 +2768,8 @@ else_block_rule(Parser *p) int mark = p->mark; { // 'else' ':' block asdl_seq* b; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 516)) && @@ -2813,8 +2813,8 @@ while_stmt_rule(Parser *p) expr_ty a; asdl_seq* b; void *c; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 512)) && @@ -2872,9 +2872,9 @@ for_stmt_rule(Parser *p) asdl_seq* b; void *el; expr_ty ex; - void *keyword; - void *keyword_1; - void *literal; + Token * keyword; + Token * keyword_1; + Token * literal; expr_ty t; void *tc; if ( @@ -2913,13 +2913,13 @@ for_stmt_rule(Parser *p) p->mark = mark; } { // ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? - void *async_var; + Token * async_var; asdl_seq* b; void *el; expr_ty ex; - void *keyword; - void *keyword_1; - void *literal; + Token * keyword; + Token * keyword_1; + Token * literal; expr_ty t; void *tc; if ( @@ -2988,10 +2988,10 @@ with_stmt_rule(Parser *p) { // 'with' '(' ','.with_item+ ')' ':' block asdl_seq * a; asdl_seq* b; - void *keyword; - void *literal; - void *literal_1; - void *literal_2; + Token * keyword; + Token * literal; + Token * literal_1; + Token * literal_2; if ( (keyword = _PyPegen_expect_token(p, 519)) && @@ -3026,8 +3026,8 @@ with_stmt_rule(Parser *p) { // 'with' ','.with_item+ ':' TYPE_COMMENT? block asdl_seq * a; asdl_seq* b; - void *keyword; - void *literal; + Token * keyword; + Token * literal; void *tc; if ( (keyword = _PyPegen_expect_token(p, 519)) @@ -3060,12 +3060,12 @@ with_stmt_rule(Parser *p) } { // ASYNC 'with' '(' ','.with_item+ ')' ':' block asdl_seq * a; - void *async_var; + Token * async_var; asdl_seq* b; - void *keyword; - void *literal; - void *literal_1; - void *literal_2; + Token * keyword; + Token * literal; + Token * literal_1; + Token * literal_2; if ( (async_var = _PyPegen_expect_token(p, ASYNC)) && @@ -3101,10 +3101,10 @@ with_stmt_rule(Parser *p) } { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block asdl_seq * a; - void *async_var; + Token * async_var; asdl_seq* b; - void *keyword; - void *literal; + Token * keyword; + Token * literal; void *tc; if ( (async_var = _PyPegen_expect_token(p, ASYNC)) @@ -3196,8 +3196,8 @@ try_stmt_rule(Parser *p) { // 'try' ':' block finally_block asdl_seq* b; asdl_seq* f; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 511)) && @@ -3230,8 +3230,8 @@ try_stmt_rule(Parser *p) void *el; asdl_seq * ex; void *f; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 511)) && @@ -3288,8 +3288,8 @@ except_block_rule(Parser *p) { // 'except' expression ['as' target] ':' block asdl_seq* b; expr_ty e; - void *keyword; - void *literal; + Token * keyword; + Token * literal; void *t; if ( (keyword = _PyPegen_expect_token(p, 520)) @@ -3322,8 +3322,8 @@ except_block_rule(Parser *p) } { // 'except' ':' block asdl_seq* b; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 520)) && @@ -3365,8 +3365,8 @@ finally_block_rule(Parser *p) int mark = p->mark; { // 'finally' ':' block asdl_seq* a; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 521)) && @@ -3408,7 +3408,7 @@ return_stmt_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'return' star_expressions? void *a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 500)) && @@ -3457,7 +3457,7 @@ raise_stmt_rule(Parser *p) { // 'raise' expression ['from' expression] expr_ty a; void *b; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 501)) && @@ -3484,7 +3484,7 @@ raise_stmt_rule(Parser *p) p->mark = mark; } { // 'raise' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 501)) ) @@ -3576,10 +3576,10 @@ function_def_raw_rule(Parser *p) { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block void *a; asdl_seq* b; - void *keyword; - void *literal; - void *literal_1; - void *literal_2; + Token * keyword; + Token * literal; + Token * literal_1; + Token * literal_2; expr_ty n; void *params; void *tc; @@ -3622,12 +3622,12 @@ function_def_raw_rule(Parser *p) } { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block void *a; - void *async_var; + Token * async_var; asdl_seq* b; - void *keyword; - void *literal; - void *literal_1; - void *literal_2; + Token * keyword; + Token * literal; + Token * literal_1; + Token * literal_2; expr_ty n; void *params; void *tc; @@ -3688,8 +3688,8 @@ func_type_comment_rule(Parser *p) PyObject* res = NULL; int mark = p->mark; { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) - void *newline_var; - void *t; + Token * newline_var; + Token * t; if ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) && @@ -3719,7 +3719,7 @@ func_type_comment_rule(Parser *p) p->mark = mark; } { // TYPE_COMMENT - void *type_comment_var; + Token * type_comment_var; if ( (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) ) @@ -3899,8 +3899,8 @@ slash_no_default_rule(Parser *p) int mark = p->mark; { // param_no_default+ '/' ',' asdl_seq * a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = _loop1_59_rule(p)) && @@ -3920,7 +3920,7 @@ slash_no_default_rule(Parser *p) } { // param_no_default+ '/' &')' asdl_seq * a; - void *literal; + Token * literal; if ( (a = _loop1_60_rule(p)) && @@ -3957,8 +3957,8 @@ slash_with_default_rule(Parser *p) { // param_no_default* param_with_default+ '/' ',' asdl_seq * a; asdl_seq * b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = _loop0_61_rule(p)) && @@ -3981,7 +3981,7 @@ slash_with_default_rule(Parser *p) { // param_no_default* param_with_default+ '/' &')' asdl_seq * a; asdl_seq * b; - void *literal; + Token * literal; if ( (a = _loop0_63_rule(p)) && @@ -4022,7 +4022,7 @@ star_etc_rule(Parser *p) arg_ty a; asdl_seq * b; void *c; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 16)) && @@ -4045,8 +4045,8 @@ star_etc_rule(Parser *p) { // '*' ',' param_maybe_default+ kwds? asdl_seq * b; void *c; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 16)) && @@ -4097,7 +4097,7 @@ kwds_rule(Parser *p) int mark = p->mark; { // '**' param_no_default arg_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 35)) && @@ -4129,7 +4129,7 @@ param_no_default_rule(Parser *p) int mark = p->mark; { // param ',' TYPE_COMMENT? arg_ty a; - void *literal; + Token * literal; void *tc; if ( (a = param_rule(p)) @@ -4185,7 +4185,7 @@ param_with_default_rule(Parser *p) { // param default ',' TYPE_COMMENT? arg_ty a; expr_ty c; - void *literal; + Token * literal; void *tc; if ( (a = param_rule(p)) @@ -4248,7 +4248,7 @@ param_maybe_default_rule(Parser *p) { // param default? ',' TYPE_COMMENT? arg_ty a; void *c; - void *literal; + Token * literal; void *tc; if ( (a = param_rule(p)) @@ -4356,7 +4356,7 @@ annotation_rule(Parser *p) int mark = p->mark; { // ':' expression expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 11)) && @@ -4388,7 +4388,7 @@ default_rule(Parser *p) int mark = p->mark; { // '=' expression expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 22)) && @@ -4502,8 +4502,8 @@ class_def_raw_rule(Parser *p) expr_ty a; void *b; asdl_seq* c; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 523)) && @@ -4551,9 +4551,9 @@ block_rule(Parser *p) int mark = p->mark; { // NEWLINE INDENT statements DEDENT asdl_seq* a; - void *dedent_var; - void *indent_var; - void *newline_var; + Token * dedent_var; + Token * indent_var; + Token * newline_var; if ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) && @@ -4686,7 +4686,7 @@ star_expressions_rule(Parser *p) } { // star_expression ',' expr_ty a; - void *literal; + Token * literal; if ( (a = star_expression_rule(p)) && @@ -4747,7 +4747,7 @@ star_expression_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '*' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 16)) && @@ -4840,7 +4840,7 @@ star_named_expression_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '*' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 16)) && @@ -4900,7 +4900,7 @@ named_expression_rule(Parser *p) { // NAME ':=' expression expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = _PyPegen_name_token(p)) && @@ -5040,7 +5040,7 @@ expressions_rule(Parser *p) } { // expression ',' expr_ty a; - void *literal; + Token * literal; if ( (a = expression_rule(p)) && @@ -5103,8 +5103,8 @@ expression_rule(Parser *p) expr_ty a; expr_ty b; expr_ty c; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (a = disjunction_rule(p)) && @@ -5182,8 +5182,8 @@ lambdef_rule(Parser *p) { // 'lambda' lambda_parameters? ':' expression void *a; expr_ty b; - void *keyword; - void *literal; + Token * keyword; + Token * literal; if ( (keyword = _PyPegen_expect_token(p, 524)) && @@ -5345,8 +5345,8 @@ lambda_slash_without_default_rule(Parser *p) int mark = p->mark; { // lambda_plain_names ',' '/' asdl_seq* a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = lambda_plain_names_rule(p)) && @@ -5381,8 +5381,8 @@ lambda_slash_with_default_rule(Parser *p) { // [lambda_plain_names ','] lambda_names_with_default ',' '/' void *a; asdl_seq* b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = _tmp_83_rule(p), 1) && @@ -5423,7 +5423,7 @@ lambda_star_etc_rule(Parser *p) arg_ty a; asdl_seq * b; void *c; - void *literal; + Token * literal; void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( @@ -5450,7 +5450,7 @@ lambda_star_etc_rule(Parser *p) { // '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','? asdl_seq * b; void *c; - void *literal; + Token * literal; void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( @@ -5508,7 +5508,7 @@ lambda_name_with_optional_default_rule(Parser *p) { // ',' lambda_plain_name ['=' expression] arg_ty a; void *b; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -5571,7 +5571,7 @@ lambda_name_with_default_rule(Parser *p) int mark = p->mark; { // lambda_plain_name '=' expression expr_ty e; - void *literal; + Token * literal; arg_ty n; if ( (n = lambda_plain_name_rule(p)) @@ -5680,7 +5680,7 @@ lambda_kwds_rule(Parser *p) int mark = p->mark; { // '**' lambda_plain_name arg_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 35)) && @@ -5846,7 +5846,7 @@ inversion_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'not' inversion expr_ty a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 525)) && @@ -6091,7 +6091,7 @@ eq_bitwise_or_rule(Parser *p) int mark = p->mark; { // '==' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 27)) && @@ -6155,7 +6155,7 @@ lte_bitwise_or_rule(Parser *p) int mark = p->mark; { // '<=' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 29)) && @@ -6187,7 +6187,7 @@ lt_bitwise_or_rule(Parser *p) int mark = p->mark; { // '<' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 20)) && @@ -6219,7 +6219,7 @@ gte_bitwise_or_rule(Parser *p) int mark = p->mark; { // '>=' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 30)) && @@ -6251,7 +6251,7 @@ gt_bitwise_or_rule(Parser *p) int mark = p->mark; { // '>' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 21)) && @@ -6283,8 +6283,8 @@ notin_bitwise_or_rule(Parser *p) int mark = p->mark; { // 'not' 'in' bitwise_or expr_ty a; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (keyword = _PyPegen_expect_token(p, 525)) && @@ -6318,7 +6318,7 @@ in_bitwise_or_rule(Parser *p) int mark = p->mark; { // 'in' bitwise_or expr_ty a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 518)) && @@ -6350,8 +6350,8 @@ isnot_bitwise_or_rule(Parser *p) int mark = p->mark; { // 'is' 'not' bitwise_or expr_ty a; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (keyword = _PyPegen_expect_token(p, 526)) && @@ -6385,7 +6385,7 @@ is_bitwise_or_rule(Parser *p) int mark = p->mark; { // 'is' bitwise_or expr_ty a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 526)) && @@ -6451,7 +6451,7 @@ bitwise_or_raw(Parser *p) { // bitwise_or '|' bitwise_xor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = bitwise_or_rule(p)) && @@ -6538,7 +6538,7 @@ bitwise_xor_raw(Parser *p) { // bitwise_xor '^' bitwise_and expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = bitwise_xor_rule(p)) && @@ -6625,7 +6625,7 @@ bitwise_and_raw(Parser *p) { // bitwise_and '&' shift_expr expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = bitwise_and_rule(p)) && @@ -6712,7 +6712,7 @@ shift_expr_raw(Parser *p) { // shift_expr '<<' sum expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = shift_expr_rule(p)) && @@ -6741,7 +6741,7 @@ shift_expr_raw(Parser *p) { // shift_expr '>>' sum expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = shift_expr_rule(p)) && @@ -6828,7 +6828,7 @@ sum_raw(Parser *p) { // sum '+' term expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = sum_rule(p)) && @@ -6857,7 +6857,7 @@ sum_raw(Parser *p) { // sum '-' term expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = sum_rule(p)) && @@ -6950,7 +6950,7 @@ term_raw(Parser *p) { // term '*' factor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = term_rule(p)) && @@ -6979,7 +6979,7 @@ term_raw(Parser *p) { // term '/' factor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = term_rule(p)) && @@ -7008,7 +7008,7 @@ term_raw(Parser *p) { // term '//' factor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = term_rule(p)) && @@ -7037,7 +7037,7 @@ term_raw(Parser *p) { // term '%' factor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = term_rule(p)) && @@ -7066,7 +7066,7 @@ term_raw(Parser *p) { // term '@' factor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = term_rule(p)) && @@ -7129,7 +7129,7 @@ factor_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '+' factor expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 14)) && @@ -7155,7 +7155,7 @@ factor_rule(Parser *p) } { // '-' factor expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 15)) && @@ -7181,7 +7181,7 @@ factor_rule(Parser *p) } { // '~' factor expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 31)) && @@ -7242,7 +7242,7 @@ power_rule(Parser *p) { // await_primary '**' factor expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = await_primary_rule(p)) && @@ -7305,7 +7305,7 @@ await_primary_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // AWAIT primary expr_ty a; - void *await_var; + Token * await_var; if ( (await_var = _PyPegen_expect_token(p, AWAIT)) && @@ -7396,7 +7396,7 @@ primary_raw(Parser *p) { // primary '.' NAME expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = primary_rule(p)) && @@ -7451,8 +7451,8 @@ primary_raw(Parser *p) { // primary '(' arguments? ')' expr_ty a; void *b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = primary_rule(p)) && @@ -7483,8 +7483,8 @@ primary_raw(Parser *p) { // primary '[' slices ']' expr_ty a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = primary_rule(p)) && @@ -7615,7 +7615,7 @@ slice_rule(Parser *p) void *a; void *b; void *c; - void *literal; + Token * literal; if ( (a = expression_rule(p), 1) && @@ -7703,7 +7703,7 @@ atom_rule(Parser *p) p->mark = mark; } { // 'True' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 527)) ) @@ -7726,7 +7726,7 @@ atom_rule(Parser *p) p->mark = mark; } { // 'False' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 528)) ) @@ -7749,7 +7749,7 @@ atom_rule(Parser *p) p->mark = mark; } { // 'None' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 529)) ) @@ -7772,7 +7772,7 @@ atom_rule(Parser *p) p->mark = mark; } { // '__new_parser__' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 530)) ) @@ -7850,7 +7850,7 @@ atom_rule(Parser *p) p->mark = mark; } { // '...' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 52)) ) @@ -7928,8 +7928,8 @@ list_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '[' star_named_expressions? ']' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 9)) && @@ -7980,8 +7980,8 @@ listcomp_rule(Parser *p) { // '[' named_expression for_if_clauses ']' expr_ty a; asdl_seq* b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 9)) && @@ -8044,8 +8044,8 @@ tuple_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '(' [star_named_expression ',' star_named_expressions?] ')' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -8087,8 +8087,8 @@ group_rule(Parser *p) int mark = p->mark; { // '(' (yield_expr | named_expression) ')' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -8131,8 +8131,8 @@ genexp_rule(Parser *p) { // '(' expression for_if_clauses ')' expr_ty a; asdl_seq* b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -8195,8 +8195,8 @@ set_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '{' expressions_list '}' asdl_seq* a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 25)) && @@ -8247,8 +8247,8 @@ setcomp_rule(Parser *p) { // '{' expression for_if_clauses '}' expr_ty a; asdl_seq* b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 25)) && @@ -8311,8 +8311,8 @@ dict_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '{' kvpairs? '}' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 25)) && @@ -8363,8 +8363,8 @@ dictcomp_rule(Parser *p) { // '{' kvpair for_if_clauses '}' KeyValuePair* a; asdl_seq* b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 25)) && @@ -8441,7 +8441,7 @@ kvpair_rule(Parser *p) int mark = p->mark; { // '**' bitwise_or expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 35)) && @@ -8460,7 +8460,7 @@ kvpair_rule(Parser *p) { // expression ':' expression expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = expression_rule(p)) && @@ -8521,11 +8521,11 @@ for_if_clause_rule(Parser *p) int mark = p->mark; { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* expr_ty a; - void *async_var; + Token * async_var; expr_ty b; asdl_seq * c; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (async_var = _PyPegen_expect_token(p, ASYNC)) && @@ -8553,8 +8553,8 @@ for_if_clause_rule(Parser *p) expr_ty a; expr_ty b; asdl_seq * c; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (keyword = _PyPegen_expect_token(p, 517)) && @@ -8600,8 +8600,8 @@ yield_expr_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // 'yield' 'from' expression expr_ty a; - void *keyword; - void *keyword_1; + Token * keyword; + Token * keyword_1; if ( (keyword = _PyPegen_expect_token(p, 504)) && @@ -8629,7 +8629,7 @@ yield_expr_rule(Parser *p) } { // 'yield' star_expressions? void *a; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 504)) && @@ -8819,7 +8819,7 @@ kwargs_rule(Parser *p) { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ asdl_seq * a; asdl_seq * b; - void *literal; + Token * literal; if ( (a = _gather_113_rule(p)) && @@ -8883,7 +8883,7 @@ starred_expression_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '*' expression expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 16)) && @@ -8932,7 +8932,7 @@ kwarg_or_starred_rule(Parser *p) { // NAME '=' expression expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = _PyPegen_name_token(p)) && @@ -8998,7 +8998,7 @@ kwarg_or_double_starred_rule(Parser *p) { // NAME '=' expression expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = _PyPegen_name_token(p)) && @@ -9026,7 +9026,7 @@ kwarg_or_double_starred_rule(Parser *p) } { // '**' expression expr_ty a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 35)) && @@ -9182,7 +9182,7 @@ star_target_rule(Parser *p) UNUSED(start_col_offset); // Only used by EXTRA macro { // '*' (!'*' star_target) void *a; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 16)) && @@ -9209,7 +9209,7 @@ star_target_rule(Parser *p) { // t_primary '.' NAME !t_lookahead expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = t_primary_rule(p)) && @@ -9240,8 +9240,8 @@ star_target_rule(Parser *p) { // t_primary '[' slices ']' !t_lookahead expr_ty a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = t_primary_rule(p)) && @@ -9326,8 +9326,8 @@ star_atom_rule(Parser *p) } { // '(' star_target ')' expr_ty a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -9347,8 +9347,8 @@ star_atom_rule(Parser *p) } { // '(' star_targets_seq? ')' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -9376,8 +9376,8 @@ star_atom_rule(Parser *p) } { // '[' star_targets_seq? ']' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 9)) && @@ -9448,8 +9448,8 @@ inside_paren_ann_assign_target_rule(Parser *p) } { // '(' inside_paren_ann_assign_target ')' expr_ty a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -9494,7 +9494,7 @@ ann_assign_subscript_attribute_target_rule(Parser *p) { // t_primary '.' NAME !t_lookahead expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = t_primary_rule(p)) && @@ -9525,8 +9525,8 @@ ann_assign_subscript_attribute_target_rule(Parser *p) { // t_primary '[' slices ']' !t_lookahead expr_ty a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = t_primary_rule(p)) && @@ -9619,7 +9619,7 @@ del_target_rule(Parser *p) { // t_primary '.' NAME !t_lookahead expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = t_primary_rule(p)) && @@ -9650,8 +9650,8 @@ del_target_rule(Parser *p) { // t_primary '[' slices ']' !t_lookahead expr_ty a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = t_primary_rule(p)) && @@ -9732,8 +9732,8 @@ del_t_atom_rule(Parser *p) } { // '(' del_target ')' expr_ty a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -9753,8 +9753,8 @@ del_t_atom_rule(Parser *p) } { // '(' del_targets? ')' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -9782,8 +9782,8 @@ del_t_atom_rule(Parser *p) } { // '[' del_targets? ']' void *a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 9)) && @@ -9872,7 +9872,7 @@ target_rule(Parser *p) { // t_primary '.' NAME !t_lookahead expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = t_primary_rule(p)) && @@ -9903,8 +9903,8 @@ target_rule(Parser *p) { // t_primary '[' slices ']' !t_lookahead expr_ty a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = t_primary_rule(p)) && @@ -10001,7 +10001,7 @@ t_primary_raw(Parser *p) { // t_primary '.' NAME &t_lookahead expr_ty a; expr_ty b; - void *literal; + Token * literal; if ( (a = t_primary_rule(p)) && @@ -10032,8 +10032,8 @@ t_primary_raw(Parser *p) { // t_primary '[' slices ']' &t_lookahead expr_ty a; expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = t_primary_rule(p)) && @@ -10094,8 +10094,8 @@ t_primary_raw(Parser *p) { // t_primary '(' arguments? ')' &t_lookahead expr_ty a; void *b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (a = t_primary_rule(p)) && @@ -10157,7 +10157,7 @@ t_lookahead_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '(' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 7)) ) @@ -10168,7 +10168,7 @@ t_lookahead_rule(Parser *p) p->mark = mark; } { // '[' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 9)) ) @@ -10179,7 +10179,7 @@ t_lookahead_rule(Parser *p) p->mark = mark; } { // '.' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 23)) ) @@ -10228,8 +10228,8 @@ t_atom_rule(Parser *p) } { // '(' target ')' expr_ty a; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -10249,8 +10249,8 @@ t_atom_rule(Parser *p) } { // '(' targets? ')' void *b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -10278,8 +10278,8 @@ t_atom_rule(Parser *p) } { // '[' targets? ']' void *b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 9)) && @@ -10324,8 +10324,8 @@ incorrect_arguments_rule(Parser *p) int mark = p->mark; { // args ',' '*' expr_ty args_var; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (args_var = args_rule(p)) && @@ -10346,7 +10346,7 @@ incorrect_arguments_rule(Parser *p) { // expression for_if_clauses ',' [args | expression for_if_clauses] expr_ty expression_var; asdl_seq* for_if_clauses_var; - void *literal; + Token * literal; void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( @@ -10371,7 +10371,7 @@ incorrect_arguments_rule(Parser *p) { // args ',' args expr_ty a; expr_ty args_var; - void *literal; + Token * literal; if ( (a = args_rule(p)) && @@ -10406,7 +10406,7 @@ invalid_named_expression_rule(Parser *p) { // expression ':=' expression expr_ty a; expr_ty expression_var; - void *literal; + Token * literal; if ( (a = expression_rule(p)) && @@ -10444,7 +10444,7 @@ invalid_assignment_rule(Parser *p) int mark = p->mark; { // list ':' expr_ty list_var; - void *literal; + Token * literal; if ( (list_var = list_rule(p)) && @@ -10461,7 +10461,7 @@ invalid_assignment_rule(Parser *p) p->mark = mark; } { // tuple ':' - void *literal; + Token * literal; expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) @@ -10481,7 +10481,7 @@ invalid_assignment_rule(Parser *p) { // expression ':' expression ['=' annotated_rhs] expr_ty expression_var; expr_ty expression_var_1; - void *literal; + Token * literal; void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( @@ -10539,7 +10539,7 @@ invalid_block_rule(Parser *p) void * res = NULL; int mark = p->mark; { // NEWLINE !INDENT - void *newline_var; + Token * newline_var; if ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) && @@ -10573,7 +10573,7 @@ invalid_comprehension_rule(Parser *p) void *_tmp_133_var; expr_ty expression_var; asdl_seq* for_if_clauses_var; - void *literal; + Token * literal; if ( (_tmp_133_var = _tmp_133_rule(p)) && @@ -10644,11 +10644,11 @@ invalid_double_type_comments_rule(Parser *p) void * res = NULL; int mark = p->mark; { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT - void *indent_var; - void *newline_var; - void *newline_var_1; - void *type_comment_var; - void *type_comment_var_1; + Token * indent_var; + Token * newline_var; + Token * newline_var_1; + Token * type_comment_var; + Token * type_comment_var_1; if ( (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) && @@ -10693,7 +10693,7 @@ _loop0_1_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // NEWLINE - void *newline_var; + Token * newline_var; while ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) ) @@ -10742,7 +10742,7 @@ _loop0_2_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // NEWLINE - void *newline_var; + Token * newline_var; while ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) ) @@ -10792,7 +10792,7 @@ _loop0_4_rule(Parser *p) ssize_t n = 0; { // ',' expression expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -10877,7 +10877,7 @@ _loop0_6_rule(Parser *p) ssize_t n = 0; { // ',' expression expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -10962,7 +10962,7 @@ _loop0_8_rule(Parser *p) ssize_t n = 0; { // ',' expression expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -11047,7 +11047,7 @@ _loop0_10_rule(Parser *p) ssize_t n = 0; { // ',' expression expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -11185,7 +11185,7 @@ _loop0_13_rule(Parser *p) ssize_t n = 0; { // ';' small_stmt stmt_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 13)) && @@ -11261,7 +11261,7 @@ _tmp_14_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'import' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 513)) ) @@ -11272,7 +11272,7 @@ _tmp_14_rule(Parser *p) p->mark = mark; } { // 'from' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 514)) ) @@ -11297,7 +11297,7 @@ _tmp_15_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'def' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 522)) ) @@ -11308,7 +11308,7 @@ _tmp_15_rule(Parser *p) p->mark = mark; } { // '@' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 49)) ) @@ -11319,7 +11319,7 @@ _tmp_15_rule(Parser *p) p->mark = mark; } { // ASYNC - void *async_var; + Token * async_var; if ( (async_var = _PyPegen_expect_token(p, ASYNC)) ) @@ -11344,7 +11344,7 @@ _tmp_16_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'class' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 523)) ) @@ -11355,7 +11355,7 @@ _tmp_16_rule(Parser *p) p->mark = mark; } { // '@' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 49)) ) @@ -11380,7 +11380,7 @@ _tmp_17_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'with' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 519)) ) @@ -11391,7 +11391,7 @@ _tmp_17_rule(Parser *p) p->mark = mark; } { // ASYNC - void *async_var; + Token * async_var; if ( (async_var = _PyPegen_expect_token(p, ASYNC)) ) @@ -11416,7 +11416,7 @@ _tmp_18_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'for' - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 517)) ) @@ -11427,7 +11427,7 @@ _tmp_18_rule(Parser *p) p->mark = mark; } { // ASYNC - void *async_var; + Token * async_var; if ( (async_var = _PyPegen_expect_token(p, ASYNC)) ) @@ -11453,7 +11453,7 @@ _tmp_19_rule(Parser *p) int mark = p->mark; { // '=' annotated_rhs expr_ty d; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 22)) && @@ -11485,8 +11485,8 @@ _tmp_20_rule(Parser *p) int mark = p->mark; { // '(' inside_paren_ann_assign_target ')' expr_ty b; - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 7)) && @@ -11531,7 +11531,7 @@ _tmp_21_rule(Parser *p) int mark = p->mark; { // '=' annotated_rhs expr_ty d; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 22)) && @@ -11696,7 +11696,7 @@ _loop0_26_rule(Parser *p) ssize_t n = 0; { // ',' NAME expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -11781,7 +11781,7 @@ _loop0_28_rule(Parser *p) ssize_t n = 0; { // ',' NAME expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -11857,7 +11857,7 @@ _tmp_29_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' expression - void *literal; + Token * literal; expr_ty z; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -12000,7 +12000,7 @@ _loop0_33_rule(Parser *p) ssize_t n = 0; { // ',' import_from_as_name alias_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -12076,7 +12076,7 @@ _tmp_34_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'as' NAME - void *keyword; + Token * keyword; expr_ty z; if ( (keyword = _PyPegen_expect_token(p, 531)) @@ -12117,7 +12117,7 @@ _loop0_36_rule(Parser *p) ssize_t n = 0; { // ',' dotted_as_name alias_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -12193,7 +12193,7 @@ _tmp_37_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'as' NAME - void *keyword; + Token * keyword; expr_ty z; if ( (keyword = _PyPegen_expect_token(p, 531)) @@ -12234,7 +12234,7 @@ _loop0_39_rule(Parser *p) ssize_t n = 0; { // ',' with_item withitem_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -12319,7 +12319,7 @@ _loop0_41_rule(Parser *p) ssize_t n = 0; { // ',' with_item withitem_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -12404,7 +12404,7 @@ _loop0_43_rule(Parser *p) ssize_t n = 0; { // ',' with_item withitem_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -12489,7 +12489,7 @@ _loop0_45_rule(Parser *p) ssize_t n = 0; { // ',' with_item withitem_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -12565,7 +12565,7 @@ _tmp_46_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'as' target - void *keyword; + Token * keyword; expr_ty t; if ( (keyword = _PyPegen_expect_token(p, 531)) @@ -12650,7 +12650,7 @@ _tmp_48_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'as' target - void *keyword; + Token * keyword; expr_ty z; if ( (keyword = _PyPegen_expect_token(p, 531)) @@ -12682,7 +12682,7 @@ _tmp_49_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'from' expression - void *keyword; + Token * keyword; expr_ty z; if ( (keyword = _PyPegen_expect_token(p, 514)) @@ -12714,7 +12714,7 @@ _tmp_50_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '->' expression - void *literal; + Token * literal; expr_ty z; if ( (literal = _PyPegen_expect_token(p, 51)) @@ -12746,7 +12746,7 @@ _tmp_51_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '->' expression - void *literal; + Token * literal; expr_ty z; if ( (literal = _PyPegen_expect_token(p, 51)) @@ -12778,8 +12778,8 @@ _tmp_52_rule(Parser *p) void * res = NULL; int mark = p->mark; { // NEWLINE INDENT - void *indent_var; - void *newline_var; + Token * indent_var; + Token * newline_var; if ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) && @@ -13573,8 +13573,8 @@ _tmp_68_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '(' arguments? ')' - void *literal; - void *literal_1; + Token * literal; + Token * literal_1; void *z; if ( (literal = _PyPegen_expect_token(p, 7)) @@ -13617,7 +13617,7 @@ _loop0_70_rule(Parser *p) ssize_t n = 0; { // ',' star_expression expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -13755,7 +13755,7 @@ _loop0_73_rule(Parser *p) ssize_t n = 0; { // ',' star_named_expression expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -13884,7 +13884,7 @@ _tmp_75_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_plain_names - void *literal; + Token * literal; asdl_seq* x; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -13916,7 +13916,7 @@ _tmp_76_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_names_with_default - void *literal; + Token * literal; asdl_seq* y; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -13948,7 +13948,7 @@ _tmp_77_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_star_etc? - void *literal; + Token * literal; void *z; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -13980,7 +13980,7 @@ _tmp_78_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_names_with_default - void *literal; + Token * literal; asdl_seq* y; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -14012,7 +14012,7 @@ _tmp_79_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_star_etc? - void *literal; + Token * literal; void *z; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -14044,7 +14044,7 @@ _tmp_80_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_names_with_default - void *literal; + Token * literal; asdl_seq* y; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -14076,7 +14076,7 @@ _tmp_81_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_star_etc? - void *literal; + Token * literal; void *z; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -14108,7 +14108,7 @@ _tmp_82_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ',' lambda_star_etc? - void *literal; + Token * literal; void *z; if ( (literal = _PyPegen_expect_token(p, 12)) @@ -14140,7 +14140,7 @@ _tmp_83_rule(Parser *p) void * res = NULL; int mark = p->mark; { // lambda_plain_names ',' - void *literal; + Token * literal; asdl_seq* n; if ( (n = lambda_plain_names_rule(p)) @@ -14222,7 +14222,7 @@ _tmp_85_rule(Parser *p) int mark = p->mark; { // ',' lambda_kwds arg_ty d; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -14307,7 +14307,7 @@ _tmp_87_rule(Parser *p) int mark = p->mark; { // ',' lambda_kwds arg_ty d; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -14339,7 +14339,7 @@ _tmp_88_rule(Parser *p) int mark = p->mark; { // '=' expression expr_ty e; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 22)) && @@ -14379,7 +14379,7 @@ _loop0_90_rule(Parser *p) ssize_t n = 0; { // ',' lambda_name_with_default NameDefaultPair* elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -14464,7 +14464,7 @@ _loop0_92_rule(Parser *p) ssize_t n = 0; { // ',' (lambda_plain_name !'=') void *elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -14699,7 +14699,7 @@ _tmp_96_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '!=' - void *tok; + Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) ) @@ -14737,7 +14737,7 @@ _loop0_98_rule(Parser *p) ssize_t n = 0; { // ',' slice expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -14814,7 +14814,7 @@ _tmp_99_rule(Parser *p) int mark = p->mark; { // ':' expression? void *d; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 11)) && @@ -15039,7 +15039,7 @@ _tmp_104_rule(Parser *p) void * res = NULL; int mark = p->mark; { // star_named_expression ',' star_named_expressions? - void *literal; + Token * literal; expr_ty y; void *z; if ( @@ -15119,7 +15119,7 @@ _loop0_107_rule(Parser *p) ssize_t n = 0; { // ',' kvpair KeyValuePair* elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15347,7 +15347,7 @@ _tmp_111_rule(Parser *p) int mark = p->mark; { // ',' args expr_ty c; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15379,7 +15379,7 @@ _tmp_112_rule(Parser *p) int mark = p->mark; { // ',' args expr_ty c; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15419,7 +15419,7 @@ _loop0_114_rule(Parser *p) ssize_t n = 0; { // ',' kwarg_or_starred KeywordOrStarred* elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15504,7 +15504,7 @@ _loop0_116_rule(Parser *p) ssize_t n = 0; { // ',' kwarg_or_double_starred KeywordOrStarred* elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15589,7 +15589,7 @@ _loop0_118_rule(Parser *p) ssize_t n = 0; { // ',' kwarg_or_starred KeywordOrStarred* elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15674,7 +15674,7 @@ _loop0_120_rule(Parser *p) ssize_t n = 0; { // ',' kwarg_or_double_starred KeywordOrStarred* elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15808,7 +15808,7 @@ _loop0_123_rule(Parser *p) ssize_t n = 0; { // ',' star_target expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -15920,7 +15920,7 @@ _loop0_126_rule(Parser *p) ssize_t n = 0; { // ',' del_target expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -16005,7 +16005,7 @@ _loop0_128_rule(Parser *p) ssize_t n = 0; { // ',' target expr_ty elem; - void *literal; + Token * literal; while ( (literal = _PyPegen_expect_token(p, 12)) && @@ -16121,7 +16121,7 @@ _tmp_130_rule(Parser *p) int mark = p->mark; { // '=' annotated_rhs expr_ty annotated_rhs_var; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 22)) && @@ -16148,7 +16148,7 @@ _tmp_131_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '=' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 22)) ) @@ -16220,7 +16220,7 @@ _tmp_133_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '[' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 9)) ) @@ -16231,7 +16231,7 @@ _tmp_133_rule(Parser *p) p->mark = mark; } { // '(' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 7)) ) @@ -16242,7 +16242,7 @@ _tmp_133_rule(Parser *p) p->mark = mark; } { // '{' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 25)) ) @@ -16352,7 +16352,7 @@ _tmp_136_rule(Parser *p) void * res = NULL; int mark = p->mark; { // star_targets '=' - void *literal; + Token * literal; expr_ty z; if ( (z = star_targets_rule(p)) @@ -16384,7 +16384,7 @@ _tmp_137_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '.' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 23)) ) @@ -16395,7 +16395,7 @@ _tmp_137_rule(Parser *p) p->mark = mark; } { // '...' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 52)) ) @@ -16420,7 +16420,7 @@ _tmp_138_rule(Parser *p) void * res = NULL; int mark = p->mark; { // '.' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 23)) ) @@ -16431,7 +16431,7 @@ _tmp_138_rule(Parser *p) p->mark = mark; } { // '...' - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 52)) ) @@ -16457,8 +16457,8 @@ _tmp_139_rule(Parser *p) int mark = p->mark; { // '@' named_expression NEWLINE expr_ty f; - void *literal; - void *newline_var; + Token * literal; + Token * newline_var; if ( (literal = _PyPegen_expect_token(p, 49)) && @@ -16492,7 +16492,7 @@ _tmp_140_rule(Parser *p) int mark = p->mark; { // ',' star_expression expr_ty c; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -16524,7 +16524,7 @@ _tmp_141_rule(Parser *p) int mark = p->mark; { // ',' expression expr_ty c; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && @@ -16583,7 +16583,7 @@ _tmp_143_rule(Parser *p) int mark = p->mark; { // 'or' conjunction expr_ty c; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 532)) && @@ -16615,7 +16615,7 @@ _tmp_144_rule(Parser *p) int mark = p->mark; { // 'and' inversion expr_ty c; - void *keyword; + Token * keyword; if ( (keyword = _PyPegen_expect_token(p, 533)) && @@ -16646,7 +16646,7 @@ _tmp_145_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'if' disjunction - void *keyword; + Token * keyword; expr_ty z; if ( (keyword = _PyPegen_expect_token(p, 510)) @@ -16678,7 +16678,7 @@ _tmp_146_rule(Parser *p) void * res = NULL; int mark = p->mark; { // 'if' disjunction - void *keyword; + Token * keyword; expr_ty z; if ( (keyword = _PyPegen_expect_token(p, 510)) @@ -16711,7 +16711,7 @@ _tmp_147_rule(Parser *p) int mark = p->mark; { // ',' star_target expr_ty c; - void *literal; + Token * literal; if ( (literal = _PyPegen_expect_token(p, 12)) && diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index a59da2ffae8e1..6c77f43991bbe 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -65,9 +65,9 @@ class FunctionCall: function: str arguments: Optional[List[Any]] = None assigned_variable: Optional[str] = None + return_type: Optional[str] = None nodetype: Optional[NodeTypes] = None force_true: bool = False - metadata: Dict[str, Any] = field(default_factory=dict) def __str__(self) -> str: parts = [] @@ -101,6 +101,7 @@ def keyword_helper(self, keyword: str) -> FunctionCall: assigned_variable="keyword", function="_PyPegen_expect_token", arguments=["p", self.keyword_cache[keyword]], + return_type="Token *", nodetype=NodeTypes.KEYWORD, ) @@ -113,21 +114,26 @@ def visit_NameLeaf(self, node: NameLeaf) -> FunctionCall: function=f"_PyPegen_{name.lower()}_token", arguments=["p"], nodetype=BASE_NODETYPES[name], - metadata={"rulename": name.lower()}, + return_type="expr_ty", ) return FunctionCall( assigned_variable=f"{name.lower()}_var", function=f"_PyPegen_expect_token", arguments=["p", name], nodetype=NodeTypes.GENERIC_TOKEN, - metadata={"rulename": name.lower()}, + return_type="Token *", ) + type = None + rule = self.gen.all_rules.get(name.lower()) + if rule is not None: + type = "asdl_seq *" if rule.is_loop() or rule.is_gather() else rule.type + return FunctionCall( assigned_variable=f"{name}_var", function=f"{name}_rule", arguments=["p"], - metadata={"rulename": name.lower()}, + return_type=type, ) def visit_StringLeaf(self, node: StringLeaf) -> FunctionCall: @@ -142,6 +148,7 @@ def visit_StringLeaf(self, node: StringLeaf) -> FunctionCall: function=f"_PyPegen_expect_token", arguments=["p", type], nodetype=NodeTypes.GENERIC_TOKEN, + return_type="Token *", ) def visit_Rhs(self, node: Rhs) -> FunctionCall: @@ -160,10 +167,7 @@ def can_we_inline(node: Rhs) -> int: else: name = self.gen.name_node(node) self.cache[node] = FunctionCall( - assigned_variable=f"{name}_var", - function=f"{name}_rule", - arguments=["p"], - metadata={"rulename": name}, + assigned_variable=f"{name}_var", function=f"{name}_rule", arguments=["p"], ) return self.cache[node] @@ -179,16 +183,19 @@ def lookahead_call_helper(self, node: Lookahead, positive: int) -> FunctionCall: return FunctionCall( function=f"_PyPegen_lookahead_with_name", arguments=[positive, call.function, *call.arguments], + return_type="int", ) elif call.nodetype in {NodeTypes.GENERIC_TOKEN, NodeTypes.KEYWORD}: return FunctionCall( function=f"_PyPegen_lookahead_with_int", arguments=[positive, call.function, *call.arguments], + return_type="int", ) else: return FunctionCall( function=f"_PyPegen_lookahead", arguments=[positive, call.function, *call.arguments], + return_type="int", ) def visit_PositiveLookahead(self, node: PositiveLookahead) -> FunctionCall: @@ -214,7 +221,7 @@ def visit_Repeat0(self, node: Repeat0) -> FunctionCall: assigned_variable=f"{name}_var", function=f"{name}_rule", arguments=["p"], - metadata={"rulename": name}, + return_type="asdl_seq *", ) return self.cache[node] @@ -226,7 +233,7 @@ def visit_Repeat1(self, node: Repeat1) -> FunctionCall: assigned_variable=f"{name}_var", function=f"{name}_rule", arguments=["p"], - metadata={"rulename": name}, + return_type="asdl_seq *", ) return self.cache[node] @@ -238,7 +245,7 @@ def visit_Gather(self, node: Gather) -> FunctionCall: assigned_variable=f"{name}_var", function=f"{name}_rule", arguments=["p"], - metadata={"rulename": name}, + return_type="asdl_seq *", ) return self.cache[node] @@ -247,7 +254,10 @@ def visit_Group(self, node: Group) -> FunctionCall: def visit_Cut(self, node: Cut) -> FunctionCall: return FunctionCall( - assigned_variable="cut_var", function="1", nodetype=NodeTypes.CUT_OPERATOR + assigned_variable="cut_var", + return_type="int", + function="1", + nodetype=NodeTypes.CUT_OPERATOR, ) @@ -701,24 +711,4 @@ def collect_vars(self, node: Alt) -> Dict[Optional[str], Optional[str]]: def add_var(self, node: NamedItem) -> Tuple[Optional[str], Optional[str]]: call = self.callmakervisitor.visit(node.item) - if not call.assigned_variable: - return None, None - if call.nodetype == NodeTypes.CUT_OPERATOR: - return call.assigned_variable, "int" - - name = call.assigned_variable - rulename = call.metadata.get("rulename") - - type: Optional[str] = None - - assert self.all_rules is not None - if rulename and rulename in self.all_rules: - rule = self.all_rules.get(rulename) - if rule.is_loop() or rule.is_gather(): - type = "asdl_seq *" - else: - type = rule.type - elif call.nodetype in BASE_NODETYPES.values(): - type = "expr_ty" - - return self.dedupe(node.name if node.name else call.assigned_variable), type + return self.dedupe(node.name if node.name else call.assigned_variable), call.return_type diff --git a/Tools/peg_generator/pegen/parser_generator.py b/Tools/peg_generator/pegen/parser_generator.py index 3f6cdbe409d56..b92df2267762d 100644 --- a/Tools/peg_generator/pegen/parser_generator.py +++ b/Tools/peg_generator/pegen/parser_generator.py @@ -47,7 +47,7 @@ def __init__(self, grammar: Grammar, file: Optional[IO[Text]]): self.todo = self.rules.copy() # Rules to generate self.counter = 0 # For name_rule()/name_loop() self.keyword_counter = 499 # For keyword_type() - self.all_rules: Optional[Dict[str, Rule]] = None # Rules + temporal rules + self.all_rules: Dict[str, Rule] = {} # Rules + temporal rules self._local_variable_stack: List[List[str]] = [] @contextlib.contextmanager @@ -87,13 +87,13 @@ def collect_todo(self) -> None: done: Set[str] = set() while True: alltodo = list(self.todo) + self.all_rules.update(self.todo) todo = [i for i in alltodo if i not in done] if not todo: break for rulename in todo: self.todo[rulename].collect_todo(self) done = set(alltodo) - self.all_rules = self.todo.copy() def keyword_type(self) -> int: self.keyword_counter += 1 From webhook-mailer at python.org Fri May 1 08:15:39 2020 From: webhook-mailer at python.org (Dong-hee Na) Date: Fri, 01 May 2020 12:15:39 -0000 Subject: [Python-checkins] bpo-32494: Use gdbm_count for dbm_length if possible (GH-19814) Message-ID: https://github.com/python/cpython/commit/8727664557cd44dcd00612ccba816942e8f885ab commit: 8727664557cd44dcd00612ccba816942e8f885ab branch: master author: Dong-hee Na committer: GitHub date: 2020-05-01T14:15:35+02:00 summary: bpo-32494: Use gdbm_count for dbm_length if possible (GH-19814) files: A Misc/NEWS.d/next/Library/2020-04-30-22-25-08.bpo-32494.1xaU5l.rst M Modules/_gdbmmodule.c diff --git a/Misc/NEWS.d/next/Library/2020-04-30-22-25-08.bpo-32494.1xaU5l.rst b/Misc/NEWS.d/next/Library/2020-04-30-22-25-08.bpo-32494.1xaU5l.rst new file mode 100644 index 0000000000000..3989700c5cd83 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-04-30-22-25-08.bpo-32494.1xaU5l.rst @@ -0,0 +1,2 @@ +Update :mod:`dbm.gnu` to use gdbm_count if possible when calling +:func:`len`. Patch by Dong-hee Na. diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c index 7a9649b54119b..dd4c6b16f745c 100644 --- a/Modules/_gdbmmodule.c +++ b/Modules/_gdbmmodule.c @@ -36,7 +36,7 @@ values() methods are not supported."); typedef struct { PyObject_HEAD - int di_size; /* -1 means recompute */ + Py_ssize_t di_size; /* -1 means recompute */ GDBM_FILE di_dbm; } dbmobject; @@ -102,19 +102,39 @@ dbm_length(dbmobject *dp) return -1; } if (dp->di_size < 0) { +#if GDBM_VERSION_MAJOR >= 1 && GDBM_VERSION_MINOR >= 11 + errno = 0; + gdbm_count_t count; + if (gdbm_count(dp->di_dbm, &count) == -1) { + if (errno != 0) { + PyErr_SetFromErrno(DbmError); + } + else { + PyErr_SetString(DbmError, gdbm_strerror(gdbm_errno)); + } + return -1; + } + if (count > PY_SSIZE_T_MAX) { + PyErr_SetString(PyExc_OverflowError, "count exceeds PY_SSIZE_T_MAX"); + return -1; + } + dp->di_size = count; +#else datum key,okey; - int size; okey.dsize=0; okey.dptr=NULL; - size = 0; - for (key=gdbm_firstkey(dp->di_dbm); key.dptr; + Py_ssize_t size = 0; + for (key = gdbm_firstkey(dp->di_dbm); key.dptr; key = gdbm_nextkey(dp->di_dbm,okey)) { size++; - if(okey.dsize) free(okey.dptr); + if (okey.dsize) { + free(okey.dptr); + } okey=key; } dp->di_size = size; +#endif } return dp->di_size; } From webhook-mailer at python.org Fri May 1 09:13:56 2020 From: webhook-mailer at python.org (Batuhan Taskaya) Date: Fri, 01 May 2020 13:13:56 -0000 Subject: [Python-checkins] bpo-40334: Improve column offsets for thrown syntax errors by Pegen (GH-19782) Message-ID: https://github.com/python/cpython/commit/76c1b4d5c5a610c09943e1ee7ae18f1957804730 commit: 76c1b4d5c5a610c09943e1ee7ae18f1957804730 branch: master author: Batuhan Taskaya committer: GitHub date: 2020-05-01T14:13:43+01:00 summary: bpo-40334: Improve column offsets for thrown syntax errors by Pegen (GH-19782) files: M Grammar/python.gram M Lib/test/test_cmd_line_script.py M Lib/test/test_exceptions.py M Parser/pegen/parse.c M Parser/pegen/pegen.c M Parser/pegen/pegen.h diff --git a/Grammar/python.gram b/Grammar/python.gram index 38107fcf7354c..3813d8845be24 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -609,7 +609,7 @@ invalid_assignment: | expression ':' expression ['=' annotated_rhs] { RAISE_SYNTAX_ERROR("illegal target for annotation") } | a=expression ('=' | augassign) (yield_expr | star_expressions) { - RAISE_SYNTAX_ERROR("cannot assign to %s", _PyPegen_get_expr_name(a)) } + RAISE_SYNTAX_ERROR_NO_COL_OFFSET("cannot assign to %s", _PyPegen_get_expr_name(a)) } invalid_block: | NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") } invalid_comprehension: diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py index f0130e376aec4..1fc9500738f35 100644 --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -599,7 +599,7 @@ def test_syntaxerror_unindented_caret_position(self): exitcode, stdout, stderr = assert_python_failure(script_name) text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() # Confirm that the caret is located under the first 1 character - self.assertIn("\n 1 + 1 = 2\n ^", text) + self.assertIn("\n 1 + 1 = 2\n ^", text) def test_syntaxerror_indented_caret_position(self): script = textwrap.dedent("""\ @@ -611,7 +611,7 @@ def test_syntaxerror_indented_caret_position(self): exitcode, stdout, stderr = assert_python_failure(script_name) text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() # Confirm that the caret is located under the first 1 character - self.assertIn("\n 1 + 1 = 2\n ^", text) + self.assertIn("\n 1 + 1 = 2\n ^", text) # Try the same with a form feed at the start of the indented line script = ( @@ -622,7 +622,7 @@ def test_syntaxerror_indented_caret_position(self): exitcode, stdout, stderr = assert_python_failure(script_name) text = io.TextIOWrapper(io.BytesIO(stderr), "ascii").read() self.assertNotIn("\f", text) - self.assertIn("\n 1 + 1 = 2\n ^", text) + self.assertIn("\n 1 + 1 = 2\n ^", text) def test_syntaxerror_multi_line_fstring(self): script = 'foo = f"""{}\nfoo"""\n' diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index a207fb48632f9..354b3f4843718 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -178,19 +178,19 @@ def ckmsg(src, msg, exception=SyntaxError): s = '''if True:\n print()\n\texec "mixed tabs and spaces"''' ckmsg(s, "inconsistent use of tabs and spaces in indentation", TabError) - @support.skip_if_new_parser("Pegen column offsets might be different") - def testSyntaxErrorOffset(self): - def check(src, lineno, offset, encoding='utf-8'): - with self.assertRaises(SyntaxError) as cm: - compile(src, '', 'exec') - self.assertEqual(cm.exception.lineno, lineno) - self.assertEqual(cm.exception.offset, offset) - if cm.exception.text is not None: - if not isinstance(src, str): - src = src.decode(encoding, 'replace') - line = src.split('\n')[lineno-1] - self.assertIn(line, cm.exception.text) + def check(self, src, lineno, offset, encoding='utf-8'): + with self.assertRaises(SyntaxError) as cm: + compile(src, '', 'exec') + self.assertEqual(cm.exception.lineno, lineno) + self.assertEqual(cm.exception.offset, offset) + if cm.exception.text is not None: + if not isinstance(src, str): + src = src.decode(encoding, 'replace') + line = src.split('\n')[lineno-1] + self.assertIn(line, cm.exception.text) + def testSyntaxErrorOffset(self): + check = self.check check('def fact(x):\n\treturn x!\n', 2, 10) check('1 +\n', 1, 4) check('def spam():\n print(1)\n print(2)', 3, 10) @@ -238,20 +238,20 @@ def baz(): check('nonlocal x', 1, 1) check('def f():\n global x\n nonlocal x', 2, 3) - # Errors thrown by ast.c - check('for 1 in []: pass', 1, 5) - check('def f(*):\n pass', 1, 7) - check('[*x for x in xs]', 1, 2) - check('def f():\n x, y: int', 2, 3) - check('(yield i) = 2', 1, 1) - check('foo(x for x in range(10), 100)', 1, 5) - check('foo(1=2)', 1, 5) - # Errors thrown by future.c check('from __future__ import doesnt_exist', 1, 1) check('from __future__ import braces', 1, 1) check('x=1\nfrom __future__ import division', 2, 1) + @support.skip_if_new_parser("Pegen column offsets might be different") + def testSyntaxErrorOffsetCustom(self): + self.check('for 1 in []: pass', 1, 5) + self.check('def f(*):\n pass', 1, 7) + self.check('[*x for x in xs]', 1, 2) + self.check('def f():\n x, y: int', 2, 3) + self.check('(yield i) = 2', 1, 1) + self.check('foo(x for x in range(10), 100)', 1, 5) + self.check('foo(1=2)', 1, 5) @cpython_only def testSettingException(self): diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 2be5e384ae532..33c92c232c54a 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -10515,7 +10515,7 @@ invalid_assignment_rule(Parser *p) (_tmp_132_var = _tmp_132_rule(p)) ) { - res = RAISE_SYNTAX_ERROR ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) ); + res = RAISE_SYNTAX_ERROR_NO_COL_OFFSET ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) ); if (res == NULL && PyErr_Occurred()) { p->error_indicator = 1; return NULL; diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index 40c09ffcc3a64..a7add8fbb144e 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -145,11 +145,15 @@ byte_offset_to_character_offset(PyObject *line, int col_offset) if (!str) { return 0; } - PyObject *text = PyUnicode_DecodeUTF8(str, col_offset, NULL); + PyObject *text = PyUnicode_DecodeUTF8(str, col_offset, "replace"); if (!text) { return 0; } Py_ssize_t size = PyUnicode_GET_LENGTH(text); + str = PyUnicode_AsUTF8(text); + if (str != NULL && (int)strlen(str) == col_offset) { + size = strlen(str); + } Py_DECREF(text); return size; } @@ -297,66 +301,21 @@ raise_tokenizer_init_error(PyObject *filename) } static inline PyObject * -get_error_line(char *buffer) -{ - char *newline = strchr(buffer, '\n'); - if (newline) { - return PyUnicode_FromStringAndSize(buffer, newline - buffer); - } - else { - return PyUnicode_FromString(buffer); - } -} - -static int -tokenizer_error_with_col_offset(Parser *p, PyObject *errtype, const char *errmsg) +get_error_line(char *buffer, int is_file) { - PyObject *errstr = NULL; - PyObject *value = NULL; - size_t col_number = -1; - - errstr = PyUnicode_FromString(errmsg); - if (!errstr) { - return -1; - } - - PyObject *loc = NULL; - if (p->start_rule == Py_file_input) { - loc = PyErr_ProgramTextObject(p->tok->filename, p->tok->lineno); - } - if (!loc) { - loc = get_error_line(p->tok->buf); + const char *newline; + if (is_file) { + newline = strrchr(buffer, '\n'); + } else { + newline = strchr(buffer, '\n'); } - if (loc) { - col_number = p->tok->cur - p->tok->buf; + if (newline) { + return PyUnicode_DecodeUTF8(buffer, newline - buffer, "replace"); } else { - Py_INCREF(Py_None); - loc = Py_None; + return PyUnicode_DecodeUTF8(buffer, strlen(buffer), "replace"); } - - PyObject *tmp = Py_BuildValue("(OiiN)", p->tok->filename, p->tok->lineno, - col_number, loc); - if (!tmp) { - goto error; - } - - value = PyTuple_Pack(2, errstr, tmp); - Py_DECREF(tmp); - if (!value) { - goto error; - } - PyErr_SetObject(errtype, value); - - Py_XDECREF(value); - Py_XDECREF(errstr); - return -1; - -error: - Py_XDECREF(errstr); - Py_XDECREF(loc); - return -1; } static int @@ -376,20 +335,20 @@ tokenizer_error(Parser *p) msg = "invalid character in identifier"; break; case E_BADPREFIX: - return tokenizer_error_with_col_offset(p, - errtype, "invalid string prefix"); + RAISE_SYNTAX_ERROR("invalid string prefix"); + return -1; case E_EOFS: - return tokenizer_error_with_col_offset(p, - errtype, "EOF while scanning triple-quoted string literal"); + RAISE_SYNTAX_ERROR("EOF while scanning triple-quoted string literal"); + return -1; case E_EOLS: - return tokenizer_error_with_col_offset(p, - errtype, "EOL while scanning string literal"); + RAISE_SYNTAX_ERROR("EOL while scanning string literal"); + return -1; case E_EOF: - return tokenizer_error_with_col_offset(p, - errtype, "unexpected EOF while parsing"); + RAISE_SYNTAX_ERROR("unexpected EOF while parsing"); + return -1; case E_DEDENT: - return tokenizer_error_with_col_offset(p, - PyExc_IndentationError, "unindent does not match any outer indentation level"); + RAISE_INDENTATION_ERROR("unindent does not match any outer indentation level"); + return -1; case E_INTR: if (!PyErr_Occurred()) { PyErr_SetNone(PyExc_KeyboardInterrupt); @@ -421,14 +380,14 @@ tokenizer_error(Parser *p) } void * -_PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...) +_PyPegen_raise_error(Parser *p, PyObject *errtype, int with_col_number, const char *errmsg, ...) { PyObject *value = NULL; PyObject *errstr = NULL; PyObject *loc = NULL; PyObject *tmp = NULL; Token *t = p->tokens[p->fill - 1]; - Py_ssize_t col_number = 0; + Py_ssize_t col_number = !with_col_number; va_list va; va_start(va, errmsg); @@ -443,14 +402,20 @@ _PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...) } if (!loc) { - loc = get_error_line(p->tok->buf); + loc = get_error_line(p->tok->buf, p->start_rule == Py_file_input); } - if (loc) { - int col_offset = t->col_offset == -1 ? 0 : t->col_offset; - col_number = byte_offset_to_character_offset(loc, col_offset) + 1; + if (loc && with_col_number) { + int col_offset; + if (t->col_offset == -1) { + col_offset = Py_SAFE_DOWNCAST(p->tok->cur - p->tok->buf, + intptr_t, int); + } else { + col_offset = t->col_offset + 1; + } + col_number = byte_offset_to_character_offset(loc, col_offset); } - else { + else if (!loc) { Py_INCREF(Py_None); loc = Py_None; } @@ -632,14 +597,6 @@ _PyPegen_fill_token(Parser *p) type = PyTokenizer_Get(p->tok, &start, &end); } - if (type == ERRORTOKEN) { - if (p->tok->done == E_DECODE) { - return raise_decode_error(p); - } - else { - return tokenizer_error(p); - } - } if (type == ENDMARKER && p->start_rule == Py_single_input && p->parsing_started) { type = NEWLINE; /* Add an extra newline */ p->parsing_started = 0; @@ -700,6 +657,16 @@ _PyPegen_fill_token(Parser *p) t->end_col_offset = p->tok->lineno == 1 ? p->starting_col_offset + end_col_offset : end_col_offset; p->fill += 1; + + if (type == ERRORTOKEN) { + if (p->tok->done == E_DECODE) { + return raise_decode_error(p); + } + else { + return tokenizer_error(p); + } + } + return 0; } diff --git a/Parser/pegen/pegen.h b/Parser/pegen/pegen.h index 1620f92609472..cbe6f197ac742 100644 --- a/Parser/pegen/pegen.h +++ b/Parser/pegen/pegen.h @@ -126,14 +126,15 @@ expr_ty _PyPegen_name_token(Parser *p); expr_ty _PyPegen_number_token(Parser *p); void *_PyPegen_string_token(Parser *p); const char *_PyPegen_get_expr_name(expr_ty); -void *_PyPegen_raise_error(Parser *p, PyObject *, const char *errmsg, ...); +void *_PyPegen_raise_error(Parser *p, PyObject *errtype, int with_col_number, const char *errmsg, ...); void *_PyPegen_dummy_name(Parser *p, ...); #define UNUSED(expr) do { (void)(expr); } while (0) #define EXTRA_EXPR(head, tail) head->lineno, head->col_offset, tail->end_lineno, tail->end_col_offset, p->arena #define EXTRA start_lineno, start_col_offset, end_lineno, end_col_offset, p->arena -#define RAISE_SYNTAX_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_SyntaxError, msg, ##__VA_ARGS__) -#define RAISE_INDENTATION_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_IndentationError, msg, ##__VA_ARGS__) +#define RAISE_SYNTAX_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_SyntaxError, 1, msg, ##__VA_ARGS__) +#define RAISE_INDENTATION_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_IndentationError, 1, msg, ##__VA_ARGS__) +#define RAISE_SYNTAX_ERROR_NO_COL_OFFSET(msg, ...) _PyPegen_raise_error(p, PyExc_SyntaxError, 0, msg, ##__VA_ARGS__) Py_LOCAL_INLINE(void *) CHECK_CALL(Parser *p, void *result) @@ -190,8 +191,8 @@ INVALID_VERSION_CHECK(Parser *p, int version, char *msg, void *node) } if (p->feature_version < version) { p->error_indicator = 1; - return _PyPegen_raise_error(p, PyExc_SyntaxError, "%s only supported in Python 3.%i and greater", - msg, version); + return RAISE_SYNTAX_ERROR("%s only supported in Python 3.%i and greater", + msg, version); } return node; } From webhook-mailer at python.org Fri May 1 10:18:31 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 14:18:31 -0000 Subject: [Python-checkins] [3.8] bpo-39562: Prevent collision of future and compiler flags (GH-19230) (GH-19835) Message-ID: https://github.com/python/cpython/commit/5055c274c6e4f2bb8025910dedf0ff89f4bdd170 commit: 5055c274c6e4f2bb8025910dedf0ff89f4bdd170 branch: 3.8 author: Pablo Galindo committer: GitHub date: 2020-05-01T07:18:27-07:00 summary: [3.8] bpo-39562: Prevent collision of future and compiler flags (GH-19230) (GH-19835) The constant values of future flags in the __future__ module is updated in order to prevent collision with compiler flags. Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing with CO_FUTURE_DIVISION.. (cherry picked from commit 4454057269b995341b04d13f0bf97f96080f27d0) Co-authored-by: Batuhan Ta?kaya files: A Misc/NEWS.d/next/Core and Builtins/2020-05-01-14-58-16.bpo-39562.KCsX8n.rst M Doc/whatsnew/3.8.rst M Include/code.h M Include/compile.h M Lib/__future__.py M Lib/test/test_future.py M Python/bltinmodule.c diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index ad7d5d4c670b3..dca7f48979e16 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -2234,3 +2234,8 @@ Notable changes in Python 3.8.2 Fixed a regression with the ``ignore`` callback of :func:`shutil.copytree`. The argument types are now str and List[str] again. (Contributed by Manuel Barkhau and Giampaolo Rodola in :issue:`39390`.) + +The constant values of future flags in the :mod:`__future__` module +are updated in order to prevent collision with compiler flags. Previously +``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``. +(Contributed by Batuhan Taskaya in :issue:`39562`) diff --git a/Include/code.h b/Include/code.h index 3afddd20c80d7..a1cd58f44a0e8 100644 --- a/Include/code.h +++ b/Include/code.h @@ -88,19 +88,19 @@ typedef struct { #define CO_ITERABLE_COROUTINE 0x0100 #define CO_ASYNC_GENERATOR 0x0200 -/* These are no longer used. */ -#if 0 -#define CO_GENERATOR_ALLOWED 0x1000 -#endif -#define CO_FUTURE_DIVISION 0x2000 -#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ -#define CO_FUTURE_WITH_STATEMENT 0x8000 -#define CO_FUTURE_PRINT_FUNCTION 0x10000 -#define CO_FUTURE_UNICODE_LITERALS 0x20000 - -#define CO_FUTURE_BARRY_AS_BDFL 0x40000 -#define CO_FUTURE_GENERATOR_STOP 0x80000 -#define CO_FUTURE_ANNOTATIONS 0x100000 +/* bpo-39562: These constant values are changed in Python 3.9 + to prevent collision with compiler flags. CO_FUTURE_ and PyCF_ + constants must be kept unique. PyCF_ constants can use bits from + 0x0100 to 0x10000. CO_FUTURE_ constants use bits starting at 0x20000. */ +#define CO_FUTURE_DIVISION 0x20000 +#define CO_FUTURE_ABSOLUTE_IMPORT 0x40000 /* do absolute imports by default */ +#define CO_FUTURE_WITH_STATEMENT 0x80000 +#define CO_FUTURE_PRINT_FUNCTION 0x100000 +#define CO_FUTURE_UNICODE_LITERALS 0x200000 + +#define CO_FUTURE_BARRY_AS_BDFL 0x400000 +#define CO_FUTURE_GENERATOR_STOP 0x800000 +#define CO_FUTURE_ANNOTATIONS 0x1000000 /* This value is found in the co_cell2arg array when the associated cell variable does not correspond to an argument. */ diff --git a/Include/compile.h b/Include/compile.h index 1cda955c14255..015584d03b023 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -18,12 +18,18 @@ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS) #define PyCF_MASK_OBSOLETE (CO_NESTED) + +/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique. + PyCF_ constants can use bits from 0x0100 to 0x10000. + CO_FUTURE_ constants use bits starting at 0x20000. */ #define PyCF_SOURCE_IS_UTF8 0x0100 #define PyCF_DONT_IMPLY_DEDENT 0x0200 #define PyCF_ONLY_AST 0x0400 #define PyCF_IGNORE_COOKIE 0x0800 #define PyCF_TYPE_COMMENTS 0x1000 #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000 +#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \ + PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT) #ifndef Py_LIMITED_API typedef struct { diff --git a/Lib/__future__.py b/Lib/__future__.py index e1135685d846c..d7cb8ac5f4974 100644 --- a/Lib/__future__.py +++ b/Lib/__future__.py @@ -68,14 +68,14 @@ # this module. CO_NESTED = 0x0010 # nested_scopes CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000) -CO_FUTURE_DIVISION = 0x2000 # division -CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default -CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement -CO_FUTURE_PRINT_FUNCTION = 0x10000 # print function -CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals -CO_FUTURE_BARRY_AS_BDFL = 0x40000 -CO_FUTURE_GENERATOR_STOP = 0x80000 # StopIteration becomes RuntimeError in generators -CO_FUTURE_ANNOTATIONS = 0x100000 # annotations become strings at runtime +CO_FUTURE_DIVISION = 0x20000 # division +CO_FUTURE_ABSOLUTE_IMPORT = 0x40000 # perform absolute imports by default +CO_FUTURE_WITH_STATEMENT = 0x80000 # with statement +CO_FUTURE_PRINT_FUNCTION = 0x100000 # print function +CO_FUTURE_UNICODE_LITERALS = 0x200000 # unicode string literals +CO_FUTURE_BARRY_AS_BDFL = 0x400000 +CO_FUTURE_GENERATOR_STOP = 0x800000 # StopIteration becomes RuntimeError in generators +CO_FUTURE_ANNOTATIONS = 0x1000000 # annotations become strings at runtime class _Feature: def __init__(self, optionalRelease, mandatoryRelease, compiler_flag): diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py index d83c47ef15591..ea13533b5143d 100644 --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@ -1,5 +1,7 @@ # Test various flavors of legal and illegal future statements +import __future__ +import ast import unittest from test import support from textwrap import dedent @@ -74,6 +76,21 @@ def test_badfuture10(self): from test import badsyntax_future10 self.check_syntax_error(cm.exception, "badsyntax_future10", 3) + def test_ensure_flags_dont_clash(self): + # bpo-39562: test that future flags and compiler flags doesn't clash + + # obtain future flags (CO_FUTURE_***) from the __future__ module + flags = { + f"CO_FUTURE_{future.upper()}": getattr(__future__, future).compiler_flag + for future in __future__.all_feature_names + } + # obtain some of the exported compiler flags (PyCF_***) from the ast module + flags.update({ + flag: getattr(ast, flag) + for flag in dir(ast) if flag.startswith("PyCF_") + }) + self.assertCountEqual(set(flags.values()), flags.values()) + def test_parserhack(self): # test that the parser.c::future_hack function works as expected # Note: although this test must pass, it's not testing the original diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-01-14-58-16.bpo-39562.KCsX8n.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-14-58-16.bpo-39562.KCsX8n.rst new file mode 100644 index 0000000000000..5d7ef9606b449 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-14-58-16.bpo-39562.KCsX8n.rst @@ -0,0 +1,3 @@ +The constant values of future flags in the :mod:`__future__` module are +updated in order to prevent collision with compiler flags. Previously +``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``. diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 33f969094e7d1..fe22bbdde4e91 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -738,7 +738,7 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, } if (flags & - ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST | PyCF_TYPE_COMMENTS)) + ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_COMPILE_MASK)) { PyErr_SetString(PyExc_ValueError, "compile(): unrecognised flags"); From webhook-mailer at python.org Fri May 1 11:02:14 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 15:02:14 -0000 Subject: [Python-checkins] bpo-40334: unskip test_function_type in test_unparse with the new parser (GH-19837) Message-ID: https://github.com/python/cpython/commit/ea7297cf8f1aad4df8921a3d81a75118511afe77 commit: ea7297cf8f1aad4df8921a3d81a75118511afe77 branch: master author: Pablo Galindo committer: GitHub date: 2020-05-01T08:02:06-07:00 summary: bpo-40334: unskip test_function_type in test_unparse with the new parser (GH-19837) files: M Lib/test/test_unparse.py diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index b913569585a21..d4089a3fc1cdf 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -327,7 +327,6 @@ def test_constant_tuples(self): ast.Constant(value=(1, 2, 3), kind=None), "(1, 2, 3)" ) - @test.support.skip_if_new_parser("Pegen does not support type annotation yet") def test_function_type(self): for function_type in ( "() -> int", From webhook-mailer at python.org Fri May 1 11:32:17 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 15:32:17 -0000 Subject: [Python-checkins] bpo-40334: Correct return value of func_type_comment (GH-19833) Message-ID: https://github.com/python/cpython/commit/d955241469c18c946924dba79c18a9ef200391ad commit: d955241469c18c946924dba79c18a9ef200391ad branch: master author: Pablo Galindo committer: GitHub date: 2020-05-01T08:32:09-07:00 summary: bpo-40334: Correct return value of func_type_comment (GH-19833) files: M Grammar/python.gram M Parser/pegen/parse.c diff --git a/Grammar/python.gram b/Grammar/python.gram index 3813d8845be24..0acd851e09ff6 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -210,7 +210,7 @@ function_def_raw[stmt_ty]: (params) ? params : CHECK(_PyPegen_empty_arguments(p)), b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) ) } -func_type_comment[PyObject*]: +func_type_comment[Token*]: | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by indented block | invalid_double_type_comments | TYPE_COMMENT diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 33c92c232c54a..f4dacbffba493 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -408,7 +408,7 @@ static stmt_ty return_stmt_rule(Parser *p); static stmt_ty raise_stmt_rule(Parser *p); static stmt_ty function_def_rule(Parser *p); static stmt_ty function_def_raw_rule(Parser *p); -static PyObject* func_type_comment_rule(Parser *p); +static Token* func_type_comment_rule(Parser *p); static arguments_ty params_rule(Parser *p); static arguments_ty parameters_rule(Parser *p); static asdl_seq* slash_no_default_rule(Parser *p); @@ -3679,13 +3679,13 @@ function_def_raw_rule(Parser *p) // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) // | invalid_double_type_comments // | TYPE_COMMENT -static PyObject* +static Token* func_type_comment_rule(Parser *p) { if (p->error_indicator) { return NULL; } - PyObject* res = NULL; + Token* res = NULL; int mark = p->mark; { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) Token * newline_var; From webhook-mailer at python.org Fri May 1 11:37:00 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 15:37:00 -0000 Subject: [Python-checkins] bpo-39562: Correctly updated the version section in the what's new document (GH-19838) Message-ID: https://github.com/python/cpython/commit/71e6122b4428ae43e868e34db4f072635f58a555 commit: 71e6122b4428ae43e868e34db4f072635f58a555 branch: 3.8 author: Pablo Galindo committer: GitHub date: 2020-05-01T16:36:51+01:00 summary: bpo-39562: Correctly updated the version section in the what's new document (GH-19838) files: M Doc/whatsnew/3.8.rst diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index dca7f48979e16..d2db5bff5afcf 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -2235,6 +2235,9 @@ Fixed a regression with the ``ignore`` callback of :func:`shutil.copytree`. The argument types are now str and List[str] again. (Contributed by Manuel Barkhau and Giampaolo Rodola in :issue:`39390`.) +Notable changes in Python 3.8.3 +=============================== + The constant values of future flags in the :mod:`__future__` module are updated in order to prevent collision with compiler flags. Previously ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``. From webhook-mailer at python.org Fri May 1 12:42:11 2020 From: webhook-mailer at python.org (Guido van Rossum) Date: Fri, 01 May 2020 16:42:11 -0000 Subject: [Python-checkins] bpo-40334: Refactor lambda_parameters similar to parameters (GH-19830) Message-ID: https://github.com/python/cpython/commit/3941d9700b2a272689cb8a8435b5c60a1466ef79 commit: 3941d9700b2a272689cb8a8435b5c60a1466ef79 branch: master author: Guido van Rossum committer: GitHub date: 2020-05-01T17:42:03+01:00 summary: bpo-40334: Refactor lambda_parameters similar to parameters (GH-19830) files: M Grammar/python.gram M Parser/pegen/parse.c diff --git a/Grammar/python.gram b/Grammar/python.gram index 0acd851e09ff6..cbd4bc010dc1e 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -246,8 +246,7 @@ star_etc[StarEtc*]: _PyPegen_star_etc(p, NULL, b, c) } | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) } -kwds[arg_ty]: - | '**' a=param_no_default { a } +kwds[arg_ty]: '**' a=param_no_default { a } # One parameter. This *includes* a following comma and type comment. # @@ -325,32 +324,47 @@ expression[expr_ty] (memo): lambdef[expr_ty]: | 'lambda' a=[lambda_parameters] ':' b=expression { _Py_Lambda((a) ? a : CHECK(_PyPegen_empty_arguments(p)), b, EXTRA) } + +# lambda_parameters etc. duplicates parameters but without annotations +# or type comments, and if there's no comma after a parameter, we expect +# a colon, not a close parenthesis. (For more, see parameters above.) +# lambda_parameters[arguments_ty]: - | a=lambda_slash_without_default b=[',' x=lambda_plain_names { x }] c=[',' y=lambda_names_with_default { y }] d=[',' z=[lambda_star_etc] { z }] { + | a=lambda_slash_no_default b=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] { _PyPegen_make_arguments(p, a, NULL, b, c, d) } - | a=lambda_slash_with_default b=[',' y=lambda_names_with_default { y }] c=[',' z=[lambda_star_etc] { z }] { + | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, a, NULL, b, c) } - | a=lambda_plain_names b=[',' y=lambda_names_with_default { y }] c=[',' z=[lambda_star_etc] { z }] { + | a=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, a, b, c) } - | a=lambda_names_with_default b=[',' z=[lambda_star_etc] { z }] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)} + | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)} | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) } -lambda_slash_without_default[asdl_seq*]: a=lambda_plain_names ',' '/' { a } -lambda_slash_with_default[SlashWithDefault*]: a=[n=lambda_plain_names ',' { n }] b=lambda_names_with_default ',' '/' { - _PyPegen_slash_with_default(p, a, b) } + +lambda_slash_no_default[asdl_seq*]: + | a=lambda_param_no_default+ '/' ',' { a } + | a=lambda_param_no_default+ '/' &':' { a } +lambda_slash_with_default[SlashWithDefault*]: + | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) } + | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, a, b) } + lambda_star_etc[StarEtc*]: - | '*' a=lambda_plain_name b=lambda_name_with_optional_default* c=[',' d=lambda_kwds { d }] [','] { + | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] { _PyPegen_star_etc(p, a, b, c) } - | '*' b=lambda_name_with_optional_default+ c=[',' d=lambda_kwds { d }] [','] { + | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] { _PyPegen_star_etc(p, NULL, b, c) } - | a=lambda_kwds [','] { _PyPegen_star_etc(p, NULL, NULL, a) } -lambda_name_with_optional_default[NameDefaultPair*]: - | ',' a=lambda_plain_name b=['=' e=expression { e }] { _PyPegen_name_default_pair(p, a, b, NULL) } -lambda_names_with_default[asdl_seq*]: a=','.lambda_name_with_default+ { a } -lambda_name_with_default[NameDefaultPair*]: - | n=lambda_plain_name '=' e=expression { _PyPegen_name_default_pair(p, n, e, NULL) } -lambda_plain_names[asdl_seq*]: a=','.(lambda_plain_name !'=')+ { a } -lambda_plain_name[arg_ty]: a=NAME { _Py_arg(a->v.Name.id, NULL, NULL, EXTRA) } -lambda_kwds[arg_ty]: '**' a=lambda_plain_name { a } + | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) } + +lambda_kwds[arg_ty]: '**' a=lambda_param_no_default { a } + +lambda_param_no_default[arg_ty]: + | a=lambda_param ',' { a } + | a=lambda_param &':' { a } +lambda_param_with_default[NameDefaultPair*]: + | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, NULL) } + | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, NULL) } +lambda_param_maybe_default[NameDefaultPair*]: + | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, NULL) } + | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, NULL) } +lambda_param[arg_ty]: a=NAME { _Py_arg(a->v.Name.id, NULL, NULL, EXTRA) } disjunction[expr_ty] (memo): | a=conjunction b=('or' c=conjunction { c })+ { _Py_BoolOp( diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index f4dacbffba493..b4745ba4d4f26 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -138,233 +138,227 @@ static KeywordToken *reserved_keywords[] = { #define expression_type 1067 #define lambdef_type 1068 #define lambda_parameters_type 1069 -#define lambda_slash_without_default_type 1070 +#define lambda_slash_no_default_type 1070 #define lambda_slash_with_default_type 1071 #define lambda_star_etc_type 1072 -#define lambda_name_with_optional_default_type 1073 -#define lambda_names_with_default_type 1074 -#define lambda_name_with_default_type 1075 -#define lambda_plain_names_type 1076 -#define lambda_plain_name_type 1077 -#define lambda_kwds_type 1078 -#define disjunction_type 1079 -#define conjunction_type 1080 -#define inversion_type 1081 -#define comparison_type 1082 -#define compare_op_bitwise_or_pair_type 1083 -#define eq_bitwise_or_type 1084 -#define noteq_bitwise_or_type 1085 -#define lte_bitwise_or_type 1086 -#define lt_bitwise_or_type 1087 -#define gte_bitwise_or_type 1088 -#define gt_bitwise_or_type 1089 -#define notin_bitwise_or_type 1090 -#define in_bitwise_or_type 1091 -#define isnot_bitwise_or_type 1092 -#define is_bitwise_or_type 1093 -#define bitwise_or_type 1094 // Left-recursive -#define bitwise_xor_type 1095 // Left-recursive -#define bitwise_and_type 1096 // Left-recursive -#define shift_expr_type 1097 // Left-recursive -#define sum_type 1098 // Left-recursive -#define term_type 1099 // Left-recursive -#define factor_type 1100 -#define power_type 1101 -#define await_primary_type 1102 -#define primary_type 1103 // Left-recursive -#define slices_type 1104 -#define slice_type 1105 -#define atom_type 1106 -#define strings_type 1107 -#define list_type 1108 -#define listcomp_type 1109 -#define tuple_type 1110 -#define group_type 1111 -#define genexp_type 1112 -#define set_type 1113 -#define setcomp_type 1114 -#define dict_type 1115 -#define dictcomp_type 1116 -#define kvpairs_type 1117 -#define kvpair_type 1118 -#define for_if_clauses_type 1119 -#define for_if_clause_type 1120 -#define yield_expr_type 1121 -#define arguments_type 1122 -#define args_type 1123 -#define kwargs_type 1124 -#define starred_expression_type 1125 -#define kwarg_or_starred_type 1126 -#define kwarg_or_double_starred_type 1127 -#define star_targets_type 1128 -#define star_targets_seq_type 1129 -#define star_target_type 1130 -#define star_atom_type 1131 -#define inside_paren_ann_assign_target_type 1132 -#define ann_assign_subscript_attribute_target_type 1133 -#define del_targets_type 1134 -#define del_target_type 1135 -#define del_t_atom_type 1136 -#define targets_type 1137 -#define target_type 1138 -#define t_primary_type 1139 // Left-recursive -#define t_lookahead_type 1140 -#define t_atom_type 1141 -#define incorrect_arguments_type 1142 -#define invalid_named_expression_type 1143 -#define invalid_assignment_type 1144 -#define invalid_block_type 1145 -#define invalid_comprehension_type 1146 -#define invalid_parameters_type 1147 -#define invalid_double_type_comments_type 1148 -#define _loop0_1_type 1149 -#define _loop0_2_type 1150 -#define _loop0_4_type 1151 -#define _gather_3_type 1152 -#define _loop0_6_type 1153 -#define _gather_5_type 1154 -#define _loop0_8_type 1155 -#define _gather_7_type 1156 -#define _loop0_10_type 1157 -#define _gather_9_type 1158 -#define _loop1_11_type 1159 -#define _loop0_13_type 1160 -#define _gather_12_type 1161 -#define _tmp_14_type 1162 -#define _tmp_15_type 1163 -#define _tmp_16_type 1164 -#define _tmp_17_type 1165 -#define _tmp_18_type 1166 -#define _tmp_19_type 1167 -#define _tmp_20_type 1168 -#define _tmp_21_type 1169 -#define _loop1_22_type 1170 -#define _tmp_23_type 1171 -#define _tmp_24_type 1172 -#define _loop0_26_type 1173 -#define _gather_25_type 1174 -#define _loop0_28_type 1175 -#define _gather_27_type 1176 -#define _tmp_29_type 1177 -#define _loop0_30_type 1178 -#define _loop1_31_type 1179 -#define _loop0_33_type 1180 -#define _gather_32_type 1181 -#define _tmp_34_type 1182 -#define _loop0_36_type 1183 -#define _gather_35_type 1184 -#define _tmp_37_type 1185 -#define _loop0_39_type 1186 -#define _gather_38_type 1187 -#define _loop0_41_type 1188 -#define _gather_40_type 1189 -#define _loop0_43_type 1190 -#define _gather_42_type 1191 -#define _loop0_45_type 1192 -#define _gather_44_type 1193 -#define _tmp_46_type 1194 -#define _loop1_47_type 1195 -#define _tmp_48_type 1196 -#define _tmp_49_type 1197 -#define _tmp_50_type 1198 -#define _tmp_51_type 1199 -#define _tmp_52_type 1200 -#define _loop0_53_type 1201 -#define _loop0_54_type 1202 -#define _loop0_55_type 1203 -#define _loop1_56_type 1204 -#define _loop0_57_type 1205 -#define _loop1_58_type 1206 -#define _loop1_59_type 1207 -#define _loop1_60_type 1208 -#define _loop0_61_type 1209 -#define _loop1_62_type 1210 -#define _loop0_63_type 1211 -#define _loop1_64_type 1212 -#define _loop0_65_type 1213 -#define _loop1_66_type 1214 -#define _loop1_67_type 1215 -#define _tmp_68_type 1216 -#define _loop0_70_type 1217 -#define _gather_69_type 1218 -#define _loop1_71_type 1219 -#define _loop0_73_type 1220 -#define _gather_72_type 1221 -#define _loop1_74_type 1222 -#define _tmp_75_type 1223 -#define _tmp_76_type 1224 -#define _tmp_77_type 1225 -#define _tmp_78_type 1226 -#define _tmp_79_type 1227 -#define _tmp_80_type 1228 -#define _tmp_81_type 1229 -#define _tmp_82_type 1230 -#define _tmp_83_type 1231 -#define _loop0_84_type 1232 -#define _tmp_85_type 1233 -#define _loop1_86_type 1234 -#define _tmp_87_type 1235 -#define _tmp_88_type 1236 -#define _loop0_90_type 1237 -#define _gather_89_type 1238 -#define _loop0_92_type 1239 -#define _gather_91_type 1240 -#define _loop1_93_type 1241 -#define _loop1_94_type 1242 -#define _loop1_95_type 1243 -#define _tmp_96_type 1244 -#define _loop0_98_type 1245 -#define _gather_97_type 1246 -#define _tmp_99_type 1247 -#define _tmp_100_type 1248 -#define _tmp_101_type 1249 -#define _tmp_102_type 1250 -#define _loop1_103_type 1251 -#define _tmp_104_type 1252 -#define _tmp_105_type 1253 -#define _loop0_107_type 1254 -#define _gather_106_type 1255 -#define _loop1_108_type 1256 -#define _loop0_109_type 1257 -#define _loop0_110_type 1258 -#define _tmp_111_type 1259 -#define _tmp_112_type 1260 -#define _loop0_114_type 1261 -#define _gather_113_type 1262 -#define _loop0_116_type 1263 -#define _gather_115_type 1264 -#define _loop0_118_type 1265 -#define _gather_117_type 1266 -#define _loop0_120_type 1267 -#define _gather_119_type 1268 -#define _loop0_121_type 1269 -#define _loop0_123_type 1270 -#define _gather_122_type 1271 -#define _tmp_124_type 1272 -#define _loop0_126_type 1273 -#define _gather_125_type 1274 -#define _loop0_128_type 1275 -#define _gather_127_type 1276 -#define _tmp_129_type 1277 -#define _tmp_130_type 1278 -#define _tmp_131_type 1279 -#define _tmp_132_type 1280 -#define _tmp_133_type 1281 -#define _loop0_134_type 1282 -#define _tmp_135_type 1283 -#define _tmp_136_type 1284 -#define _tmp_137_type 1285 -#define _tmp_138_type 1286 -#define _tmp_139_type 1287 -#define _tmp_140_type 1288 -#define _tmp_141_type 1289 -#define _tmp_142_type 1290 -#define _tmp_143_type 1291 -#define _tmp_144_type 1292 -#define _tmp_145_type 1293 -#define _tmp_146_type 1294 -#define _tmp_147_type 1295 -#define _loop1_148_type 1296 +#define lambda_kwds_type 1073 +#define lambda_param_no_default_type 1074 +#define lambda_param_with_default_type 1075 +#define lambda_param_maybe_default_type 1076 +#define lambda_param_type 1077 +#define disjunction_type 1078 +#define conjunction_type 1079 +#define inversion_type 1080 +#define comparison_type 1081 +#define compare_op_bitwise_or_pair_type 1082 +#define eq_bitwise_or_type 1083 +#define noteq_bitwise_or_type 1084 +#define lte_bitwise_or_type 1085 +#define lt_bitwise_or_type 1086 +#define gte_bitwise_or_type 1087 +#define gt_bitwise_or_type 1088 +#define notin_bitwise_or_type 1089 +#define in_bitwise_or_type 1090 +#define isnot_bitwise_or_type 1091 +#define is_bitwise_or_type 1092 +#define bitwise_or_type 1093 // Left-recursive +#define bitwise_xor_type 1094 // Left-recursive +#define bitwise_and_type 1095 // Left-recursive +#define shift_expr_type 1096 // Left-recursive +#define sum_type 1097 // Left-recursive +#define term_type 1098 // Left-recursive +#define factor_type 1099 +#define power_type 1100 +#define await_primary_type 1101 +#define primary_type 1102 // Left-recursive +#define slices_type 1103 +#define slice_type 1104 +#define atom_type 1105 +#define strings_type 1106 +#define list_type 1107 +#define listcomp_type 1108 +#define tuple_type 1109 +#define group_type 1110 +#define genexp_type 1111 +#define set_type 1112 +#define setcomp_type 1113 +#define dict_type 1114 +#define dictcomp_type 1115 +#define kvpairs_type 1116 +#define kvpair_type 1117 +#define for_if_clauses_type 1118 +#define for_if_clause_type 1119 +#define yield_expr_type 1120 +#define arguments_type 1121 +#define args_type 1122 +#define kwargs_type 1123 +#define starred_expression_type 1124 +#define kwarg_or_starred_type 1125 +#define kwarg_or_double_starred_type 1126 +#define star_targets_type 1127 +#define star_targets_seq_type 1128 +#define star_target_type 1129 +#define star_atom_type 1130 +#define inside_paren_ann_assign_target_type 1131 +#define ann_assign_subscript_attribute_target_type 1132 +#define del_targets_type 1133 +#define del_target_type 1134 +#define del_t_atom_type 1135 +#define targets_type 1136 +#define target_type 1137 +#define t_primary_type 1138 // Left-recursive +#define t_lookahead_type 1139 +#define t_atom_type 1140 +#define incorrect_arguments_type 1141 +#define invalid_named_expression_type 1142 +#define invalid_assignment_type 1143 +#define invalid_block_type 1144 +#define invalid_comprehension_type 1145 +#define invalid_parameters_type 1146 +#define invalid_double_type_comments_type 1147 +#define _loop0_1_type 1148 +#define _loop0_2_type 1149 +#define _loop0_4_type 1150 +#define _gather_3_type 1151 +#define _loop0_6_type 1152 +#define _gather_5_type 1153 +#define _loop0_8_type 1154 +#define _gather_7_type 1155 +#define _loop0_10_type 1156 +#define _gather_9_type 1157 +#define _loop1_11_type 1158 +#define _loop0_13_type 1159 +#define _gather_12_type 1160 +#define _tmp_14_type 1161 +#define _tmp_15_type 1162 +#define _tmp_16_type 1163 +#define _tmp_17_type 1164 +#define _tmp_18_type 1165 +#define _tmp_19_type 1166 +#define _tmp_20_type 1167 +#define _tmp_21_type 1168 +#define _loop1_22_type 1169 +#define _tmp_23_type 1170 +#define _tmp_24_type 1171 +#define _loop0_26_type 1172 +#define _gather_25_type 1173 +#define _loop0_28_type 1174 +#define _gather_27_type 1175 +#define _tmp_29_type 1176 +#define _loop0_30_type 1177 +#define _loop1_31_type 1178 +#define _loop0_33_type 1179 +#define _gather_32_type 1180 +#define _tmp_34_type 1181 +#define _loop0_36_type 1182 +#define _gather_35_type 1183 +#define _tmp_37_type 1184 +#define _loop0_39_type 1185 +#define _gather_38_type 1186 +#define _loop0_41_type 1187 +#define _gather_40_type 1188 +#define _loop0_43_type 1189 +#define _gather_42_type 1190 +#define _loop0_45_type 1191 +#define _gather_44_type 1192 +#define _tmp_46_type 1193 +#define _loop1_47_type 1194 +#define _tmp_48_type 1195 +#define _tmp_49_type 1196 +#define _tmp_50_type 1197 +#define _tmp_51_type 1198 +#define _tmp_52_type 1199 +#define _loop0_53_type 1200 +#define _loop0_54_type 1201 +#define _loop0_55_type 1202 +#define _loop1_56_type 1203 +#define _loop0_57_type 1204 +#define _loop1_58_type 1205 +#define _loop1_59_type 1206 +#define _loop1_60_type 1207 +#define _loop0_61_type 1208 +#define _loop1_62_type 1209 +#define _loop0_63_type 1210 +#define _loop1_64_type 1211 +#define _loop0_65_type 1212 +#define _loop1_66_type 1213 +#define _loop1_67_type 1214 +#define _tmp_68_type 1215 +#define _loop0_70_type 1216 +#define _gather_69_type 1217 +#define _loop1_71_type 1218 +#define _loop0_73_type 1219 +#define _gather_72_type 1220 +#define _loop1_74_type 1221 +#define _loop0_75_type 1222 +#define _loop0_76_type 1223 +#define _loop0_77_type 1224 +#define _loop1_78_type 1225 +#define _loop0_79_type 1226 +#define _loop1_80_type 1227 +#define _loop1_81_type 1228 +#define _loop1_82_type 1229 +#define _loop0_83_type 1230 +#define _loop1_84_type 1231 +#define _loop0_85_type 1232 +#define _loop1_86_type 1233 +#define _loop0_87_type 1234 +#define _loop1_88_type 1235 +#define _loop1_89_type 1236 +#define _loop1_90_type 1237 +#define _loop1_91_type 1238 +#define _tmp_92_type 1239 +#define _loop0_94_type 1240 +#define _gather_93_type 1241 +#define _tmp_95_type 1242 +#define _tmp_96_type 1243 +#define _tmp_97_type 1244 +#define _tmp_98_type 1245 +#define _loop1_99_type 1246 +#define _tmp_100_type 1247 +#define _tmp_101_type 1248 +#define _loop0_103_type 1249 +#define _gather_102_type 1250 +#define _loop1_104_type 1251 +#define _loop0_105_type 1252 +#define _loop0_106_type 1253 +#define _tmp_107_type 1254 +#define _tmp_108_type 1255 +#define _loop0_110_type 1256 +#define _gather_109_type 1257 +#define _loop0_112_type 1258 +#define _gather_111_type 1259 +#define _loop0_114_type 1260 +#define _gather_113_type 1261 +#define _loop0_116_type 1262 +#define _gather_115_type 1263 +#define _loop0_117_type 1264 +#define _loop0_119_type 1265 +#define _gather_118_type 1266 +#define _tmp_120_type 1267 +#define _loop0_122_type 1268 +#define _gather_121_type 1269 +#define _loop0_124_type 1270 +#define _gather_123_type 1271 +#define _tmp_125_type 1272 +#define _tmp_126_type 1273 +#define _tmp_127_type 1274 +#define _tmp_128_type 1275 +#define _tmp_129_type 1276 +#define _loop0_130_type 1277 +#define _tmp_131_type 1278 +#define _tmp_132_type 1279 +#define _tmp_133_type 1280 +#define _tmp_134_type 1281 +#define _tmp_135_type 1282 +#define _tmp_136_type 1283 +#define _tmp_137_type 1284 +#define _tmp_138_type 1285 +#define _tmp_139_type 1286 +#define _tmp_140_type 1287 +#define _tmp_141_type 1288 +#define _tmp_142_type 1289 +#define _loop1_143_type 1290 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -436,15 +430,14 @@ static expr_ty expressions_rule(Parser *p); static expr_ty expression_rule(Parser *p); static expr_ty lambdef_rule(Parser *p); static arguments_ty lambda_parameters_rule(Parser *p); -static asdl_seq* lambda_slash_without_default_rule(Parser *p); +static asdl_seq* lambda_slash_no_default_rule(Parser *p); static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); static StarEtc* lambda_star_etc_rule(Parser *p); -static NameDefaultPair* lambda_name_with_optional_default_rule(Parser *p); -static asdl_seq* lambda_names_with_default_rule(Parser *p); -static NameDefaultPair* lambda_name_with_default_rule(Parser *p); -static asdl_seq* lambda_plain_names_rule(Parser *p); -static arg_ty lambda_plain_name_rule(Parser *p); static arg_ty lambda_kwds_rule(Parser *p); +static arg_ty lambda_param_no_default_rule(Parser *p); +static NameDefaultPair* lambda_param_with_default_rule(Parser *p); +static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); +static arg_ty lambda_param_rule(Parser *p); static expr_ty disjunction_rule(Parser *p); static expr_ty conjunction_rule(Parser *p); static expr_ty inversion_rule(Parser *p); @@ -589,66 +582,66 @@ static asdl_seq *_loop1_71_rule(Parser *p); static asdl_seq *_loop0_73_rule(Parser *p); static asdl_seq *_gather_72_rule(Parser *p); static asdl_seq *_loop1_74_rule(Parser *p); -static void *_tmp_75_rule(Parser *p); -static void *_tmp_76_rule(Parser *p); -static void *_tmp_77_rule(Parser *p); -static void *_tmp_78_rule(Parser *p); -static void *_tmp_79_rule(Parser *p); -static void *_tmp_80_rule(Parser *p); -static void *_tmp_81_rule(Parser *p); -static void *_tmp_82_rule(Parser *p); -static void *_tmp_83_rule(Parser *p); -static asdl_seq *_loop0_84_rule(Parser *p); -static void *_tmp_85_rule(Parser *p); +static asdl_seq *_loop0_75_rule(Parser *p); +static asdl_seq *_loop0_76_rule(Parser *p); +static asdl_seq *_loop0_77_rule(Parser *p); +static asdl_seq *_loop1_78_rule(Parser *p); +static asdl_seq *_loop0_79_rule(Parser *p); +static asdl_seq *_loop1_80_rule(Parser *p); +static asdl_seq *_loop1_81_rule(Parser *p); +static asdl_seq *_loop1_82_rule(Parser *p); +static asdl_seq *_loop0_83_rule(Parser *p); +static asdl_seq *_loop1_84_rule(Parser *p); +static asdl_seq *_loop0_85_rule(Parser *p); static asdl_seq *_loop1_86_rule(Parser *p); -static void *_tmp_87_rule(Parser *p); -static void *_tmp_88_rule(Parser *p); -static asdl_seq *_loop0_90_rule(Parser *p); -static asdl_seq *_gather_89_rule(Parser *p); -static asdl_seq *_loop0_92_rule(Parser *p); -static asdl_seq *_gather_91_rule(Parser *p); -static asdl_seq *_loop1_93_rule(Parser *p); -static asdl_seq *_loop1_94_rule(Parser *p); -static asdl_seq *_loop1_95_rule(Parser *p); +static asdl_seq *_loop0_87_rule(Parser *p); +static asdl_seq *_loop1_88_rule(Parser *p); +static asdl_seq *_loop1_89_rule(Parser *p); +static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop1_91_rule(Parser *p); +static void *_tmp_92_rule(Parser *p); +static asdl_seq *_loop0_94_rule(Parser *p); +static asdl_seq *_gather_93_rule(Parser *p); +static void *_tmp_95_rule(Parser *p); static void *_tmp_96_rule(Parser *p); -static asdl_seq *_loop0_98_rule(Parser *p); -static asdl_seq *_gather_97_rule(Parser *p); -static void *_tmp_99_rule(Parser *p); +static void *_tmp_97_rule(Parser *p); +static void *_tmp_98_rule(Parser *p); +static asdl_seq *_loop1_99_rule(Parser *p); static void *_tmp_100_rule(Parser *p); static void *_tmp_101_rule(Parser *p); -static void *_tmp_102_rule(Parser *p); -static asdl_seq *_loop1_103_rule(Parser *p); -static void *_tmp_104_rule(Parser *p); -static void *_tmp_105_rule(Parser *p); -static asdl_seq *_loop0_107_rule(Parser *p); -static asdl_seq *_gather_106_rule(Parser *p); -static asdl_seq *_loop1_108_rule(Parser *p); -static asdl_seq *_loop0_109_rule(Parser *p); +static asdl_seq *_loop0_103_rule(Parser *p); +static asdl_seq *_gather_102_rule(Parser *p); +static asdl_seq *_loop1_104_rule(Parser *p); +static asdl_seq *_loop0_105_rule(Parser *p); +static asdl_seq *_loop0_106_rule(Parser *p); +static void *_tmp_107_rule(Parser *p); +static void *_tmp_108_rule(Parser *p); static asdl_seq *_loop0_110_rule(Parser *p); -static void *_tmp_111_rule(Parser *p); -static void *_tmp_112_rule(Parser *p); +static asdl_seq *_gather_109_rule(Parser *p); +static asdl_seq *_loop0_112_rule(Parser *p); +static asdl_seq *_gather_111_rule(Parser *p); static asdl_seq *_loop0_114_rule(Parser *p); static asdl_seq *_gather_113_rule(Parser *p); static asdl_seq *_loop0_116_rule(Parser *p); static asdl_seq *_gather_115_rule(Parser *p); -static asdl_seq *_loop0_118_rule(Parser *p); -static asdl_seq *_gather_117_rule(Parser *p); -static asdl_seq *_loop0_120_rule(Parser *p); -static asdl_seq *_gather_119_rule(Parser *p); -static asdl_seq *_loop0_121_rule(Parser *p); -static asdl_seq *_loop0_123_rule(Parser *p); -static asdl_seq *_gather_122_rule(Parser *p); -static void *_tmp_124_rule(Parser *p); -static asdl_seq *_loop0_126_rule(Parser *p); -static asdl_seq *_gather_125_rule(Parser *p); -static asdl_seq *_loop0_128_rule(Parser *p); -static asdl_seq *_gather_127_rule(Parser *p); +static asdl_seq *_loop0_117_rule(Parser *p); +static asdl_seq *_loop0_119_rule(Parser *p); +static asdl_seq *_gather_118_rule(Parser *p); +static void *_tmp_120_rule(Parser *p); +static asdl_seq *_loop0_122_rule(Parser *p); +static asdl_seq *_gather_121_rule(Parser *p); +static asdl_seq *_loop0_124_rule(Parser *p); +static asdl_seq *_gather_123_rule(Parser *p); +static void *_tmp_125_rule(Parser *p); +static void *_tmp_126_rule(Parser *p); +static void *_tmp_127_rule(Parser *p); +static void *_tmp_128_rule(Parser *p); static void *_tmp_129_rule(Parser *p); -static void *_tmp_130_rule(Parser *p); +static asdl_seq *_loop0_130_rule(Parser *p); static void *_tmp_131_rule(Parser *p); static void *_tmp_132_rule(Parser *p); static void *_tmp_133_rule(Parser *p); -static asdl_seq *_loop0_134_rule(Parser *p); +static void *_tmp_134_rule(Parser *p); static void *_tmp_135_rule(Parser *p); static void *_tmp_136_rule(Parser *p); static void *_tmp_137_rule(Parser *p); @@ -657,12 +650,7 @@ static void *_tmp_139_rule(Parser *p); static void *_tmp_140_rule(Parser *p); static void *_tmp_141_rule(Parser *p); static void *_tmp_142_rule(Parser *p); -static void *_tmp_143_rule(Parser *p); -static void *_tmp_144_rule(Parser *p); -static void *_tmp_145_rule(Parser *p); -static void *_tmp_146_rule(Parser *p); -static void *_tmp_147_rule(Parser *p); -static asdl_seq *_loop1_148_rule(Parser *p); +static asdl_seq *_loop1_143_rule(Parser *p); // file: statements? $ @@ -5217,10 +5205,10 @@ lambdef_rule(Parser *p) } // lambda_parameters: -// | lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?] -// | lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?] -// | lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?] -// | lambda_names_with_default [',' lambda_star_etc?] +// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? +// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? +// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? +// | lambda_param_with_default+ lambda_star_etc? // | lambda_star_etc static arguments_ty lambda_parameters_rule(Parser *p) @@ -5230,19 +5218,19 @@ lambda_parameters_rule(Parser *p) } arguments_ty res = NULL; int mark = p->mark; - { // lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?] + { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? asdl_seq* a; - void *b; - void *c; + asdl_seq * b; + asdl_seq * c; void *d; if ( - (a = lambda_slash_without_default_rule(p)) + (a = lambda_slash_no_default_rule(p)) && - (b = _tmp_75_rule(p), 1) + (b = _loop0_75_rule(p)) && - (c = _tmp_76_rule(p), 1) + (c = _loop0_76_rule(p)) && - (d = _tmp_77_rule(p), 1) + (d = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); @@ -5254,16 +5242,16 @@ lambda_parameters_rule(Parser *p) } p->mark = mark; } - { // lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?] + { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? SlashWithDefault* a; - void *b; + asdl_seq * b; void *c; if ( (a = lambda_slash_with_default_rule(p)) && - (b = _tmp_78_rule(p), 1) + (b = _loop0_77_rule(p)) && - (c = _tmp_79_rule(p), 1) + (c = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); @@ -5275,16 +5263,16 @@ lambda_parameters_rule(Parser *p) } p->mark = mark; } - { // lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?] - asdl_seq* a; - void *b; + { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? + asdl_seq * a; + asdl_seq * b; void *c; if ( - (a = lambda_plain_names_rule(p)) + (a = _loop1_78_rule(p)) && - (b = _tmp_80_rule(p), 1) + (b = _loop0_79_rule(p)) && - (c = _tmp_81_rule(p), 1) + (c = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); @@ -5296,13 +5284,13 @@ lambda_parameters_rule(Parser *p) } p->mark = mark; } - { // lambda_names_with_default [',' lambda_star_etc?] - asdl_seq* a; + { // lambda_param_with_default+ lambda_star_etc? + asdl_seq * a; void *b; if ( - (a = lambda_names_with_default_rule(p)) + (a = _loop1_80_rule(p)) && - (b = _tmp_82_rule(p), 1) + (b = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); @@ -5334,25 +5322,47 @@ lambda_parameters_rule(Parser *p) return res; } -// lambda_slash_without_default: lambda_plain_names ',' '/' +// lambda_slash_no_default: +// | lambda_param_no_default+ '/' ',' +// | lambda_param_no_default+ '/' &':' static asdl_seq* -lambda_slash_without_default_rule(Parser *p) +lambda_slash_no_default_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq* res = NULL; int mark = p->mark; - { // lambda_plain_names ',' '/' - asdl_seq* a; + { // lambda_param_no_default+ '/' ',' + asdl_seq * a; Token * literal; Token * literal_1; if ( - (a = lambda_plain_names_rule(p)) + (a = _loop1_81_rule(p)) && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 17)) + && + (literal_1 = _PyPegen_expect_token(p, 12)) + ) + { + res = a; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param_no_default+ '/' &':' + asdl_seq * a; + Token * literal; + if ( + (a = _loop1_82_rule(p)) && - (literal_1 = _PyPegen_expect_token(p, 17)) + (literal = _PyPegen_expect_token(p, 17)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) ) { res = a; @@ -5369,7 +5379,9 @@ lambda_slash_without_default_rule(Parser *p) return res; } -// lambda_slash_with_default: [lambda_plain_names ','] lambda_names_with_default ',' '/' +// lambda_slash_with_default: +// | lambda_param_no_default* lambda_param_with_default+ '/' ',' +// | lambda_param_no_default* lambda_param_with_default+ '/' &':' static SlashWithDefault* lambda_slash_with_default_rule(Parser *p) { @@ -5378,19 +5390,42 @@ lambda_slash_with_default_rule(Parser *p) } SlashWithDefault* res = NULL; int mark = p->mark; - { // [lambda_plain_names ','] lambda_names_with_default ',' '/' - void *a; - asdl_seq* b; + { // lambda_param_no_default* lambda_param_with_default+ '/' ',' + asdl_seq * a; + asdl_seq * b; Token * literal; Token * literal_1; if ( - (a = _tmp_83_rule(p), 1) + (a = _loop0_83_rule(p)) && - (b = lambda_names_with_default_rule(p)) + (b = _loop1_84_rule(p)) && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 17)) + && + (literal_1 = _PyPegen_expect_token(p, 12)) + ) + { + res = _PyPegen_slash_with_default ( p , a , b ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param_no_default* lambda_param_with_default+ '/' &':' + asdl_seq * a; + asdl_seq * b; + Token * literal; + if ( + (a = _loop0_85_rule(p)) + && + (b = _loop1_86_rule(p)) + && + (literal = _PyPegen_expect_token(p, 17)) && - (literal_1 = _PyPegen_expect_token(p, 17)) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) ) { res = _PyPegen_slash_with_default ( p , a , b ); @@ -5408,9 +5443,9 @@ lambda_slash_with_default_rule(Parser *p) } // lambda_star_etc: -// | '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','? -// | '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','? -// | lambda_kwds ','? +// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? +// | '*' ',' lambda_param_maybe_default+ lambda_kwds? +// | lambda_kwds static StarEtc* lambda_star_etc_rule(Parser *p) { @@ -5419,23 +5454,19 @@ lambda_star_etc_rule(Parser *p) } StarEtc* res = NULL; int mark = p->mark; - { // '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','? + { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? arg_ty a; asdl_seq * b; void *c; Token * literal; - void *opt_var; - UNUSED(opt_var); // Silence compiler warnings if ( (literal = _PyPegen_expect_token(p, 16)) && - (a = lambda_plain_name_rule(p)) - && - (b = _loop0_84_rule(p)) + (a = lambda_param_no_default_rule(p)) && - (c = _tmp_85_rule(p), 1) + (b = _loop0_87_rule(p)) && - (opt_var = _PyPegen_expect_token(p, 12), 1) + (c = lambda_kwds_rule(p), 1) ) { res = _PyPegen_star_etc ( p , a , b , c ); @@ -5447,20 +5478,19 @@ lambda_star_etc_rule(Parser *p) } p->mark = mark; } - { // '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','? + { // '*' ',' lambda_param_maybe_default+ lambda_kwds? asdl_seq * b; void *c; Token * literal; - void *opt_var; - UNUSED(opt_var); // Silence compiler warnings + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 16)) && - (b = _loop1_86_rule(p)) + (literal_1 = _PyPegen_expect_token(p, 12)) && - (c = _tmp_87_rule(p), 1) + (b = _loop1_88_rule(p)) && - (opt_var = _PyPegen_expect_token(p, 12), 1) + (c = lambda_kwds_rule(p), 1) ) { res = _PyPegen_star_etc ( p , NULL , b , c ); @@ -5472,14 +5502,10 @@ lambda_star_etc_rule(Parser *p) } p->mark = mark; } - { // lambda_kwds ','? + { // lambda_kwds arg_ty a; - void *opt_var; - UNUSED(opt_var); // Silence compiler warnings if ( (a = lambda_kwds_rule(p)) - && - (opt_var = _PyPegen_expect_token(p, 12), 1) ) { res = _PyPegen_star_etc ( p , NULL , NULL , a ); @@ -5496,28 +5522,25 @@ lambda_star_etc_rule(Parser *p) return res; } -// lambda_name_with_optional_default: ',' lambda_plain_name ['=' expression] -static NameDefaultPair* -lambda_name_with_optional_default_rule(Parser *p) +// lambda_kwds: '**' lambda_param_no_default +static arg_ty +lambda_kwds_rule(Parser *p) { if (p->error_indicator) { return NULL; } - NameDefaultPair* res = NULL; + arg_ty res = NULL; int mark = p->mark; - { // ',' lambda_plain_name ['=' expression] + { // '**' lambda_param_no_default arg_ty a; - void *b; Token * literal; if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (a = lambda_plain_name_rule(p)) + (literal = _PyPegen_expect_token(p, 35)) && - (b = _tmp_88_rule(p), 1) + (a = lambda_param_no_default_rule(p)) ) { - res = _PyPegen_name_default_pair ( p , a , b , NULL ); + res = a; if (res == NULL && PyErr_Occurred()) { p->error_indicator = 1; return NULL; @@ -5531,19 +5554,39 @@ lambda_name_with_optional_default_rule(Parser *p) return res; } -// lambda_names_with_default: ','.lambda_name_with_default+ -static asdl_seq* -lambda_names_with_default_rule(Parser *p) +// lambda_param_no_default: lambda_param ',' | lambda_param &':' +static arg_ty +lambda_param_no_default_rule(Parser *p) { if (p->error_indicator) { return NULL; } - asdl_seq* res = NULL; + arg_ty res = NULL; int mark = p->mark; - { // ','.lambda_name_with_default+ - asdl_seq * a; + { // lambda_param ',' + arg_ty a; + Token * literal; + if ( + (a = lambda_param_rule(p)) + && + (literal = _PyPegen_expect_token(p, 12)) + ) + { + res = a; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param &':' + arg_ty a; if ( - (a = _gather_89_rule(p)) + (a = lambda_param_rule(p)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) ) { res = a; @@ -5560,28 +5603,48 @@ lambda_names_with_default_rule(Parser *p) return res; } -// lambda_name_with_default: lambda_plain_name '=' expression +// lambda_param_with_default: lambda_param default ',' | lambda_param default &':' static NameDefaultPair* -lambda_name_with_default_rule(Parser *p) +lambda_param_with_default_rule(Parser *p) { if (p->error_indicator) { return NULL; } NameDefaultPair* res = NULL; int mark = p->mark; - { // lambda_plain_name '=' expression - expr_ty e; + { // lambda_param default ',' + arg_ty a; + expr_ty c; Token * literal; - arg_ty n; if ( - (n = lambda_plain_name_rule(p)) + (a = lambda_param_rule(p)) && - (literal = _PyPegen_expect_token(p, 22)) + (c = default_rule(p)) && - (e = expression_rule(p)) + (literal = _PyPegen_expect_token(p, 12)) + ) + { + res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param default &':' + arg_ty a; + expr_ty c; + if ( + (a = lambda_param_rule(p)) + && + (c = default_rule(p)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) ) { - res = _PyPegen_name_default_pair ( p , n , e , NULL ); + res = _PyPegen_name_default_pair ( p , a , c , NULL ); if (res == NULL && PyErr_Occurred()) { p->error_indicator = 1; return NULL; @@ -5595,22 +5658,48 @@ lambda_name_with_default_rule(Parser *p) return res; } -// lambda_plain_names: ','.(lambda_plain_name !'=')+ -static asdl_seq* -lambda_plain_names_rule(Parser *p) +// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' +static NameDefaultPair* +lambda_param_maybe_default_rule(Parser *p) { if (p->error_indicator) { return NULL; } - asdl_seq* res = NULL; + NameDefaultPair* res = NULL; int mark = p->mark; - { // ','.(lambda_plain_name !'=')+ - asdl_seq * a; + { // lambda_param default? ',' + arg_ty a; + void *c; + Token * literal; if ( - (a = _gather_91_rule(p)) + (a = lambda_param_rule(p)) + && + (c = default_rule(p), 1) + && + (literal = _PyPegen_expect_token(p, 12)) ) { - res = a; + res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param default? &':' + arg_ty a; + void *c; + if ( + (a = lambda_param_rule(p)) + && + (c = default_rule(p), 1) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) + ) + { + res = _PyPegen_name_default_pair ( p , a , c , NULL ); if (res == NULL && PyErr_Occurred()) { p->error_indicator = 1; return NULL; @@ -5624,9 +5713,9 @@ lambda_plain_names_rule(Parser *p) return res; } -// lambda_plain_name: NAME +// lambda_param: NAME static arg_ty -lambda_plain_name_rule(Parser *p) +lambda_param_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -5669,38 +5758,6 @@ lambda_plain_name_rule(Parser *p) return res; } -// lambda_kwds: '**' lambda_plain_name -static arg_ty -lambda_kwds_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - arg_ty res = NULL; - int mark = p->mark; - { // '**' lambda_plain_name - arg_ty a; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 35)) - && - (a = lambda_plain_name_rule(p)) - ) - { - res = a; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - // disjunction: conjunction (('or' conjunction))+ | conjunction static expr_ty disjunction_rule(Parser *p) @@ -5726,7 +5783,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) && - (b = _loop1_93_rule(p)) + (b = _loop1_89_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -5788,7 +5845,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) && - (b = _loop1_94_rule(p)) + (b = _loop1_90_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -5910,7 +5967,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) && - (b = _loop1_95_rule(p)) + (b = _loop1_91_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -6122,10 +6179,10 @@ noteq_bitwise_or_rule(Parser *p) CmpopExprPair* res = NULL; int mark = p->mark; { // ('!=') bitwise_or - void *_tmp_96_var; + void *_tmp_92_var; expr_ty a; if ( - (_tmp_96_var = _tmp_96_rule(p)) + (_tmp_92_var = _tmp_92_rule(p)) && (a = bitwise_or_rule(p)) ) @@ -7567,7 +7624,7 @@ slices_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_97_rule(p)) + (a = _gather_93_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -7623,7 +7680,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) && - (c = _tmp_99_rule(p), 1) + (c = _tmp_95_rule(p), 1) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -7811,40 +7868,40 @@ atom_rule(Parser *p) p->mark = mark; } { // &'(' (tuple | group | genexp) - void *_tmp_100_var; + void *_tmp_96_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) && - (_tmp_100_var = _tmp_100_rule(p)) + (_tmp_96_var = _tmp_96_rule(p)) ) { - res = _tmp_100_var; + res = _tmp_96_var; goto done; } p->mark = mark; } { // &'[' (list | listcomp) - void *_tmp_101_var; + void *_tmp_97_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) && - (_tmp_101_var = _tmp_101_rule(p)) + (_tmp_97_var = _tmp_97_rule(p)) ) { - res = _tmp_101_var; + res = _tmp_97_var; goto done; } p->mark = mark; } { // &'{' (dict | set | dictcomp | setcomp) - void *_tmp_102_var; + void *_tmp_98_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) && - (_tmp_102_var = _tmp_102_rule(p)) + (_tmp_98_var = _tmp_98_rule(p)) ) { - res = _tmp_102_var; + res = _tmp_98_var; goto done; } p->mark = mark; @@ -7891,7 +7948,7 @@ strings_rule(Parser *p) { // STRING+ asdl_seq * a; if ( - (a = _loop1_103_rule(p)) + (a = _loop1_99_rule(p)) ) { res = _PyPegen_concatenate_strings ( p , a ); @@ -8049,7 +8106,7 @@ tuple_rule(Parser *p) if ( (literal = _PyPegen_expect_token(p, 7)) && - (a = _tmp_104_rule(p), 1) + (a = _tmp_100_rule(p), 1) && (literal_1 = _PyPegen_expect_token(p, 8)) ) @@ -8092,7 +8149,7 @@ group_rule(Parser *p) if ( (literal = _PyPegen_expect_token(p, 7)) && - (a = _tmp_105_rule(p)) + (a = _tmp_101_rule(p)) && (literal_1 = _PyPegen_expect_token(p, 8)) ) @@ -8411,7 +8468,7 @@ kvpairs_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_106_rule(p)) + (a = _gather_102_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -8493,12 +8550,12 @@ for_if_clauses_rule(Parser *p) asdl_seq* res = NULL; int mark = p->mark; { // for_if_clause+ - asdl_seq * _loop1_108_var; + asdl_seq * _loop1_104_var; if ( - (_loop1_108_var = _loop1_108_rule(p)) + (_loop1_104_var = _loop1_104_rule(p)) ) { - res = _loop1_108_var; + res = _loop1_104_var; goto done; } p->mark = mark; @@ -8537,7 +8594,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) && - (c = _loop0_109_rule(p)) + (c = _loop0_105_rule(p)) ) { res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); @@ -8564,7 +8621,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) && - (c = _loop0_110_rule(p)) + (c = _loop0_106_rule(p)) ) { res = _Py_comprehension ( a , b , c , 0 , p -> arena ); @@ -8730,7 +8787,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) && - (b = _tmp_111_rule(p), 1) + (b = _tmp_107_rule(p), 1) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -8779,7 +8836,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) && - (b = _tmp_112_rule(p), 1) + (b = _tmp_108_rule(p), 1) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -8821,11 +8878,11 @@ kwargs_rule(Parser *p) asdl_seq * b; Token * literal; if ( - (a = _gather_113_rule(p)) + (a = _gather_109_rule(p)) && (literal = _PyPegen_expect_token(p, 12)) && - (b = _gather_115_rule(p)) + (b = _gather_111_rule(p)) ) { res = _PyPegen_join_sequences ( p , a , b ); @@ -8838,23 +8895,23 @@ kwargs_rule(Parser *p) p->mark = mark; } { // ','.kwarg_or_starred+ - asdl_seq * _gather_117_var; + asdl_seq * _gather_113_var; if ( - (_gather_117_var = _gather_117_rule(p)) + (_gather_113_var = _gather_113_rule(p)) ) { - res = _gather_117_var; + res = _gather_113_var; goto done; } p->mark = mark; } { // ','.kwarg_or_double_starred+ - asdl_seq * _gather_119_var; + asdl_seq * _gather_115_var; if ( - (_gather_119_var = _gather_119_rule(p)) + (_gather_115_var = _gather_115_rule(p)) ) { - res = _gather_119_var; + res = _gather_115_var; goto done; } p->mark = mark; @@ -9097,7 +9154,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) && - (b = _loop0_121_rule(p)) + (b = _loop0_117_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -9138,7 +9195,7 @@ star_targets_seq_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_122_rule(p)) + (a = _gather_118_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -9186,7 +9243,7 @@ star_target_rule(Parser *p) if ( (literal = _PyPegen_expect_token(p, 16)) && - (a = _tmp_124_rule(p)) + (a = _tmp_120_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -9575,7 +9632,7 @@ del_targets_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_125_rule(p)) + (a = _gather_121_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -9828,7 +9885,7 @@ targets_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_127_rule(p)) + (a = _gather_123_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -10356,7 +10413,7 @@ incorrect_arguments_rule(Parser *p) && (literal = _PyPegen_expect_token(p, 12)) && - (opt_var = _tmp_129_rule(p), 1) + (opt_var = _tmp_125_rule(p), 1) ) { res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" ); @@ -10491,7 +10548,7 @@ invalid_assignment_rule(Parser *p) && (expression_var_1 = expression_rule(p)) && - (opt_var = _tmp_130_rule(p), 1) + (opt_var = _tmp_126_rule(p), 1) ) { res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" ); @@ -10504,15 +10561,15 @@ invalid_assignment_rule(Parser *p) p->mark = mark; } { // expression ('=' | augassign) (yield_expr | star_expressions) - void *_tmp_131_var; - void *_tmp_132_var; + void *_tmp_127_var; + void *_tmp_128_var; expr_ty a; if ( (a = expression_rule(p)) && - (_tmp_131_var = _tmp_131_rule(p)) + (_tmp_127_var = _tmp_127_rule(p)) && - (_tmp_132_var = _tmp_132_rule(p)) + (_tmp_128_var = _tmp_128_rule(p)) ) { res = RAISE_SYNTAX_ERROR_NO_COL_OFFSET ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) ); @@ -10570,12 +10627,12 @@ invalid_comprehension_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ('[' | '(' | '{') '*' expression for_if_clauses - void *_tmp_133_var; + void *_tmp_129_var; expr_ty expression_var; asdl_seq* for_if_clauses_var; Token * literal; if ( - (_tmp_133_var = _tmp_133_rule(p)) + (_tmp_129_var = _tmp_129_rule(p)) && (literal = _PyPegen_expect_token(p, 16)) && @@ -10609,13 +10666,13 @@ invalid_parameters_rule(Parser *p) void * res = NULL; int mark = p->mark; { // param_no_default* (slash_with_default | param_with_default+) param_no_default - asdl_seq * _loop0_134_var; - void *_tmp_135_var; + asdl_seq * _loop0_130_var; + void *_tmp_131_var; arg_ty param_no_default_var; if ( - (_loop0_134_var = _loop0_134_rule(p)) + (_loop0_130_var = _loop0_130_rule(p)) && - (_tmp_135_var = _tmp_135_rule(p)) + (_tmp_131_var = _tmp_131_rule(p)) && (param_no_default_var = param_no_default_rule(p)) ) @@ -11570,12 +11627,12 @@ _loop1_22_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (star_targets '=') - void *_tmp_136_var; + void *_tmp_132_var; while ( - (_tmp_136_var = _tmp_136_rule(p)) + (_tmp_132_var = _tmp_132_rule(p)) ) { - res = _tmp_136_var; + res = _tmp_132_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -11897,12 +11954,12 @@ _loop0_30_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('.' | '...') - void *_tmp_137_var; + void *_tmp_133_var; while ( - (_tmp_137_var = _tmp_137_rule(p)) + (_tmp_133_var = _tmp_133_rule(p)) ) { - res = _tmp_137_var; + res = _tmp_133_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -11946,12 +12003,12 @@ _loop1_31_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('.' | '...') - void *_tmp_138_var; + void *_tmp_134_var; while ( - (_tmp_138_var = _tmp_138_rule(p)) + (_tmp_134_var = _tmp_134_rule(p)) ) { - res = _tmp_138_var; + res = _tmp_134_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13528,12 +13585,12 @@ _loop1_67_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('@' named_expression NEWLINE) - void *_tmp_139_var; + void *_tmp_135_var; while ( - (_tmp_139_var = _tmp_139_rule(p)) + (_tmp_135_var = _tmp_135_rule(p)) ) { - res = _tmp_139_var; + res = _tmp_135_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13701,12 +13758,12 @@ _loop1_71_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' star_expression) - void *_tmp_140_var; + void *_tmp_136_var; while ( - (_tmp_140_var = _tmp_140_rule(p)) + (_tmp_136_var = _tmp_136_rule(p)) ) { - res = _tmp_140_var; + res = _tmp_136_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13839,12 +13896,12 @@ _loop1_74_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' expression) - void *_tmp_141_var; + void *_tmp_137_var; while ( - (_tmp_141_var = _tmp_141_rule(p)) + (_tmp_137_var = _tmp_137_rule(p)) ) { - res = _tmp_141_var; + res = _tmp_137_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13874,297 +13931,519 @@ _loop1_74_rule(Parser *p) return seq; } -// _tmp_75: ',' lambda_plain_names -static void * -_tmp_75_rule(Parser *p) +// _loop0_75: lambda_param_no_default +static asdl_seq * +_loop0_75_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_plain_names - Token * literal; - asdl_seq* x; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (x = lambda_plain_names_rule(p)) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = x; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } p->mark = mark; } - res = NULL; - done: - return res; + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_75"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop0_75_type, seq); + return seq; } -// _tmp_76: ',' lambda_names_with_default -static void * -_tmp_76_rule(Parser *p) +// _loop0_76: lambda_param_with_default +static asdl_seq * +_loop0_76_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_names_with_default - Token * literal; - asdl_seq* y; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (y = lambda_names_with_default_rule(p)) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = y; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_76"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop0_76_type, seq); + return seq; } -// _tmp_77: ',' lambda_star_etc? -static void * -_tmp_77_rule(Parser *p) +// _loop0_77: lambda_param_with_default +static asdl_seq * +_loop0_77_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_77"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop0_77_type, seq); + return seq; } -// _tmp_78: ',' lambda_names_with_default -static void * -_tmp_78_rule(Parser *p) +// _loop1_78: lambda_param_no_default +static asdl_seq * +_loop1_78_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_names_with_default - Token * literal; - asdl_seq* y; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (y = lambda_names_with_default_rule(p)) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = y; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_78"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop1_78_type, seq); + return seq; } -// _tmp_79: ',' lambda_star_etc? -static void * -_tmp_79_rule(Parser *p) +// _loop0_79: lambda_param_with_default +static asdl_seq * +_loop0_79_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_79"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop0_79_type, seq); + return seq; } -// _tmp_80: ',' lambda_names_with_default -static void * -_tmp_80_rule(Parser *p) +// _loop1_80: lambda_param_with_default +static asdl_seq * +_loop1_80_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_names_with_default - Token * literal; - asdl_seq* y; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (y = lambda_names_with_default_rule(p)) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = y; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_80"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop1_80_type, seq); + return seq; } -// _tmp_81: ',' lambda_star_etc? -static void * -_tmp_81_rule(Parser *p) +// _loop1_81: lambda_param_no_default +static asdl_seq * +_loop1_81_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_81"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop1_81_type, seq); + return seq; } -// _tmp_82: ',' lambda_star_etc? -static void * -_tmp_82_rule(Parser *p) +// _loop1_82: lambda_param_no_default +static asdl_seq * +_loop1_82_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_82"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop1_82_type, seq); + return seq; } -// _tmp_83: lambda_plain_names ',' -static void * -_tmp_83_rule(Parser *p) +// _loop0_83: lambda_param_no_default +static asdl_seq * +_loop0_83_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // lambda_plain_names ',' - Token * literal; - asdl_seq* n; - if ( - (n = lambda_plain_names_rule(p)) - && - (literal = _PyPegen_expect_token(p, 12)) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = n; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_83"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop0_83_type, seq); + return seq; +} + +// _loop1_84: lambda_param_with_default +static asdl_seq * +_loop1_84_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) + ) + { + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_84"); + PyMem_Free(children); + return NULL; + } + for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); + PyMem_Free(children); + _PyPegen_insert_memo(p, start_mark, _loop1_84_type, seq); + return seq; } -// _loop0_84: lambda_name_with_optional_default +// _loop0_85: lambda_param_no_default static asdl_seq * -_loop0_84_rule(Parser *p) +_loop0_85_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14179,13 +14458,13 @@ _loop0_84_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // lambda_name_with_optional_default - NameDefaultPair* lambda_name_with_optional_default_var; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; while ( - (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p)) + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = lambda_name_with_optional_default_var; + res = lambda_param_no_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14201,49 +14480,17 @@ _loop0_84_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_84"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_85"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_84_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_85_type, seq); return seq; } -// _tmp_85: ',' lambda_kwds -static void * -_tmp_85_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_kwds - arg_ty d; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (d = lambda_kwds_rule(p)) - ) - { - res = d; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop1_86: lambda_name_with_optional_default +// _loop1_86: lambda_param_with_default static asdl_seq * _loop1_86_rule(Parser *p) { @@ -14260,13 +14507,13 @@ _loop1_86_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // lambda_name_with_optional_default - NameDefaultPair* lambda_name_with_optional_default_var; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; while ( - (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p)) + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = lambda_name_with_optional_default_var; + res = lambda_param_with_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14296,73 +14543,9 @@ _loop1_86_rule(Parser *p) return seq; } -// _tmp_87: ',' lambda_kwds -static void * -_tmp_87_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_kwds - arg_ty d; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (d = lambda_kwds_rule(p)) - ) - { - res = d; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_88: '=' expression -static void * -_tmp_88_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // '=' expression - expr_ty e; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 22)) - && - (e = expression_rule(p)) - ) - { - res = e; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_90: ',' lambda_name_with_default +// _loop0_87: lambda_param_maybe_default static asdl_seq * -_loop0_90_rule(Parser *p) +_loop0_87_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14377,21 +14560,13 @@ _loop0_90_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // ',' lambda_name_with_default - NameDefaultPair* elem; - Token * literal; + { // lambda_param_maybe_default + NameDefaultPair* lambda_param_maybe_default_var; while ( - (literal = _PyPegen_expect_token(p, 12)) - && - (elem = lambda_name_with_default_rule(p)) + (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) ) { - res = elem; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(children); - return NULL; - } + res = lambda_param_maybe_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14407,47 +14582,19 @@ _loop0_90_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_90"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_90_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq); return seq; } -// _gather_89: lambda_name_with_default _loop0_90 -static asdl_seq * -_gather_89_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq * res = NULL; - int mark = p->mark; - { // lambda_name_with_default _loop0_90 - NameDefaultPair* elem; - asdl_seq * seq; - if ( - (elem = lambda_name_with_default_rule(p)) - && - (seq = _loop0_90_rule(p)) - ) - { - res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_92: ',' (lambda_plain_name !'=') +// _loop1_88: lambda_param_maybe_default static asdl_seq * -_loop0_92_rule(Parser *p) +_loop1_88_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14462,21 +14609,13 @@ _loop0_92_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // ',' (lambda_plain_name !'=') - void *elem; - Token * literal; + { // lambda_param_maybe_default + NameDefaultPair* lambda_param_maybe_default_var; while ( - (literal = _PyPegen_expect_token(p, 12)) - && - (elem = _tmp_142_rule(p)) + (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) ) { - res = elem; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(children); - return NULL; - } + res = lambda_param_maybe_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14490,49 +14629,25 @@ _loop0_92_rule(Parser *p) } p->mark = mark; } + if (n == 0) { + PyMem_Free(children); + return NULL; + } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_92"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_88"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_92_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_88_type, seq); return seq; } -// _gather_91: (lambda_plain_name !'=') _loop0_92 -static asdl_seq * -_gather_91_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq * res = NULL; - int mark = p->mark; - { // (lambda_plain_name !'=') _loop0_92 - void *elem; - asdl_seq * seq; - if ( - (elem = _tmp_142_rule(p)) - && - (seq = _loop0_92_rule(p)) - ) - { - res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop1_93: ('or' conjunction) +// _loop1_89: ('or' conjunction) static asdl_seq * -_loop1_93_rule(Parser *p) +_loop1_89_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14548,12 +14663,12 @@ _loop1_93_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('or' conjunction) - void *_tmp_143_var; + void *_tmp_138_var; while ( - (_tmp_143_var = _tmp_143_rule(p)) + (_tmp_138_var = _tmp_138_rule(p)) ) { - res = _tmp_143_var; + res = _tmp_138_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14573,19 +14688,19 @@ _loop1_93_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_93"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_89"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_93_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_89_type, seq); return seq; } -// _loop1_94: ('and' inversion) +// _loop1_90: ('and' inversion) static asdl_seq * -_loop1_94_rule(Parser *p) +_loop1_90_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14601,12 +14716,12 @@ _loop1_94_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('and' inversion) - void *_tmp_144_var; + void *_tmp_139_var; while ( - (_tmp_144_var = _tmp_144_rule(p)) + (_tmp_139_var = _tmp_139_rule(p)) ) { - res = _tmp_144_var; + res = _tmp_139_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14626,19 +14741,19 @@ _loop1_94_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_94"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_90"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_94_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_90_type, seq); return seq; } -// _loop1_95: compare_op_bitwise_or_pair +// _loop1_91: compare_op_bitwise_or_pair static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_91_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14679,19 +14794,19 @@ _loop1_95_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_95"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_91"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_95_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_91_type, seq); return seq; } -// _tmp_96: '!=' +// _tmp_92: '!=' static void * -_tmp_96_rule(Parser *p) +_tmp_92_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14718,9 +14833,9 @@ _tmp_96_rule(Parser *p) return res; } -// _loop0_98: ',' slice +// _loop0_94: ',' slice static asdl_seq * -_loop0_98_rule(Parser *p) +_loop0_94_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14765,32 +14880,32 @@ _loop0_98_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_98"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_94"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_98_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_94_type, seq); return seq; } -// _gather_97: slice _loop0_98 +// _gather_93: slice _loop0_94 static asdl_seq * -_gather_97_rule(Parser *p) +_gather_93_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // slice _loop0_98 + { // slice _loop0_94 expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) && - (seq = _loop0_98_rule(p)) + (seq = _loop0_94_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -14803,9 +14918,9 @@ _gather_97_rule(Parser *p) return res; } -// _tmp_99: ':' expression? +// _tmp_95: ':' expression? static void * -_tmp_99_rule(Parser *p) +_tmp_95_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14835,9 +14950,9 @@ _tmp_99_rule(Parser *p) return res; } -// _tmp_100: tuple | group | genexp +// _tmp_96: tuple | group | genexp static void * -_tmp_100_rule(Parser *p) +_tmp_96_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14882,9 +14997,9 @@ _tmp_100_rule(Parser *p) return res; } -// _tmp_101: list | listcomp +// _tmp_97: list | listcomp static void * -_tmp_101_rule(Parser *p) +_tmp_97_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14918,9 +15033,9 @@ _tmp_101_rule(Parser *p) return res; } -// _tmp_102: dict | set | dictcomp | setcomp +// _tmp_98: dict | set | dictcomp | setcomp static void * -_tmp_102_rule(Parser *p) +_tmp_98_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14976,9 +15091,9 @@ _tmp_102_rule(Parser *p) return res; } -// _loop1_103: STRING +// _loop1_99: STRING static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_99_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15019,19 +15134,19 @@ _loop1_103_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_103"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_99"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_103_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_99_type, seq); return seq; } -// _tmp_104: star_named_expression ',' star_named_expressions? +// _tmp_100: star_named_expression ',' star_named_expressions? static void * -_tmp_104_rule(Parser *p) +_tmp_100_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15064,9 +15179,9 @@ _tmp_104_rule(Parser *p) return res; } -// _tmp_105: yield_expr | named_expression +// _tmp_101: yield_expr | named_expression static void * -_tmp_105_rule(Parser *p) +_tmp_101_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15100,9 +15215,9 @@ _tmp_105_rule(Parser *p) return res; } -// _loop0_107: ',' kvpair +// _loop0_103: ',' kvpair static asdl_seq * -_loop0_107_rule(Parser *p) +_loop0_103_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15147,32 +15262,32 @@ _loop0_107_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_107"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_103"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_107_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_103_type, seq); return seq; } -// _gather_106: kvpair _loop0_107 +// _gather_102: kvpair _loop0_103 static asdl_seq * -_gather_106_rule(Parser *p) +_gather_102_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // kvpair _loop0_107 + { // kvpair _loop0_103 KeyValuePair* elem; asdl_seq * seq; if ( (elem = kvpair_rule(p)) && - (seq = _loop0_107_rule(p)) + (seq = _loop0_103_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15185,9 +15300,9 @@ _gather_106_rule(Parser *p) return res; } -// _loop1_108: for_if_clause +// _loop1_104: for_if_clause static asdl_seq * -_loop1_108_rule(Parser *p) +_loop1_104_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15228,19 +15343,19 @@ _loop1_108_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_108"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_104"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_108_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_104_type, seq); return seq; } -// _loop0_109: ('if' disjunction) +// _loop0_105: ('if' disjunction) static asdl_seq * -_loop0_109_rule(Parser *p) +_loop0_105_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15256,12 +15371,12 @@ _loop0_109_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('if' disjunction) - void *_tmp_145_var; + void *_tmp_140_var; while ( - (_tmp_145_var = _tmp_145_rule(p)) + (_tmp_140_var = _tmp_140_rule(p)) ) { - res = _tmp_145_var; + res = _tmp_140_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15277,19 +15392,19 @@ _loop0_109_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_109"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_105"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_109_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_105_type, seq); return seq; } -// _loop0_110: ('if' disjunction) +// _loop0_106: ('if' disjunction) static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_106_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15305,12 +15420,12 @@ _loop0_110_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('if' disjunction) - void *_tmp_146_var; + void *_tmp_141_var; while ( - (_tmp_146_var = _tmp_146_rule(p)) + (_tmp_141_var = _tmp_141_rule(p)) ) { - res = _tmp_146_var; + res = _tmp_141_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15326,19 +15441,19 @@ _loop0_110_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_106"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_110_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_106_type, seq); return seq; } -// _tmp_111: ',' args +// _tmp_107: ',' args static void * -_tmp_111_rule(Parser *p) +_tmp_107_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15368,9 +15483,9 @@ _tmp_111_rule(Parser *p) return res; } -// _tmp_112: ',' args +// _tmp_108: ',' args static void * -_tmp_112_rule(Parser *p) +_tmp_108_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15400,9 +15515,9 @@ _tmp_112_rule(Parser *p) return res; } -// _loop0_114: ',' kwarg_or_starred +// _loop0_110: ',' kwarg_or_starred static asdl_seq * -_loop0_114_rule(Parser *p) +_loop0_110_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15447,32 +15562,32 @@ _loop0_114_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_110_type, seq); return seq; } -// _gather_113: kwarg_or_starred _loop0_114 +// _gather_109: kwarg_or_starred _loop0_110 static asdl_seq * -_gather_113_rule(Parser *p) +_gather_109_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // kwarg_or_starred _loop0_114 + { // kwarg_or_starred _loop0_110 KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) && - (seq = _loop0_114_rule(p)) + (seq = _loop0_110_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15485,9 +15600,9 @@ _gather_113_rule(Parser *p) return res; } -// _loop0_116: ',' kwarg_or_double_starred +// _loop0_112: ',' kwarg_or_double_starred static asdl_seq * -_loop0_116_rule(Parser *p) +_loop0_112_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15532,32 +15647,32 @@ _loop0_116_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_112"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_112_type, seq); return seq; } -// _gather_115: kwarg_or_double_starred _loop0_116 +// _gather_111: kwarg_or_double_starred _loop0_112 static asdl_seq * -_gather_115_rule(Parser *p) +_gather_111_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // kwarg_or_double_starred _loop0_116 + { // kwarg_or_double_starred _loop0_112 KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) && - (seq = _loop0_116_rule(p)) + (seq = _loop0_112_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15570,9 +15685,9 @@ _gather_115_rule(Parser *p) return res; } -// _loop0_118: ',' kwarg_or_starred +// _loop0_114: ',' kwarg_or_starred static asdl_seq * -_loop0_118_rule(Parser *p) +_loop0_114_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15617,32 +15732,32 @@ _loop0_118_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_118"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_118_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq); return seq; } -// _gather_117: kwarg_or_starred _loop0_118 +// _gather_113: kwarg_or_starred _loop0_114 static asdl_seq * -_gather_117_rule(Parser *p) +_gather_113_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // kwarg_or_starred _loop0_118 + { // kwarg_or_starred _loop0_114 KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) && - (seq = _loop0_118_rule(p)) + (seq = _loop0_114_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15655,9 +15770,9 @@ _gather_117_rule(Parser *p) return res; } -// _loop0_120: ',' kwarg_or_double_starred +// _loop0_116: ',' kwarg_or_double_starred static asdl_seq * -_loop0_120_rule(Parser *p) +_loop0_116_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15702,32 +15817,32 @@ _loop0_120_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_120"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_120_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq); return seq; } -// _gather_119: kwarg_or_double_starred _loop0_120 +// _gather_115: kwarg_or_double_starred _loop0_116 static asdl_seq * -_gather_119_rule(Parser *p) +_gather_115_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // kwarg_or_double_starred _loop0_120 + { // kwarg_or_double_starred _loop0_116 KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) && - (seq = _loop0_120_rule(p)) + (seq = _loop0_116_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15740,9 +15855,9 @@ _gather_119_rule(Parser *p) return res; } -// _loop0_121: (',' star_target) +// _loop0_117: (',' star_target) static asdl_seq * -_loop0_121_rule(Parser *p) +_loop0_117_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15758,12 +15873,12 @@ _loop0_121_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' star_target) - void *_tmp_147_var; + void *_tmp_142_var; while ( - (_tmp_147_var = _tmp_147_rule(p)) + (_tmp_142_var = _tmp_142_rule(p)) ) { - res = _tmp_147_var; + res = _tmp_142_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15779,19 +15894,19 @@ _loop0_121_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_121"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_117"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_121_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_117_type, seq); return seq; } -// _loop0_123: ',' star_target +// _loop0_119: ',' star_target static asdl_seq * -_loop0_123_rule(Parser *p) +_loop0_119_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15836,32 +15951,32 @@ _loop0_123_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_123"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_119"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_123_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_119_type, seq); return seq; } -// _gather_122: star_target _loop0_123 +// _gather_118: star_target _loop0_119 static asdl_seq * -_gather_122_rule(Parser *p) +_gather_118_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // star_target _loop0_123 + { // star_target _loop0_119 expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) && - (seq = _loop0_123_rule(p)) + (seq = _loop0_119_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15874,9 +15989,9 @@ _gather_122_rule(Parser *p) return res; } -// _tmp_124: !'*' star_target +// _tmp_120: !'*' star_target static void * -_tmp_124_rule(Parser *p) +_tmp_120_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15901,9 +16016,9 @@ _tmp_124_rule(Parser *p) return res; } -// _loop0_126: ',' del_target +// _loop0_122: ',' del_target static asdl_seq * -_loop0_126_rule(Parser *p) +_loop0_122_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15948,32 +16063,32 @@ _loop0_126_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_126"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_122"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_126_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_122_type, seq); return seq; } -// _gather_125: del_target _loop0_126 +// _gather_121: del_target _loop0_122 static asdl_seq * -_gather_125_rule(Parser *p) +_gather_121_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // del_target _loop0_126 + { // del_target _loop0_122 expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) && - (seq = _loop0_126_rule(p)) + (seq = _loop0_122_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15986,9 +16101,9 @@ _gather_125_rule(Parser *p) return res; } -// _loop0_128: ',' target +// _loop0_124: ',' target static asdl_seq * -_loop0_128_rule(Parser *p) +_loop0_124_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16033,32 +16148,32 @@ _loop0_128_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_128"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_124"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_128_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_124_type, seq); return seq; } -// _gather_127: target _loop0_128 +// _gather_123: target _loop0_124 static asdl_seq * -_gather_127_rule(Parser *p) +_gather_123_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // target _loop0_128 + { // target _loop0_124 expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) && - (seq = _loop0_128_rule(p)) + (seq = _loop0_124_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -16071,9 +16186,9 @@ _gather_127_rule(Parser *p) return res; } -// _tmp_129: args | expression for_if_clauses +// _tmp_125: args | expression for_if_clauses static void * -_tmp_129_rule(Parser *p) +_tmp_125_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16110,9 +16225,9 @@ _tmp_129_rule(Parser *p) return res; } -// _tmp_130: '=' annotated_rhs +// _tmp_126: '=' annotated_rhs static void * -_tmp_130_rule(Parser *p) +_tmp_126_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16138,9 +16253,9 @@ _tmp_130_rule(Parser *p) return res; } -// _tmp_131: '=' | augassign +// _tmp_127: '=' | augassign static void * -_tmp_131_rule(Parser *p) +_tmp_127_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16174,9 +16289,9 @@ _tmp_131_rule(Parser *p) return res; } -// _tmp_132: yield_expr | star_expressions +// _tmp_128: yield_expr | star_expressions static void * -_tmp_132_rule(Parser *p) +_tmp_128_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16210,9 +16325,9 @@ _tmp_132_rule(Parser *p) return res; } -// _tmp_133: '[' | '(' | '{' +// _tmp_129: '[' | '(' | '{' static void * -_tmp_133_rule(Parser *p) +_tmp_129_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16257,9 +16372,9 @@ _tmp_133_rule(Parser *p) return res; } -// _loop0_134: param_no_default +// _loop0_130: param_no_default static asdl_seq * -_loop0_134_rule(Parser *p) +_loop0_130_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16296,19 +16411,19 @@ _loop0_134_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_134"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_130"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop0_134_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_130_type, seq); return seq; } -// _tmp_135: slash_with_default | param_with_default+ +// _tmp_131: slash_with_default | param_with_default+ static void * -_tmp_135_rule(Parser *p) +_tmp_131_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16327,12 +16442,12 @@ _tmp_135_rule(Parser *p) p->mark = mark; } { // param_with_default+ - asdl_seq * _loop1_148_var; + asdl_seq * _loop1_143_var; if ( - (_loop1_148_var = _loop1_148_rule(p)) + (_loop1_143_var = _loop1_143_rule(p)) ) { - res = _loop1_148_var; + res = _loop1_143_var; goto done; } p->mark = mark; @@ -16342,9 +16457,9 @@ _tmp_135_rule(Parser *p) return res; } -// _tmp_136: star_targets '=' +// _tmp_132: star_targets '=' static void * -_tmp_136_rule(Parser *p) +_tmp_132_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16374,9 +16489,9 @@ _tmp_136_rule(Parser *p) return res; } -// _tmp_137: '.' | '...' +// _tmp_133: '.' | '...' static void * -_tmp_137_rule(Parser *p) +_tmp_133_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16410,9 +16525,9 @@ _tmp_137_rule(Parser *p) return res; } -// _tmp_138: '.' | '...' +// _tmp_134: '.' | '...' static void * -_tmp_138_rule(Parser *p) +_tmp_134_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16446,9 +16561,9 @@ _tmp_138_rule(Parser *p) return res; } -// _tmp_139: '@' named_expression NEWLINE +// _tmp_135: '@' named_expression NEWLINE static void * -_tmp_139_rule(Parser *p) +_tmp_135_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16481,9 +16596,9 @@ _tmp_139_rule(Parser *p) return res; } -// _tmp_140: ',' star_expression +// _tmp_136: ',' star_expression static void * -_tmp_140_rule(Parser *p) +_tmp_136_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16513,9 +16628,9 @@ _tmp_140_rule(Parser *p) return res; } -// _tmp_141: ',' expression +// _tmp_137: ',' expression static void * -_tmp_141_rule(Parser *p) +_tmp_137_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16545,36 +16660,9 @@ _tmp_141_rule(Parser *p) return res; } -// _tmp_142: lambda_plain_name !'=' -static void * -_tmp_142_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // lambda_plain_name !'=' - arg_ty lambda_plain_name_var; - if ( - (lambda_plain_name_var = lambda_plain_name_rule(p)) - && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) - ) - { - res = lambda_plain_name_var; - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_143: 'or' conjunction +// _tmp_138: 'or' conjunction static void * -_tmp_143_rule(Parser *p) +_tmp_138_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16604,9 +16692,9 @@ _tmp_143_rule(Parser *p) return res; } -// _tmp_144: 'and' inversion +// _tmp_139: 'and' inversion static void * -_tmp_144_rule(Parser *p) +_tmp_139_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16636,9 +16724,9 @@ _tmp_144_rule(Parser *p) return res; } -// _tmp_145: 'if' disjunction +// _tmp_140: 'if' disjunction static void * -_tmp_145_rule(Parser *p) +_tmp_140_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16668,9 +16756,9 @@ _tmp_145_rule(Parser *p) return res; } -// _tmp_146: 'if' disjunction +// _tmp_141: 'if' disjunction static void * -_tmp_146_rule(Parser *p) +_tmp_141_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16700,9 +16788,9 @@ _tmp_146_rule(Parser *p) return res; } -// _tmp_147: ',' star_target +// _tmp_142: ',' star_target static void * -_tmp_147_rule(Parser *p) +_tmp_142_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16732,9 +16820,9 @@ _tmp_147_rule(Parser *p) return res; } -// _loop1_148: param_with_default +// _loop1_143: param_with_default static asdl_seq * -_loop1_148_rule(Parser *p) +_loop1_143_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16775,13 +16863,13 @@ _loop1_148_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_148"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_143"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_148_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_143_type, seq); return seq; } From webhook-mailer at python.org Fri May 1 12:42:36 2020 From: webhook-mailer at python.org (Guido van Rossum) Date: Fri, 01 May 2020 16:42:36 -0000 Subject: [Python-checkins] Ensure that tok->type_comments is set on every path (GH-19828) Message-ID: https://github.com/python/cpython/commit/d9d6eadf003605f4cdb55e38df2168dd1bc0dbd5 commit: d9d6eadf003605f4cdb55e38df2168dd1bc0dbd5 branch: master author: Guido van Rossum committer: GitHub date: 2020-05-01T17:42:32+01:00 summary: Ensure that tok->type_comments is set on every path (GH-19828) files: M Parser/pegen/pegen.c diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index a7add8fbb144e..6ff09b3b31f78 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -1017,6 +1017,8 @@ _PyPegen_Parser_New(struct tok_state *tok, int start_rule, int flags, return (Parser *) PyErr_NoMemory(); } assert(tok != NULL); + tok->type_comments = (flags & PyPARSE_TYPE_COMMENTS) > 0; + tok->async_hacks = (flags & PyPARSE_ASYNC_HACKS) > 0; p->tok = tok; p->keywords = NULL; p->n_keyword_lists = -1; @@ -1172,9 +1174,6 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen int parser_flags = compute_parser_flags(flags); int feature_version = flags ? flags->cf_feature_version : PY_MINOR_VERSION; - tok->type_comments = (parser_flags & PyPARSE_TYPE_COMMENTS) > 0; - tok->async_hacks = (parser_flags & PyPARSE_ASYNC_HACKS) > 0; - Parser *p = _PyPegen_Parser_New(tok, start_rule, parser_flags, feature_version, NULL, arena); if (p == NULL) { From webhook-mailer at python.org Fri May 1 13:31:00 2020 From: webhook-mailer at python.org (Lysandros Nikolaou) Date: Fri, 01 May 2020 17:31:00 -0000 Subject: [Python-checkins] bpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839) Message-ID: https://github.com/python/cpython/commit/03b7642265e65f198682f22648dbe6cf4fff9835 commit: 03b7642265e65f198682f22648dbe6cf4fff9835 branch: master author: Lysandros Nikolaou committer: GitHub date: 2020-05-01T18:30:51+01:00 summary: bpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839) This commit makes both APIs more consistent by doing the following: - Remove the `PyPegen_CodeObjectFrom*` functions, which weren't used and will probably not be needed. Functions like `Py_CompileStringObject` can be used instead. - Include a `const char *filename` parameter in `PyPegen_ASTFromString`. - Rename `PyPegen_ASTFromFile` to `PyPegen_ASTFromFilename`, because its signature is not the same with `PyParser_ASTFromFile`. files: M Include/internal/pegen_interface.h M Modules/_peg_parser.c M Parser/pegen/peg_api.c diff --git a/Include/internal/pegen_interface.h b/Include/internal/pegen_interface.h index adff7315681e3..ee4c77ec00676 100644 --- a/Include/internal/pegen_interface.h +++ b/Include/internal/pegen_interface.h @@ -11,25 +11,34 @@ extern "C" { #include "Python.h" #include "Python-ast.h" -PyAPI_FUNC(mod_ty) PyPegen_ASTFromFile(const char *filename, int mode, PyCompilerFlags*, PyArena *arena); -PyAPI_FUNC(mod_ty) PyPegen_ASTFromString(const char *str, int mode, PyCompilerFlags *flags, - PyArena *arena); -PyAPI_FUNC(mod_ty) PyPegen_ASTFromStringObject(const char *str, PyObject* filename, int mode, - PyCompilerFlags *flags, PyArena *arena); -PyAPI_FUNC(mod_ty) PyPegen_ASTFromFileObject(FILE *fp, PyObject *filename_ob, - int mode, const char *enc, const char *ps1, - const char *ps2, PyCompilerFlags *flags, - int *errcode, PyArena *arena); -PyAPI_FUNC(PyCodeObject *) PyPegen_CodeObjectFromFile(const char *filename, int mode, PyCompilerFlags *flags); -PyAPI_FUNC(PyCodeObject *) PyPegen_CodeObjectFromString(const char *str, int mode, - PyCompilerFlags *flags); -PyAPI_FUNC(PyCodeObject *) PyPegen_CodeObjectFromFileObject(FILE *, PyObject *filename_ob, - int mode, - const char *ps1, - const char *ps2, - PyCompilerFlags *flags, - const char *enc, - int *errcode); +PyAPI_FUNC(mod_ty) PyPegen_ASTFromString( + const char *str, + const char *filename, + int mode, + PyCompilerFlags *flags, + PyArena *arena); +PyAPI_FUNC(mod_ty) PyPegen_ASTFromStringObject( + const char *str, + PyObject* filename, + int mode, + PyCompilerFlags *flags, + PyArena *arena); +PyAPI_FUNC(mod_ty) PyPegen_ASTFromFileObject( + FILE *fp, + PyObject *filename_ob, + int mode, + const char *enc, + const char *ps1, + const char *ps2, + PyCompilerFlags *flags, + int *errcode, + PyArena *arena); +PyAPI_FUNC(mod_ty) PyPegen_ASTFromFilename( + const char *filename, + int mode, + PyCompilerFlags *flags, + PyArena *arena); + #ifdef __cplusplus } diff --git a/Modules/_peg_parser.c b/Modules/_peg_parser.c index 59b80f9e06e9e..3b27b2c9cbaa2 100644 --- a/Modules/_peg_parser.c +++ b/Modules/_peg_parser.c @@ -31,7 +31,7 @@ _Py_parse_file(PyObject *self, PyObject *args, PyObject *kwds) PyCompilerFlags flags = _PyCompilerFlags_INIT; PyObject *result = NULL; - mod_ty res = PyPegen_ASTFromFile(filename, mode, &flags, arena); + mod_ty res = PyPegen_ASTFromFilename(filename, mode, &flags, arena); if (res == NULL) { goto error; } @@ -84,7 +84,7 @@ _Py_parse_string(PyObject *self, PyObject *args, PyObject *kwds) res = PyParser_ASTFromString(the_string, "", mode, &flags, arena); } else { - res = PyPegen_ASTFromString(the_string, mode, &flags, arena); + res = PyPegen_ASTFromString(the_string, "", mode, &flags, arena); } if (res == NULL) { goto error; diff --git a/Parser/pegen/peg_api.c b/Parser/pegen/peg_api.c index 31ac2e1399265..5e71ecdb13cf0 100644 --- a/Parser/pegen/peg_api.c +++ b/Parser/pegen/peg_api.c @@ -4,9 +4,10 @@ #include "pegen.h" mod_ty -PyPegen_ASTFromString(const char *str, int mode, PyCompilerFlags *flags, PyArena *arena) +PyPegen_ASTFromString(const char *str, const char *filename, int mode, + PyCompilerFlags *flags, PyArena *arena) { - PyObject *filename_ob = PyUnicode_FromString(""); + PyObject *filename_ob = PyUnicode_FromString(filename); if (filename_ob == NULL) { return NULL; } @@ -16,7 +17,8 @@ PyPegen_ASTFromString(const char *str, int mode, PyCompilerFlags *flags, PyArena } mod_ty -PyPegen_ASTFromStringObject(const char *str, PyObject* filename, int mode, PyCompilerFlags *flags, PyArena *arena) +PyPegen_ASTFromStringObject(const char *str, PyObject* filename, int mode, + PyCompilerFlags *flags, PyArena *arena) { if (PySys_Audit("compile", "yO", str, filename) < 0) { return NULL; @@ -27,7 +29,7 @@ PyPegen_ASTFromStringObject(const char *str, PyObject* filename, int mode, PyCom } mod_ty -PyPegen_ASTFromFile(const char *filename, int mode, PyCompilerFlags *flags, PyArena *arena) +PyPegen_ASTFromFilename(const char *filename, int mode, PyCompilerFlags *flags, PyArena *arena) { PyObject *filename_ob = PyUnicode_FromString(filename); if (filename_ob == NULL) { @@ -50,84 +52,3 @@ PyPegen_ASTFromFileObject(FILE *fp, PyObject *filename_ob, int mode, return _PyPegen_run_parser_from_file_pointer(fp, mode, filename_ob, enc, ps1, ps2, flags, errcode, arena); } - -PyCodeObject * -PyPegen_CodeObjectFromString(const char *str, int mode, PyCompilerFlags *flags) -{ - PyArena *arena = PyArena_New(); - if (arena == NULL) { - return NULL; - } - - PyCodeObject *result = NULL; - - PyObject *filename_ob = PyUnicode_FromString(""); - if (filename_ob == NULL) { - goto error; - } - - mod_ty res = PyPegen_ASTFromString(str, mode, flags, arena); - if (res == NULL) { - goto error; - } - - result = PyAST_CompileObject(res, filename_ob, NULL, -1, arena); - -error: - Py_XDECREF(filename_ob); - PyArena_Free(arena); - return result; -} - -PyCodeObject * -PyPegen_CodeObjectFromFile(const char *filename, int mode, PyCompilerFlags* flags) -{ - PyArena *arena = PyArena_New(); - if (arena == NULL) { - return NULL; - } - - PyCodeObject *result = NULL; - - PyObject *filename_ob = PyUnicode_FromString(filename); - if (filename_ob == NULL) { - goto error; - } - - mod_ty res = PyPegen_ASTFromFile(filename, mode, flags, arena); - if (res == NULL) { - goto error; - } - - result = PyAST_CompileObject(res, filename_ob, NULL, -1, arena); - -error: - Py_XDECREF(filename_ob); - PyArena_Free(arena); - return result; -} - -PyCodeObject * -PyPegen_CodeObjectFromFileObject(FILE *fp, PyObject *filename_ob, int mode, - const char *ps1, const char *ps2, - PyCompilerFlags *flags, const char *enc, int *errcode) -{ - PyArena *arena = PyArena_New(); - if (arena == NULL) { - return NULL; - } - - PyCodeObject *result = NULL; - - mod_ty res = PyPegen_ASTFromFileObject(fp, filename_ob, mode, enc, ps1, ps2, - flags, errcode, arena); - if (res == NULL) { - goto error; - } - - result = PyAST_CompileObject(res, filename_ob, NULL, -1, arena); - -error: - PyArena_Free(arena); - return result; -} From webhook-mailer at python.org Fri May 1 13:34:28 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Fri, 01 May 2020 17:34:28 -0000 Subject: [Python-checkins] Simplify choice()'s interaction with the private _randbelow() method (GH-19831) Message-ID: https://github.com/python/cpython/commit/4168f1e46041645cf54bd053981270d8c4c1313b commit: 4168f1e46041645cf54bd053981270d8c4c1313b branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-01T10:34:19-07:00 summary: Simplify choice()'s interaction with the private _randbelow() method (GH-19831) files: M Lib/random.py M Lib/test/test_random.py diff --git a/Lib/random.py b/Lib/random.py index 80fe447db6c86..8f840e1abb908 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -265,10 +265,10 @@ def randint(self, a, b): return self.randrange(a, b+1) def _randbelow_with_getrandbits(self, n): - "Return a random int in the range [0,n). Raises ValueError if n==0." + "Return a random int in the range [0,n). Returns 0 if n==0." if not n: - raise ValueError("Boundary cannot be zero") + return 0 getrandbits = self.getrandbits k = n.bit_length() # don't use (n-1) here because n can be 1 r = getrandbits(k) # 0 <= r < 2**k @@ -277,7 +277,7 @@ def _randbelow_with_getrandbits(self, n): return r def _randbelow_without_getrandbits(self, n, int=int, maxsize=1< https://github.com/python/cpython/commit/831d58d7865cb98fa09227dc614f4f3ce6af968b commit: 831d58d7865cb98fa09227dc614f4f3ce6af968b branch: master author: Shantanu committer: GitHub date: 2020-05-01T18:52:10+01:00 summary: bpo-39691: Clarify io.open_code behavior (GH-19824) files: M Doc/library/io.rst diff --git a/Doc/library/io.rst b/Doc/library/io.rst index f0987da9b6a4c..aecbec56866d7 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -132,12 +132,13 @@ High-level Module Interface Opens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code. - ``path`` should be an absolute path. + ``path`` should be a :class:`str` and an absolute path. The behavior of this function may be overridden by an earlier call to the - :c:func:`PyFile_SetOpenCodeHook`, however, it should always be considered - interchangeable with ``open(path, 'rb')``. Overriding the behavior is - intended for additional validation or preprocessing of the file. + :c:func:`PyFile_SetOpenCodeHook`. However, assuming that ``path`` is a + :class:`str` and an absolute path, ``open_code(path)`` should always behave + the same as ``open(path, 'rb')``. Overriding the behavior is intended for + additional validation or preprocessing of the file. .. versionadded:: 3.8 From webhook-mailer at python.org Fri May 1 14:04:33 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 01 May 2020 18:04:33 -0000 Subject: [Python-checkins] bpo-39691: Clarify io.open_code behavior (GH-19824) Message-ID: https://github.com/python/cpython/commit/c9d7d32b6dc6140f7fcbf1ae1120df6d59fc28d0 commit: c9d7d32b6dc6140f7fcbf1ae1120df6d59fc28d0 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-01T11:04:25-07:00 summary: bpo-39691: Clarify io.open_code behavior (GH-19824) (cherry picked from commit 831d58d7865cb98fa09227dc614f4f3ce6af968b) Co-authored-by: Shantanu files: M Doc/library/io.rst diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 70e01153d4196..32151a0ace458 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -132,12 +132,13 @@ High-level Module Interface Opens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code. - ``path`` should be an absolute path. + ``path`` should be a :class:`str` and an absolute path. The behavior of this function may be overridden by an earlier call to the - :c:func:`PyFile_SetOpenCodeHook`, however, it should always be considered - interchangeable with ``open(path, 'rb')``. Overriding the behavior is - intended for additional validation or preprocessing of the file. + :c:func:`PyFile_SetOpenCodeHook`. However, assuming that ``path`` is a + :class:`str` and an absolute path, ``open_code(path)`` should always behave + the same as ``open(path, 'rb')``. Overriding the behavior is intended for + additional validation or preprocessing of the file. .. versionadded:: 3.8 From webhook-mailer at python.org Fri May 1 14:07:58 2020 From: webhook-mailer at python.org (Gregory Szorc) Date: Fri, 01 May 2020 18:07:58 -0000 Subject: [Python-checkins] bpo-40412: Nullify inittab_copy during finalization (GH-19746) Message-ID: https://github.com/python/cpython/commit/64224a4727321a8dd33e6f769edda401193ebef0 commit: 64224a4727321a8dd33e6f769edda401193ebef0 branch: master author: Gregory Szorc committer: GitHub date: 2020-05-01T11:07:54-07:00 summary: bpo-40412: Nullify inittab_copy during finalization (GH-19746) Otherwise we leave a dangling pointer to free'd memory. If we then initialize a new interpreter in the same process and call PyImport_ExtendInittab, we will (likely) crash when calling PyMem_RawRealloc(inittab_copy, ...) since the pointer address is bogus. Automerge-Triggered-By: @brettcannon files: A Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst M Python/import.c diff --git a/Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst b/Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst new file mode 100644 index 0000000000000..92bfcddf115a6 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst @@ -0,0 +1 @@ +Nullify inittab_copy during finalization, preventing future interpreter initializations in an embedded situation from crashing. Patch by Gregory Szorc. diff --git a/Python/import.c b/Python/import.c index 8c94e0ec54655..400b02abbdba0 100644 --- a/Python/import.c +++ b/Python/import.c @@ -298,6 +298,7 @@ _PyImport_Fini2(void) /* Free memory allocated by PyImport_ExtendInittab() */ PyMem_RawFree(inittab_copy); + inittab_copy = NULL; PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } From webhook-mailer at python.org Fri May 1 15:46:10 2020 From: webhook-mailer at python.org (Shantanu) Date: Fri, 01 May 2020 19:46:10 -0000 Subject: [Python-checkins] bpo-39435: Fix docs for pickle.loads (GH-18160) Message-ID: https://github.com/python/cpython/commit/289842ae820f99908d3a345f1f3b6d4e5b4b97fc commit: 289842ae820f99908d3a345f1f3b6d4e5b4b97fc branch: master author: Shantanu committer: GitHub date: 2020-05-01T12:46:01-07:00 summary: bpo-39435: Fix docs for pickle.loads (GH-18160) files: A Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst M Doc/library/pickle.rst M Misc/ACKS diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index a7b92bb9538d9..d92e947a76403 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -252,10 +252,10 @@ process more convenient: .. versionchanged:: 3.8 The *buffers* argument was added. -.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) +.. function:: loads(data, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) Return the reconstituted object hierarchy of the pickled representation - *bytes_object* of an object. + *data* of an object. *data* must be a :term:`bytes-like object`. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation diff --git a/Misc/ACKS b/Misc/ACKS index 21822dd7524cf..9221f6aae439e 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -790,6 +790,7 @@ Manuel Jacob David Jacobs Kevin Jacobs Kjetil Jacobsen +Shantanu Jain Bertrand Janin Geert Jansen Jack Jansen diff --git a/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst b/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst new file mode 100644 index 0000000000000..40294c10df00a --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst @@ -0,0 +1 @@ +Fix an incorrect signature for :func:`pickle.loads` in the docs \ No newline at end of file From webhook-mailer at python.org Fri May 1 15:53:43 2020 From: webhook-mailer at python.org (Antoine Pitrou) Date: Fri, 01 May 2020 19:53:43 -0000 Subject: [Python-checkins] [3.7] bpo-39435: Fix docs for pickle.loads (GH-18160). (GH-19844) Message-ID: https://github.com/python/cpython/commit/3859b1ac1d7014f8ff673962d94a01a408546e24 commit: 3859b1ac1d7014f8ff673962d94a01a408546e24 branch: 3.7 author: Antoine Pitrou committer: GitHub date: 2020-05-01T12:53:35-07:00 summary: [3.7] bpo-39435: Fix docs for pickle.loads (GH-18160). (GH-19844) (cherry picked from commit 289842ae820f99908d3a345f1f3b6d4e5b4b97fc) Co-authored-by: Shantanu Automerge-Triggered-By: @pitrou files: A Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst M Doc/library/pickle.rst M Misc/ACKS diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index d638944756e7a..25044899f242a 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -242,10 +242,10 @@ process more convenient: instances of :class:`~datetime.datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by Python 2. -.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict") +.. function:: loads(data, \*, fix_imports=True, encoding="ASCII", errors="strict") Return the reconstituted object hierarchy of the pickled representation - *bytes_object* of an object. + *data* of an object. *data* must be a :term:`bytes-like object`. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation diff --git a/Misc/ACKS b/Misc/ACKS index 27ef39754afd9..ce269edbd51bf 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -746,6 +746,7 @@ Manuel Jacob David Jacobs Kevin Jacobs Kjetil Jacobsen +Shantanu Jain Bertrand Janin Geert Jansen Jack Jansen diff --git a/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst b/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst new file mode 100644 index 0000000000000..40294c10df00a --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst @@ -0,0 +1 @@ +Fix an incorrect signature for :func:`pickle.loads` in the docs \ No newline at end of file From webhook-mailer at python.org Fri May 1 15:54:48 2020 From: webhook-mailer at python.org (Antoine Pitrou) Date: Fri, 01 May 2020 19:54:48 -0000 Subject: [Python-checkins] [3.8] bpo-39435: Fix docs for pickle.loads (GH-18160) (GH-19843) Message-ID: https://github.com/python/cpython/commit/e05828055e5165cc7268ea3bea33adc502e054a1 commit: e05828055e5165cc7268ea3bea33adc502e054a1 branch: 3.8 author: Antoine Pitrou committer: GitHub date: 2020-05-01T12:54:44-07:00 summary: [3.8] bpo-39435: Fix docs for pickle.loads (GH-18160) (GH-19843) (cherry picked from commit 289842a) Co-authored-by: Shantanu Automerge-Triggered-By: @pitrou files: A Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst M Doc/library/pickle.rst M Misc/ACKS diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index a7b92bb9538d9..d92e947a76403 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -252,10 +252,10 @@ process more convenient: .. versionchanged:: 3.8 The *buffers* argument was added. -.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) +.. function:: loads(data, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) Return the reconstituted object hierarchy of the pickled representation - *bytes_object* of an object. + *data* of an object. *data* must be a :term:`bytes-like object`. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation diff --git a/Misc/ACKS b/Misc/ACKS index 9d8c0f9a48626..34a6fc439e89c 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -769,6 +769,7 @@ Manuel Jacob David Jacobs Kevin Jacobs Kjetil Jacobsen +Shantanu Jain Bertrand Janin Geert Jansen Jack Jansen diff --git a/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst b/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst new file mode 100644 index 0000000000000..40294c10df00a --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-01-24-05-42-57.bpo-39435.EFcdFU.rst @@ -0,0 +1 @@ +Fix an incorrect signature for :func:`pickle.loads` in the docs \ No newline at end of file From webhook-mailer at python.org Fri May 1 17:34:03 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 21:34:03 -0000 Subject: [Python-checkins] Fix the Tools/peg_generator/scripts/benchmark.py script (GH-19848) Message-ID: https://github.com/python/cpython/commit/6bd99d5f002f1cfcc3a975e87684c5238490644a commit: 6bd99d5f002f1cfcc3a975e87684c5238490644a branch: master author: Pablo Galindo committer: GitHub date: 2020-05-01T22:33:54+01:00 summary: Fix the Tools/peg_generator/scripts/benchmark.py script (GH-19848) files: M Tools/peg_generator/pegen/build.py M Tools/peg_generator/scripts/benchmark.py diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py index 94248ffd9431c..d33dd049d63c7 100644 --- a/Tools/peg_generator/pegen/build.py +++ b/Tools/peg_generator/pegen/build.py @@ -15,7 +15,7 @@ from pegen.python_generator import PythonParserGenerator from pegen.tokenizer import Tokenizer -MOD_DIR = pathlib.Path(__file__).parent +MOD_DIR = pathlib.Path(__file__).resolve().parent def get_extra_flags(compiler_flags: str, compiler_py_flags_nodist: str) -> List[str]: diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py index bc751156e8972..6b4287cd8cecc 100644 --- a/Tools/peg_generator/scripts/benchmark.py +++ b/Tools/peg_generator/scripts/benchmark.py @@ -11,7 +11,7 @@ sys.path.insert(0, os.getcwd()) from peg_extension import parse -from pegen.build import build_parser_and_generator +from pegen.build import build_c_parser_and_generator from scripts.test_parse_directory import parse_directory argparser = argparse.ArgumentParser( @@ -93,8 +93,9 @@ def run_benchmark_stdlib(subcommand, parser): modes = {"compile": 2, "parse": 1, "check": 0} extension = None if parser == "pegen": - extension = build_parser_and_generator( + extension = build_c_parser_and_generator( "../../Grammar/python.gram", + "../../Grammar/Tokens", "peg_extension/parse.c", compile_extension=True, skip_actions=False, From webhook-mailer at python.org Fri May 1 18:14:16 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 01 May 2020 22:14:16 -0000 Subject: [Python-checkins] bpo-40334: use the TOKENS file when checking dangling rules (GH-19849) Message-ID: https://github.com/python/cpython/commit/7ba08ff7b41911f972d0750e068a2270e0dbd68f commit: 7ba08ff7b41911f972d0750e068a2270e0dbd68f branch: master author: Pablo Galindo committer: GitHub date: 2020-05-01T23:14:12+01:00 summary: bpo-40334: use the TOKENS file when checking dangling rules (GH-19849) files: M Tools/peg_generator/pegen/build.py M Tools/peg_generator/pegen/c_generator.py M Tools/peg_generator/pegen/parser_generator.py M Tools/peg_generator/pegen/python_generator.py M Tools/peg_generator/pegen/testutil.py diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py index d33dd049d63c7..907feeaf122de 100644 --- a/Tools/peg_generator/pegen/build.py +++ b/Tools/peg_generator/pegen/build.py @@ -17,6 +17,8 @@ MOD_DIR = pathlib.Path(__file__).resolve().parent +TokenDefinitions = Tuple[Dict[int, str], Dict[str, int], Set[str]] + def get_extra_flags(compiler_flags: str, compiler_py_flags_nodist: str) -> List[str]: flags = sysconfig.get_config_var(compiler_flags) @@ -112,7 +114,8 @@ def build_parser( return grammar, parser, tokenizer -def generate_token_definitions(tokens: IO[str]) -> Tuple[Dict[str, int], Set[str]]: +def generate_token_definitions(tokens: IO[str]) -> TokenDefinitions: + all_tokens = {} exact_tokens = {} non_exact_tokens = set() numbers = itertools.count(0) @@ -129,13 +132,15 @@ def generate_token_definitions(tokens: IO[str]) -> Tuple[Dict[str, int], Set[str if len(pieces) == 1: (token,) = pieces non_exact_tokens.add(token) + all_tokens[index] = token elif len(pieces) == 2: - _, op = pieces + token, op = pieces exact_tokens[op.strip("'")] = index + all_tokens[index] = token else: raise ValueError(f"Unexpected line found in Tokens file: {line}") - return exact_tokens, non_exact_tokens + return all_tokens, exact_tokens, non_exact_tokens def build_c_generator( @@ -149,10 +154,10 @@ def build_c_generator( skip_actions: bool = False, ) -> ParserGenerator: with open(tokens_file, "r") as tok_file: - exact_tok, non_exact_tok = generate_token_definitions(tok_file) + all_tokens, exact_tok, non_exact_tok = generate_token_definitions(tok_file) with open(output_file, "w") as file: gen: ParserGenerator = CParserGenerator( - grammar, exact_tok, non_exact_tok, file, skip_actions=skip_actions + grammar, all_tokens, exact_tok, non_exact_tok, file, skip_actions=skip_actions ) gen.generate(grammar_file) diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 6c77f43991bbe..c9c67067d4677 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -265,13 +265,14 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): def __init__( self, grammar: grammar.Grammar, + tokens: Dict[int, str], exact_tokens: Dict[str, int], non_exact_tokens: Set[str], file: Optional[IO[Text]], debug: bool = False, skip_actions: bool = False, ): - super().__init__(grammar, file) + super().__init__(grammar, tokens, file) self.callmakervisitor: CCallMakerVisitor = CCallMakerVisitor( self, exact_tokens, non_exact_tokens ) diff --git a/Tools/peg_generator/pegen/parser_generator.py b/Tools/peg_generator/pegen/parser_generator.py index b92df2267762d..03452510b9669 100644 --- a/Tools/peg_generator/pegen/parser_generator.py +++ b/Tools/peg_generator/pegen/parser_generator.py @@ -1,5 +1,4 @@ import contextlib -import token from abc import abstractmethod from typing import AbstractSet, Dict, IO, Iterator, List, Optional, Set, Text, Tuple @@ -19,11 +18,12 @@ class RuleCheckingVisitor(GrammarVisitor): - def __init__(self, rules: Dict[str, Rule]): + def __init__(self, rules: Dict[str, Rule], tokens: Dict[int, str]): self.rules = rules + self.tokens = tokens def visit_NameLeaf(self, node: NameLeaf) -> None: - if node.value not in self.rules and node.value not in token.tok_name.values(): + if node.value not in self.rules and node.value not in self.tokens.values(): # TODO: Add line/col info to (leaf) nodes raise GrammarError(f"Dangling reference to rule {node.value!r}") @@ -32,12 +32,13 @@ class ParserGenerator: callmakervisitor: GrammarVisitor - def __init__(self, grammar: Grammar, file: Optional[IO[Text]]): + def __init__(self, grammar: Grammar, tokens: Dict[int, str], file: Optional[IO[Text]]): self.grammar = grammar + self.tokens = tokens self.rules = grammar.rules if "trailer" not in grammar.metas and "start" not in self.rules: raise GrammarError("Grammar without a trailer must have a 'start' rule") - checker = RuleCheckingVisitor(self.rules) + checker = RuleCheckingVisitor(self.rules, self.tokens) for rule in self.rules.values(): checker.visit(rule) self.file = file diff --git a/Tools/peg_generator/pegen/python_generator.py b/Tools/peg_generator/pegen/python_generator.py index bde27890c15a6..64336552f24f6 100644 --- a/Tools/peg_generator/pegen/python_generator.py +++ b/Tools/peg_generator/pegen/python_generator.py @@ -1,3 +1,4 @@ +import token from typing import Any, Dict, Optional, IO, Text, Tuple from pegen.grammar import ( @@ -123,8 +124,13 @@ def visit_Cut(self, node: Cut) -> Tuple[str, str]: class PythonParserGenerator(ParserGenerator, GrammarVisitor): - def __init__(self, grammar: grammar.Grammar, file: Optional[IO[Text]]): - super().__init__(grammar, file) + def __init__( + self, + grammar: grammar.Grammar, + file: Optional[IO[Text]], + tokens: Dict[int, str] = token.tok_name, + ): + super().__init__(grammar, tokens, file) self.callmakervisitor = PythonCallMakerVisitor(self) def generate(self, filename: str) -> None: diff --git a/Tools/peg_generator/pegen/testutil.py b/Tools/peg_generator/pegen/testutil.py index 1f79d8f702fb1..264659e71768c 100644 --- a/Tools/peg_generator/pegen/testutil.py +++ b/Tools/peg_generator/pegen/testutil.py @@ -17,6 +17,7 @@ from pegen.python_generator import PythonParserGenerator from pegen.tokenizer import Tokenizer +ALL_TOKENS = token.tok_name EXACT_TOKENS = token.EXACT_TOKEN_TYPES # type: ignore NON_EXACT_TOKENS = { name for index, name in token.tok_name.items() if index not in EXACT_TOKENS.values() @@ -76,7 +77,7 @@ def import_file(full_name: str, path: str) -> Any: def generate_c_parser_source(grammar: Grammar) -> str: out = io.StringIO() - genr = CParserGenerator(grammar, EXACT_TOKENS, NON_EXACT_TOKENS, out) + genr = CParserGenerator(grammar, ALL_TOKENS, EXACT_TOKENS, NON_EXACT_TOKENS, out) genr.generate("") return out.getvalue() @@ -96,7 +97,9 @@ def generate_parser_c_extension( assert not os.listdir(path) source = path / "parse.c" with open(source, "w") as file: - genr = CParserGenerator(grammar, EXACT_TOKENS, NON_EXACT_TOKENS, file, debug=debug) + genr = CParserGenerator( + grammar, ALL_TOKENS, EXACT_TOKENS, NON_EXACT_TOKENS, file, debug=debug + ) genr.generate("parse.c") compile_c_extension(str(source), build_dir=str(path)) From webhook-mailer at python.org Fri May 1 19:06:28 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 01 May 2020 23:06:28 -0000 Subject: [Python-checkins] bpo-40412: Nullify inittab_copy during finalization (GH-19746) Message-ID: https://github.com/python/cpython/commit/1205afb3e10194fe22fa76385abb7e522144eb29 commit: 1205afb3e10194fe22fa76385abb7e522144eb29 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-01T16:06:23-07:00 summary: bpo-40412: Nullify inittab_copy during finalization (GH-19746) Otherwise we leave a dangling pointer to free'd memory. If we then initialize a new interpreter in the same process and call PyImport_ExtendInittab, we will (likely) crash when calling PyMem_RawRealloc(inittab_copy, ...) since the pointer address is bogus. Automerge-Triggered-By: @brettcannon (cherry picked from commit 64224a4727321a8dd33e6f769edda401193ebef0) Co-authored-by: Gregory Szorc files: A Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst M Python/import.c diff --git a/Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst b/Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst new file mode 100644 index 0000000000000..92bfcddf115a6 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-05-01-17-28-04.bpo-40412.dE0D8N.rst @@ -0,0 +1 @@ +Nullify inittab_copy during finalization, preventing future interpreter initializations in an embedded situation from crashing. Patch by Gregory Szorc. diff --git a/Python/import.c b/Python/import.c index 495012d1c7da6..b4074d1dfc3fa 100644 --- a/Python/import.c +++ b/Python/import.c @@ -300,6 +300,7 @@ _PyImport_Fini2(void) /* Free memory allocated by PyImport_ExtendInittab() */ PyMem_RawFree(inittab_copy); + inittab_copy = NULL; PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } From webhook-mailer at python.org Fri May 1 19:28:14 2020 From: webhook-mailer at python.org (Robert Rouhani) Date: Fri, 01 May 2020 23:28:14 -0000 Subject: [Python-checkins] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) Message-ID: https://github.com/python/cpython/commit/f40bd466bf14029e2687e36e965875adf9d4be1a commit: f40bd466bf14029e2687e36e965875adf9d4be1a branch: master author: Robert Rouhani committer: GitHub date: 2020-05-01T16:28:06-07:00 summary: bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) I can add another commit with the new test case I wrote to verify that the warning was being printed before my change, stopped printing after my change, and that the function does not return null after my change. Automerge-Triggered-By: @brettcannon files: A Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst M Python/import.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst new file mode 100644 index 0000000000000..932e853a8933d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst @@ -0,0 +1 @@ +Fix imp module deprecation warning when PyImport_ReloadModule is called. Patch by Robert Rouhani. diff --git a/Python/import.c b/Python/import.c index 400b02abbdba0..0e2e7c370868f 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1978,23 +1978,23 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals PyObject * PyImport_ReloadModule(PyObject *m) { - _Py_IDENTIFIER(imp); + _Py_IDENTIFIER(importlib); _Py_IDENTIFIER(reload); PyObject *reloaded_module = NULL; - PyObject *imp = _PyImport_GetModuleId(&PyId_imp); - if (imp == NULL) { + PyObject *importlib = _PyImport_GetModuleId(&PyId_importlib); + if (importlib == NULL) { if (PyErr_Occurred()) { return NULL; } - imp = PyImport_ImportModule("imp"); - if (imp == NULL) { + importlib = PyImport_ImportModule("importlib"); + if (importlib == NULL) { return NULL; } } - reloaded_module = _PyObject_CallMethodIdOneArg(imp, &PyId_reload, m); - Py_DECREF(imp); + reloaded_module = _PyObject_CallMethodIdOneArg(importlib, &PyId_reload, m); + Py_DECREF(importlib); return reloaded_module; } From webhook-mailer at python.org Fri May 1 21:14:26 2020 From: webhook-mailer at python.org (Chris Jerdonek) Date: Sat, 02 May 2020 01:14:26 -0000 Subject: [Python-checkins] bpo-29587: Update gen.throw() to chain exceptions (#19823) Message-ID: https://github.com/python/cpython/commit/02047265eb83a43ba18cc7fee81756f1a1a1f968 commit: 02047265eb83a43ba18cc7fee81756f1a1a1f968 branch: master author: Chris Jerdonek committer: GitHub date: 2020-05-01T18:14:19-07:00 summary: bpo-29587: Update gen.throw() to chain exceptions (#19823) Before this commit, if an exception was active inside a generator when calling gen.throw(), that exception was lost (i.e. there was no implicit exception chaining). This commit fixes that by setting exc.__context__ when calling gen.throw(exc). files: A Misc/NEWS.d/next/Core and Builtins/2020-04-30-00-50-25.bpo-29587.oEwSq.rst M Lib/test/test_generators.py M Objects/genobject.c diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 3e42bc6b69a81..4d96f44b15062 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -316,6 +316,23 @@ def g(): self.assertEqual(cm.exception.value.value, 2) +class GeneratorThrowTest(unittest.TestCase): + + def test_exception_context_set(self): + def f(): + try: + raise KeyError('a') + except Exception: + yield + + gen = f() + gen.send(None) + with self.assertRaises(ValueError) as cm: + gen.throw(ValueError) + context = cm.exception.__context__ + self.assertEqual((type(context), context.args), (KeyError, ('a',))) + + class YieldFromTests(unittest.TestCase): def test_generator_gi_yieldfrom(self): def a(): diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-04-30-00-50-25.bpo-29587.oEwSq.rst b/Misc/NEWS.d/next/Core and Builtins/2020-04-30-00-50-25.bpo-29587.oEwSq.rst new file mode 100644 index 0000000000000..f44aa360cc2ef --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-04-30-00-50-25.bpo-29587.oEwSq.rst @@ -0,0 +1 @@ +Enable implicit exception chaining when calling :meth:`generator.throw`. diff --git a/Objects/genobject.c b/Objects/genobject.c index 6e36690b65148..41a63ae2e666a 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -512,6 +512,15 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, } PyErr_Restore(typ, val, tb); + /* XXX Should we also handle the case where exc_type is true and + exc_value is false? */ + if (gen->gi_exc_state.exc_type && gen->gi_exc_state.exc_value) { + Py_INCREF(gen->gi_exc_state.exc_type); + Py_INCREF(gen->gi_exc_state.exc_value); + Py_XINCREF(gen->gi_exc_state.exc_traceback); + _PyErr_ChainExceptions(gen->gi_exc_state.exc_type, + gen->gi_exc_state.exc_value, gen->gi_exc_state.exc_traceback); + } return gen_send_ex(gen, Py_None, 1, 0); failed_throw: From webhook-mailer at python.org Sat May 2 00:23:16 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 02 May 2020 04:23:16 -0000 Subject: [Python-checkins] Fix some scripts in the peg generator folder (GH-19853) Message-ID: https://github.com/python/cpython/commit/9dbaa8d9f054e53fac0c3d308d0bce3fc8850525 commit: 9dbaa8d9f054e53fac0c3d308d0bce3fc8850525 branch: master author: Pablo Galindo committer: GitHub date: 2020-05-02T05:23:06+01:00 summary: Fix some scripts in the peg generator folder (GH-19853) files: A Tools/peg_generator/data/top-pypi-packages-365-days.json A Tools/peg_generator/peg_extension/__init__.py A Tools/peg_generator/pegen/ast_dump.py D Lib/test/test_peg_generator/ast_dump.py M Lib/test/test_peg_generator/test_c_parser.py M Tools/peg_generator/data/cprog.py M Tools/peg_generator/pegen/build.py M Tools/peg_generator/scripts/benchmark.py M Tools/peg_generator/scripts/show_parse.py M Tools/peg_generator/scripts/test_parse_directory.py M Tools/peg_generator/scripts/test_pypi_packages.py diff --git a/Lib/test/test_peg_generator/test_c_parser.py b/Lib/test/test_peg_generator/test_c_parser.py index 8eb66d5279581..f66b92def9f6c 100644 --- a/Lib/test/test_peg_generator/test_c_parser.py +++ b/Lib/test/test_peg_generator/test_c_parser.py @@ -15,6 +15,7 @@ generate_parser_c_extension, generate_c_parser_source, ) + from pegen.ast_dump import ast_dump TEST_TEMPLATE = """ @@ -24,7 +25,10 @@ import traceback import sys import unittest -from test.test_peg_generator.ast_dump import ast_dump + +from test import test_tools +with test_tools.imports_under_tool("peg_generator"): + from pegen.ast_dump import ast_dump sys.path.insert(0, tmp_dir) import parse diff --git a/Tools/peg_generator/data/cprog.py b/Tools/peg_generator/data/cprog.py index 07b96f0753a98..79a42983dbd23 100644 --- a/Tools/peg_generator/data/cprog.py +++ b/Tools/peg_generator/data/cprog.py @@ -7,4 +7,5 @@ pass elif 1: pass - else: print("else-clause") + else: + print("else-clause") diff --git a/Tools/peg_generator/data/top-pypi-packages-365-days.json b/Tools/peg_generator/data/top-pypi-packages-365-days.json new file mode 100644 index 0000000000000..63ff08436a664 --- /dev/null +++ b/Tools/peg_generator/data/top-pypi-packages-365-days.json @@ -0,0 +1,16011 @@ +{ + "last_update": "2020-01-17 15:34:44", + "query": { + "bytes_billed": 646188105728, + "bytes_processed": 646187256701, + "cached": false, + "estimated_cost": "2.94" + }, + "rows": [ + { + "download_count": 910195765, + "project": "urllib3" + }, + { + "download_count": 749120890, + "project": "six" + }, + { + "download_count": 670113460, + "project": "botocore" + }, + { + "download_count": 629757389, + "project": "python-dateutil" + }, + { + "download_count": 629606070, + "project": "pip" + }, + { + "download_count": 626954494, + "project": "requests" + }, + { + "download_count": 595019137, + "project": "s3transfer" + }, + { + "download_count": 570148733, + "project": "certifi" + }, + { + "download_count": 542241710, + "project": "idna" + }, + { + "download_count": 534393540, + "project": "pyyaml" + }, + { + "download_count": 531342983, + "project": "pyasn1" + }, + { + "download_count": 518080177, + "project": "docutils" + }, + { + "download_count": 516892347, + "project": "chardet" + }, + { + "download_count": 502956749, + "project": "rsa" + }, + { + "download_count": 480905080, + "project": "jmespath" + }, + { + "download_count": 410856025, + "project": "setuptools" + }, + { + "download_count": 410196551, + "project": "pytz" + }, + { + "download_count": 397671253, + "project": "awscli" + }, + { + "download_count": 392932234, + "project": "futures" + }, + { + "download_count": 375594752, + "project": "colorama" + }, + { + "download_count": 346035749, + "project": "simplejson" + }, + { + "download_count": 337185380, + "project": "boto3" + }, + { + "download_count": 305750769, + "project": "numpy" + }, + { + "download_count": 304101394, + "project": "wheel" + }, + { + "download_count": 264199809, + "project": "protobuf" + }, + { + "download_count": 244941990, + "project": "markupsafe" + }, + { + "download_count": 242351858, + "project": "cffi" + }, + { + "download_count": 214070466, + "project": "jinja2" + }, + { + "download_count": 212238740, + "project": "pyasn1-modules" + }, + { + "download_count": 210982876, + "project": "cryptography" + }, + { + "download_count": 190156825, + "project": "attrs" + }, + { + "download_count": 182755695, + "project": "cachetools" + }, + { + "download_count": 178075863, + "project": "google-api-core" + }, + { + "download_count": 177966855, + "project": "enum34" + }, + { + "download_count": 173568874, + "project": "click" + }, + { + "download_count": 168990924, + "project": "future" + }, + { + "download_count": 168313449, + "project": "google-auth" + }, + { + "download_count": 165064404, + "project": "pandas" + }, + { + "download_count": 161184509, + "project": "grpcio" + }, + { + "download_count": 153694077, + "project": "google-cloud-core" + }, + { + "download_count": 152780068, + "project": "pycparser" + }, + { + "download_count": 150391523, + "project": "googleapis-common-protos" + }, + { + "download_count": 145133278, + "project": "pyparsing" + }, + { + "download_count": 143193200, + "project": "werkzeug" + }, + { + "download_count": 136092386, + "project": "pytest" + }, + { + "download_count": 135106914, + "project": "decorator" + }, + { + "download_count": 128924918, + "project": "asn1crypto" + }, + { + "download_count": 126657878, + "project": "more-itertools" + }, + { + "download_count": 126309809, + "project": "awscli-cwlogs" + }, + { + "download_count": 120300118, + "project": "pluggy" + }, + { + "download_count": 117455899, + "project": "flask" + }, + { + "download_count": 116968652, + "project": "scipy" + }, + { + "download_count": 113639938, + "project": "itsdangerous" + }, + { + "download_count": 111213522, + "project": "oauthlib" + }, + { + "download_count": 106969182, + "project": "py" + }, + { + "download_count": 106245186, + "project": "coverage" + }, + { + "download_count": 104256236, + "project": "virtualenv" + }, + { + "download_count": 102765613, + "project": "requests-oauthlib" + }, + { + "download_count": 102590841, + "project": "psutil" + }, + { + "download_count": 102589154, + "project": "ipaddress" + }, + { + "download_count": 102291693, + "project": "jsonschema" + }, + { + "download_count": 100560003, + "project": "scikit-learn" + }, + { + "download_count": 99249602, + "project": "importlib-metadata" + }, + { + "download_count": 95618798, + "project": "pygments" + }, + { + "download_count": 94913658, + "project": "wcwidth" + }, + { + "download_count": 93958133, + "project": "zipp" + }, + { + "download_count": 93185870, + "project": "pyopenssl" + }, + { + "download_count": 92353815, + "project": "pyjwt" + }, + { + "download_count": 92018680, + "project": "mock" + }, + { + "download_count": 90635179, + "project": "wrapt" + }, + { + "download_count": 90150749, + "project": "google-cloud-storage" + }, + { + "download_count": 86097386, + "project": "pillow" + }, + { + "download_count": 85698334, + "project": "websocket-client" + }, + { + "download_count": 84842257, + "project": "packaging" + }, + { + "download_count": 84475934, + "project": "pbr" + }, + { + "download_count": 82019683, + "project": "ipython" + }, + { + "download_count": 81402313, + "project": "prompt-toolkit" + }, + { + "download_count": 80731622, + "project": "matplotlib" + }, + { + "download_count": 80443033, + "project": "httplib2" + }, + { + "download_count": 78391981, + "project": "boto" + }, + { + "download_count": 77428445, + "project": "lxml" + }, + { + "download_count": 76599773, + "project": "docker" + }, + { + "download_count": 75883487, + "project": "atomicwrites" + }, + { + "download_count": 73114976, + "project": "google-resumable-media" + }, + { + "download_count": 72286328, + "project": "sqlalchemy" + }, + { + "download_count": 71355694, + "project": "argparse" + }, + { + "download_count": 70247997, + "project": "kiwisolver" + }, + { + "download_count": 70157529, + "project": "mccabe" + }, + { + "download_count": 69616809, + "project": "configparser" + }, + { + "download_count": 68080016, + "project": "multidict" + }, + { + "download_count": 65738785, + "project": "tqdm" + }, + { + "download_count": 65716434, + "project": "tornado" + }, + { + "download_count": 65152549, + "project": "funcsigs" + }, + { + "download_count": 64373372, + "project": "beautifulsoup4" + }, + { + "download_count": 64241326, + "project": "paramiko" + }, + { + "download_count": 63570436, + "project": "psycopg2" + }, + { + "download_count": 63544025, + "project": "pyrsistent" + }, + { + "download_count": 63424037, + "project": "typing" + }, + { + "download_count": 62605787, + "project": "markdown" + }, + { + "download_count": 62535342, + "project": "google-api-python-client" + }, + { + "download_count": 61655343, + "project": "redis" + }, + { + "download_count": 61634970, + "project": "bcrypt" + }, + { + "download_count": 60696872, + "project": "pexpect" + }, + { + "download_count": 60144339, + "project": "pycodestyle" + }, + { + "download_count": 60125614, + "project": "absl-py" + }, + { + "download_count": 59496247, + "project": "ptyprocess" + }, + { + "download_count": 59137610, + "project": "aiohttp" + }, + { + "download_count": 59052497, + "project": "entrypoints" + }, + { + "download_count": 58282657, + "project": "oauth2client" + }, + { + "download_count": 57910701, + "project": "docopt" + }, + { + "download_count": 57238190, + "project": "pynacl" + }, + { + "download_count": 55087716, + "project": "traitlets" + }, + { + "download_count": 55005408, + "project": "tabulate" + }, + { + "download_count": 54655331, + "project": "backports-functools-lru-cache" + }, + { + "download_count": 54439203, + "project": "lazy-object-proxy" + }, + { + "download_count": 54278961, + "project": "dill" + }, + { + "download_count": 53875643, + "project": "ipython-genutils" + }, + { + "download_count": 53414364, + "project": "pathlib2" + }, + { + "download_count": 53208142, + "project": "isodate" + }, + { + "download_count": 52918821, + "project": "azure-common" + }, + { + "download_count": 52876560, + "project": "gunicorn" + }, + { + "download_count": 52367394, + "project": "uritemplate" + }, + { + "download_count": 52356165, + "project": "cycler" + }, + { + "download_count": 52009177, + "project": "defusedxml" + }, + { + "download_count": 51204829, + "project": "psycopg2-binary" + }, + { + "download_count": 51194283, + "project": "h5py" + }, + { + "download_count": 51011471, + "project": "termcolor" + }, + { + "download_count": 50365341, + "project": "pickleshare" + }, + { + "download_count": 50282815, + "project": "soupsieve" + }, + { + "download_count": 50184503, + "project": "pyflakes" + }, + { + "download_count": 49235593, + "project": "requests-toolbelt" + }, + { + "download_count": 48265870, + "project": "google-cloud-bigquery" + }, + { + "download_count": 47092132, + "project": "tensorboard" + }, + { + "download_count": 46785233, + "project": "typed-ast" + }, + { + "download_count": 46639206, + "project": "networkx" + }, + { + "download_count": 45991420, + "project": "webencodings" + }, + { + "download_count": 45685686, + "project": "async-timeout" + }, + { + "download_count": 45449338, + "project": "tensorflow" + }, + { + "download_count": 45435235, + "project": "gitpython" + }, + { + "download_count": 45275021, + "project": "pymongo" + }, + { + "download_count": 45205520, + "project": "azure-storage-blob" + }, + { + "download_count": 45085736, + "project": "flake8" + }, + { + "download_count": 44565799, + "project": "isort" + }, + { + "download_count": 44491717, + "project": "contextlib2" + }, + { + "download_count": 44308938, + "project": "scandir" + }, + { + "download_count": 44265261, + "project": "functools32" + }, + { + "download_count": 44039749, + "project": "gevent" + }, + { + "download_count": 42987880, + "project": "pytest-cov" + }, + { + "download_count": 42298933, + "project": "docker-pycreds" + }, + { + "download_count": 42280978, + "project": "joblib" + }, + { + "download_count": 42125807, + "project": "yarl" + }, + { + "download_count": 42105718, + "project": "grpc-google-iam-v1" + }, + { + "download_count": 42070985, + "project": "greenlet" + }, + { + "download_count": 41679952, + "project": "zope-interface" + }, + { + "download_count": 41396597, + "project": "pyzmq" + }, + { + "download_count": 41281740, + "project": "pymysql" + }, + { + "download_count": 41194733, + "project": "django" + }, + { + "download_count": 41174124, + "project": "datadog" + }, + { + "download_count": 41132868, + "project": "bleach" + }, + { + "download_count": 40599053, + "project": "astroid" + }, + { + "download_count": 40529351, + "project": "gitdb2" + }, + { + "download_count": 40342805, + "project": "pylint" + }, + { + "download_count": 40116789, + "project": "babel" + }, + { + "download_count": 39847400, + "project": "azure-storage-common" + }, + { + "download_count": 39689270, + "project": "keras-applications" + }, + { + "download_count": 39395842, + "project": "keras-preprocessing" + }, + { + "download_count": 39184540, + "project": "smmap2" + }, + { + "download_count": 38876199, + "project": "opencv-python" + }, + { + "download_count": 38852272, + "project": "subprocess32" + }, + { + "download_count": 38836392, + "project": "msrest" + }, + { + "download_count": 38732044, + "project": "google-auth-httplib2" + }, + { + "download_count": 38166504, + "project": "parso" + }, + { + "download_count": 37940669, + "project": "jedi" + }, + { + "download_count": 37805943, + "project": "pycryptodome" + }, + { + "download_count": 37739739, + "project": "astor" + }, + { + "download_count": 37110085, + "project": "gast" + }, + { + "download_count": 36881409, + "project": "retrying" + }, + { + "download_count": 35451582, + "project": "elasticsearch" + }, + { + "download_count": 35263938, + "project": "jsonpickle" + }, + { + "download_count": 34975483, + "project": "sqlparse" + }, + { + "download_count": 34879648, + "project": "pyarrow" + }, + { + "download_count": 34858569, + "project": "ordereddict" + }, + { + "download_count": 33824794, + "project": "scikit-image" + }, + { + "download_count": 33775490, + "project": "pycrypto" + }, + { + "download_count": 32742937, + "project": "appdirs" + }, + { + "download_count": 32689782, + "project": "toml" + }, + { + "download_count": 32684718, + "project": "adal" + }, + { + "download_count": 32591485, + "project": "azure-nspkg" + }, + { + "download_count": 32103427, + "project": "xlrd" + }, + { + "download_count": 32000159, + "project": "jupyter-core" + }, + { + "download_count": 31774601, + "project": "xmltodict" + }, + { + "download_count": 31736336, + "project": "toolz" + }, + { + "download_count": 31576642, + "project": "cached-property" + }, + { + "download_count": 31550164, + "project": "prometheus-client" + }, + { + "download_count": 31302562, + "project": "tensorflow-estimator" + }, + { + "download_count": 31010564, + "project": "py4j" + }, + { + "download_count": 30527374, + "project": "websockets" + }, + { + "download_count": 30383292, + "project": "dnspython" + }, + { + "download_count": 30245623, + "project": "nbformat" + }, + { + "download_count": 30162734, + "project": "monotonic" + }, + { + "download_count": 29978338, + "project": "nose" + }, + { + "download_count": 29531870, + "project": "typing-extensions" + }, + { + "download_count": 29443454, + "project": "sklearn" + }, + { + "download_count": 29064516, + "project": "cloudpickle" + }, + { + "download_count": 28794637, + "project": "pywavelets" + }, + { + "download_count": 28710649, + "project": "pycryptodomex" + }, + { + "download_count": 28533182, + "project": "ansible" + }, + { + "download_count": 28501824, + "project": "singledispatch" + }, + { + "download_count": 28281846, + "project": "ply" + }, + { + "download_count": 27973857, + "project": "cython" + }, + { + "download_count": 27913607, + "project": "mako" + }, + { + "download_count": 27864029, + "project": "selenium" + }, + { + "download_count": 27848508, + "project": "html5lib" + }, + { + "download_count": 27745677, + "project": "simplegeneric" + }, + { + "download_count": 27671952, + "project": "apache-beam" + }, + { + "download_count": 27579084, + "project": "backcall" + }, + { + "download_count": 26844011, + "project": "msgpack" + }, + { + "download_count": 26331607, + "project": "dask" + }, + { + "download_count": 26266166, + "project": "regex" + }, + { + "download_count": 26239282, + "project": "ipykernel" + }, + { + "download_count": 25952891, + "project": "ujson" + }, + { + "download_count": 25898723, + "project": "mistune" + }, + { + "download_count": 25796973, + "project": "backports-ssl-match-hostname" + }, + { + "download_count": 25756543, + "project": "amqp" + }, + { + "download_count": 25750485, + "project": "jupyter-client" + }, + { + "download_count": 25701706, + "project": "docker-compose" + }, + { + "download_count": 25315661, + "project": "kombu" + }, + { + "download_count": 25281035, + "project": "ruamel-yaml" + }, + { + "download_count": 25271754, + "project": "nltk" + }, + { + "download_count": 25075126, + "project": "alembic" + }, + { + "download_count": 24664889, + "project": "google-auth-oauthlib" + }, + { + "download_count": 24499399, + "project": "raven" + }, + { + "download_count": 24483899, + "project": "python-editor" + }, + { + "download_count": 24388318, + "project": "sortedcontainers" + }, + { + "download_count": 24375921, + "project": "nbconvert" + }, + { + "download_count": 24045975, + "project": "thrift" + }, + { + "download_count": 23835990, + "project": "notebook" + }, + { + "download_count": 23817589, + "project": "hdfs" + }, + { + "download_count": 23689627, + "project": "slackclient" + }, + { + "download_count": 23619686, + "project": "testpath" + }, + { + "download_count": 23536824, + "project": "s3fs" + }, + { + "download_count": 23476069, + "project": "keras" + }, + { + "download_count": 23364791, + "project": "celery" + }, + { + "download_count": 23339282, + "project": "discord-py" + }, + { + "download_count": 23232254, + "project": "billiard" + }, + { + "download_count": 23210897, + "project": "filelock" + }, + { + "download_count": 23187414, + "project": "snowballstemmer" + }, + { + "download_count": 23088875, + "project": "unidecode" + }, + { + "download_count": 23011985, + "project": "netaddr" + }, + { + "download_count": 22993463, + "project": "pandocfilters" + }, + { + "download_count": 22747435, + "project": "send2trash" + }, + { + "download_count": 22715519, + "project": "terminado" + }, + { + "download_count": 22431738, + "project": "backports-shutil-get-terminal-size" + }, + { + "download_count": 22409669, + "project": "backports-weakref" + }, + { + "download_count": 22231171, + "project": "msrestazure" + }, + { + "download_count": 21906531, + "project": "sentry-sdk" + }, + { + "download_count": 21817254, + "project": "ipywidgets" + }, + { + "download_count": 21711592, + "project": "tzlocal" + }, + { + "download_count": 21626474, + "project": "widgetsnbextension" + }, + { + "download_count": 21533795, + "project": "ijson" + }, + { + "download_count": 21335834, + "project": "mysqlclient" + }, + { + "download_count": 20939369, + "project": "tox" + }, + { + "download_count": 20733637, + "project": "lockfile" + }, + { + "download_count": 20642115, + "project": "xgboost" + }, + { + "download_count": 20630795, + "project": "arrow" + }, + { + "download_count": 20559416, + "project": "vine" + }, + { + "download_count": 20399386, + "project": "google-cloud-pubsub" + }, + { + "download_count": 20372136, + "project": "sphinx" + }, + { + "download_count": 20261684, + "project": "djangorestframework" + }, + { + "download_count": 20222772, + "project": "openpyxl" + }, + { + "download_count": 20101811, + "project": "ecdsa" + }, + { + "download_count": 20081473, + "project": "xlsxwriter" + }, + { + "download_count": 20021156, + "project": "snowflake-connector-python" + }, + { + "download_count": 19972964, + "project": "pyhamcrest" + }, + { + "download_count": 19806017, + "project": "google-cloud-firestore" + }, + { + "download_count": 19717486, + "project": "google-cloud-datastore" + }, + { + "download_count": 19580510, + "project": "google-pasta" + }, + { + "download_count": 19191080, + "project": "qtconsole" + }, + { + "download_count": 19179159, + "project": "bs4" + }, + { + "download_count": 19098496, + "project": "text-unidecode" + }, + { + "download_count": 19089305, + "project": "prettytable" + }, + { + "download_count": 19018504, + "project": "jdcal" + }, + { + "download_count": 19002384, + "project": "google-cloud-logging" + }, + { + "download_count": 18962785, + "project": "backports-abc" + }, + { + "download_count": 18918332, + "project": "jupyter-console" + }, + { + "download_count": 18706905, + "project": "smart-open" + }, + { + "download_count": 18670352, + "project": "alabaster" + }, + { + "download_count": 18664013, + "project": "pyspark" + }, + { + "download_count": 18533388, + "project": "jupyter" + }, + { + "download_count": 18480060, + "project": "statsmodels" + }, + { + "download_count": 18431746, + "project": "unicodecsv" + }, + { + "download_count": 18351262, + "project": "dockerpty" + }, + { + "download_count": 18303864, + "project": "shapely" + }, + { + "download_count": 18289269, + "project": "twisted" + }, + { + "download_count": 18288202, + "project": "hiredis" + }, + { + "download_count": 18166239, + "project": "virtualenv-clone" + }, + { + "download_count": 18139397, + "project": "imagesize" + }, + { + "download_count": 18056871, + "project": "idna-ssl" + }, + { + "download_count": 18052633, + "project": "fasteners" + }, + { + "download_count": 18027552, + "project": "marshmallow" + }, + { + "download_count": 18017517, + "project": "plotly" + }, + { + "download_count": 17675962, + "project": "pytest-forked" + }, + { + "download_count": 17577035, + "project": "texttable" + }, + { + "download_count": 17473671, + "project": "et-xmlfile" + }, + { + "download_count": 17113449, + "project": "kubernetes" + }, + { + "download_count": 17078526, + "project": "incremental" + }, + { + "download_count": 16916001, + "project": "iso8601" + }, + { + "download_count": 16883776, + "project": "applicationinsights" + }, + { + "download_count": 16840538, + "project": "google-cloud-bigtable" + }, + { + "download_count": 16823748, + "project": "pathlib" + }, + { + "download_count": 16759673, + "project": "constantly" + }, + { + "download_count": 16691118, + "project": "automat" + }, + { + "download_count": 16638971, + "project": "hyperlink" + }, + { + "download_count": 16463703, + "project": "azure-mgmt-resource" + }, + { + "download_count": 16410162, + "project": "croniter" + }, + { + "download_count": 16390810, + "project": "python-jose" + }, + { + "download_count": 16303498, + "project": "pipenv" + }, + { + "download_count": 15658966, + "project": "pathspec" + }, + { + "download_count": 15520321, + "project": "nvidia-ml-py3" + }, + { + "download_count": 15364508, + "project": "execnet" + }, + { + "download_count": 15314360, + "project": "aniso8601" + }, + { + "download_count": 15247809, + "project": "python-magic" + }, + { + "download_count": 15213240, + "project": "flask-cors" + }, + { + "download_count": 15203298, + "project": "inflection" + }, + { + "download_count": 15113541, + "project": "gym" + }, + { + "download_count": 14999608, + "project": "mypy" + }, + { + "download_count": 14927461, + "project": "azure-mgmt-storage" + }, + { + "download_count": 14835131, + "project": "flask-sqlalchemy" + }, + { + "download_count": 14822442, + "project": "service-identity" + }, + { + "download_count": 14807088, + "project": "mozrunner" + }, + { + "download_count": 14682178, + "project": "argcomplete" + }, + { + "download_count": 14637155, + "project": "faker" + }, + { + "download_count": 14609350, + "project": "uvloop" + }, + { + "download_count": 14582824, + "project": "apipkg" + }, + { + "download_count": 14479520, + "project": "stevedore" + }, + { + "download_count": 14469933, + "project": "azure-storage-nspkg" + }, + { + "download_count": 14356576, + "project": "ndg-httpsclient" + }, + { + "download_count": 14226382, + "project": "pyserial" + }, + { + "download_count": 14190037, + "project": "seaborn" + }, + { + "download_count": 14151070, + "project": "distro" + }, + { + "download_count": 14141290, + "project": "pytest-timeout" + }, + { + "download_count": 14122087, + "project": "bz2file" + }, + { + "download_count": 14098838, + "project": "patsy" + }, + { + "download_count": 14036101, + "project": "cssselect" + }, + { + "download_count": 13956987, + "project": "tenacity" + }, + { + "download_count": 13927328, + "project": "tensorflow-metadata" + }, + { + "download_count": 13870715, + "project": "graphviz" + }, + { + "download_count": 13850391, + "project": "pydot" + }, + { + "download_count": 13813387, + "project": "azure-mgmt-nspkg" + }, + { + "download_count": 13809809, + "project": "avro" + }, + { + "download_count": 13771055, + "project": "imageio" + }, + { + "download_count": 13764392, + "project": "fastavro" + }, + { + "download_count": 13686467, + "project": "gensim" + }, + { + "download_count": 13643493, + "project": "trueskill" + }, + { + "download_count": 13548711, + "project": "statsd" + }, + { + "download_count": 13505330, + "project": "pytest-xdist" + }, + { + "download_count": 13453212, + "project": "azure-mgmt-containerregistry" + }, + { + "download_count": 13380441, + "project": "mypy-extensions" + }, + { + "download_count": 13340370, + "project": "azure-mgmt-keyvault" + }, + { + "download_count": 13259227, + "project": "ua-parser" + }, + { + "download_count": 13241753, + "project": "configobj" + }, + { + "download_count": 13193523, + "project": "mozlog" + }, + { + "download_count": 13161090, + "project": "fuzzywuzzy" + }, + { + "download_count": 13153967, + "project": "google-gax" + }, + { + "download_count": 12999681, + "project": "responses" + }, + { + "download_count": 12946906, + "project": "aliyun-python-sdk-core" + }, + { + "download_count": 12863346, + "project": "azure-datalake-store" + }, + { + "download_count": 12839810, + "project": "pytest-mock" + }, + { + "download_count": 12835022, + "project": "aliyun-python-sdk-ecs" + }, + { + "download_count": 12816025, + "project": "elasticsearch-dsl" + }, + { + "download_count": 12792645, + "project": "azure-mgmt-authorization" + }, + { + "download_count": 12780433, + "project": "google-apitools" + }, + { + "download_count": 12772525, + "project": "python-daemon" + }, + { + "download_count": 12766382, + "project": "azure-graphrbac" + }, + { + "download_count": 12561149, + "project": "netifaces" + }, + { + "download_count": 12538305, + "project": "s3cmd" + }, + { + "download_count": 12534903, + "project": "python-json-logger" + }, + { + "download_count": 12484719, + "project": "aliyunsdkcore" + }, + { + "download_count": 12406280, + "project": "manhole" + }, + { + "download_count": 12261609, + "project": "hvac" + }, + { + "download_count": 12253367, + "project": "humanfriendly" + }, + { + "download_count": 12246930, + "project": "ipdb" + }, + { + "download_count": 12209179, + "project": "deepdiff" + }, + { + "download_count": 12207990, + "project": "freezegun" + }, + { + "download_count": 12098216, + "project": "maxminddb" + }, + { + "download_count": 12042231, + "project": "uwsgi" + }, + { + "download_count": 11947362, + "project": "pykube" + }, + { + "download_count": 11860617, + "project": "appnope" + }, + { + "download_count": 11805813, + "project": "databricks-cli" + }, + { + "download_count": 11788737, + "project": "python-levenshtein" + }, + { + "download_count": 11778504, + "project": "tensorflow-transform" + }, + { + "download_count": 11612558, + "project": "tldextract" + }, + { + "download_count": 11569388, + "project": "pyodbc" + }, + { + "download_count": 11561349, + "project": "autopep8" + }, + { + "download_count": 11432600, + "project": "pendulum" + }, + { + "download_count": 11383453, + "project": "newrelic" + }, + { + "download_count": 11361327, + "project": "python-dotenv" + }, + { + "download_count": 11334209, + "project": "pytzdata" + }, + { + "download_count": 11270038, + "project": "wtforms" + }, + { + "download_count": 11224152, + "project": "pytest-runner" + }, + { + "download_count": 11104163, + "project": "libtmux" + }, + { + "download_count": 11089587, + "project": "zope-deprecation" + }, + { + "download_count": 11017907, + "project": "jsonpointer" + }, + { + "download_count": 10994575, + "project": "webob" + }, + { + "download_count": 10990219, + "project": "retry" + }, + { + "download_count": 10987260, + "project": "blinker" + }, + { + "download_count": 10973921, + "project": "semantic-version" + }, + { + "download_count": 10843556, + "project": "requests-file" + }, + { + "download_count": 10781388, + "project": "graphql-core" + }, + { + "download_count": 10728518, + "project": "blessings" + }, + { + "download_count": 10716974, + "project": "backoff" + }, + { + "download_count": 10695298, + "project": "black" + }, + { + "download_count": 10686016, + "project": "geopy" + }, + { + "download_count": 10629161, + "project": "google-cloud" + }, + { + "download_count": 10551343, + "project": "bottle" + }, + { + "download_count": 10527245, + "project": "pep8" + }, + { + "download_count": 10511519, + "project": "geoip2" + }, + { + "download_count": 10451332, + "project": "grpcio-tools" + }, + { + "download_count": 10410102, + "project": "traceback2" + }, + { + "download_count": 10386312, + "project": "linecache2" + }, + { + "download_count": 10351287, + "project": "django-extensions" + }, + { + "download_count": 10318239, + "project": "sphinxcontrib-websupport" + }, + { + "download_count": 10239847, + "project": "unittest2" + }, + { + "download_count": 10187032, + "project": "fsspec" + }, + { + "download_count": 10146539, + "project": "django-cors-headers" + }, + { + "download_count": 10119472, + "project": "pkginfo" + }, + { + "download_count": 10077843, + "project": "django-filter" + }, + { + "download_count": 10057055, + "project": "secretstorage" + }, + { + "download_count": 10050204, + "project": "user-agents" + }, + { + "download_count": 10001744, + "project": "configargparse" + }, + { + "download_count": 9957349, + "project": "scp" + }, + { + "download_count": 9942530, + "project": "azure-devops" + }, + { + "download_count": 9938936, + "project": "azure-mgmt-compute" + }, + { + "download_count": 9934159, + "project": "azure-mgmt-network" + }, + { + "download_count": 9904711, + "project": "msgpack-python" + }, + { + "download_count": 9827614, + "project": "azure-mgmt-datalake-nspkg" + }, + { + "download_count": 9735081, + "project": "azure-mgmt-datalake-store" + }, + { + "download_count": 9706197, + "project": "google-cloud-monitoring" + }, + { + "download_count": 9674967, + "project": "mpi4py" + }, + { + "download_count": 9609045, + "project": "mozdevice" + }, + { + "download_count": 9561083, + "project": "azure-keyvault" + }, + { + "download_count": 9523786, + "project": "pysocks" + }, + { + "download_count": 9521848, + "project": "azure-cli" + }, + { + "download_count": 9493349, + "project": "jsondiff" + }, + { + "download_count": 9467938, + "project": "cherrypy" + }, + { + "download_count": 9467625, + "project": "pika" + }, + { + "download_count": 9410911, + "project": "parsedatetime" + }, + { + "download_count": 9399772, + "project": "azure-mgmt-batch" + }, + { + "download_count": 9376391, + "project": "lightgbm" + }, + { + "download_count": 9375734, + "project": "querystring-parser" + }, + { + "download_count": 9342152, + "project": "pyrfc3339" + }, + { + "download_count": 9319192, + "project": "argh" + }, + { + "download_count": 9315946, + "project": "pyproj" + }, + { + "download_count": 9307163, + "project": "mozprofile" + }, + { + "download_count": 9301729, + "project": "pycurl" + }, + { + "download_count": 9288555, + "project": "dictdiffer" + }, + { + "download_count": 9274785, + "project": "flask-wtf" + }, + { + "download_count": 9274704, + "project": "mysql-connector-python" + }, + { + "download_count": 9272854, + "project": "cheroot" + }, + { + "download_count": 9261620, + "project": "codecov" + }, + { + "download_count": 9224842, + "project": "mozinfo" + }, + { + "download_count": 9222371, + "project": "jsonpatch" + }, + { + "download_count": 9217176, + "project": "glob2" + }, + { + "download_count": 9059754, + "project": "azure-batch" + }, + { + "download_count": 9057979, + "project": "crcmod" + }, + { + "download_count": 9033939, + "project": "jaraco-functools" + }, + { + "download_count": 8995380, + "project": "tempora" + }, + { + "download_count": 8959399, + "project": "azure-mgmt-dns" + }, + { + "download_count": 8945640, + "project": "pyhive" + }, + { + "download_count": 8906609, + "project": "azure-mgmt-rdbms" + }, + { + "download_count": 8891960, + "project": "azure-mgmt-sql" + }, + { + "download_count": 8888437, + "project": "mozprocess" + }, + { + "download_count": 8874708, + "project": "portend" + }, + { + "download_count": 8853246, + "project": "geographiclib" + }, + { + "download_count": 8803957, + "project": "azure-mgmt-web" + }, + { + "download_count": 8753999, + "project": "deprecated" + }, + { + "download_count": 8739361, + "project": "munch" + }, + { + "download_count": 8687617, + "project": "jpype1" + }, + { + "download_count": 8659485, + "project": "pysftp" + }, + { + "download_count": 8648248, + "project": "watchdog" + }, + { + "download_count": 8644057, + "project": "ruamel-yaml-clib" + }, + { + "download_count": 8628293, + "project": "mlflow" + }, + { + "download_count": 8605163, + "project": "kafka-python" + }, + { + "download_count": 8593398, + "project": "google" + }, + { + "download_count": 8591157, + "project": "gapic-google-cloud-logging-v2" + }, + { + "download_count": 8565550, + "project": "mujoco-py" + }, + { + "download_count": 8557624, + "project": "zeep" + }, + { + "download_count": 8557527, + "project": "proto-google-cloud-logging-v2" + }, + { + "download_count": 8555221, + "project": "azure-storage" + }, + { + "download_count": 8548889, + "project": "pathtools" + }, + { + "download_count": 8547554, + "project": "django-storages" + }, + { + "download_count": 8493425, + "project": "spacy" + }, + { + "download_count": 8479997, + "project": "pytest-instafail" + }, + { + "download_count": 8476835, + "project": "thinc" + }, + { + "download_count": 8468171, + "project": "factory-boy" + }, + { + "download_count": 8466351, + "project": "preshed" + }, + { + "download_count": 8433752, + "project": "google-cloud-spanner" + }, + { + "download_count": 8433718, + "project": "simpleflock" + }, + { + "download_count": 8402292, + "project": "cymem" + }, + { + "download_count": 8374248, + "project": "azure-storage-queue" + }, + { + "download_count": 8367380, + "project": "azure-mgmt-monitor" + }, + { + "download_count": 8361234, + "project": "murmurhash" + }, + { + "download_count": 8360473, + "project": "jeepney" + }, + { + "download_count": 8358801, + "project": "azure-mgmt-containerservice" + }, + { + "download_count": 8334989, + "project": "zc-lockfile" + }, + { + "download_count": 8334854, + "project": "numpy-stl" + }, + { + "download_count": 8334779, + "project": "requests-mock" + }, + { + "download_count": 8331547, + "project": "tensorflow-serving-api" + }, + { + "download_count": 8316359, + "project": "passlib" + }, + { + "download_count": 8257864, + "project": "aws-xray-sdk" + }, + { + "download_count": 8253117, + "project": "waitress" + }, + { + "download_count": 8213115, + "project": "azure-mgmt-containerinstance" + }, + { + "download_count": 8194190, + "project": "oauth" + }, + { + "download_count": 8192420, + "project": "azure-mgmt-redis" + }, + { + "download_count": 8182626, + "project": "azure-mgmt-cognitiveservices" + }, + { + "download_count": 8169888, + "project": "fabric" + }, + { + "download_count": 8160603, + "project": "sphinx-rtd-theme" + }, + { + "download_count": 8151766, + "project": "azure-mgmt-trafficmanager" + }, + { + "download_count": 8146427, + "project": "pystache" + }, + { + "download_count": 8142774, + "project": "python-slugify" + }, + { + "download_count": 8104254, + "project": "azure-mgmt-devtestlabs" + }, + { + "download_count": 8101969, + "project": "sh" + }, + { + "download_count": 8100079, + "project": "azure-mgmt-cdn" + }, + { + "download_count": 8084499, + "project": "azure-mgmt-datalake-analytics" + }, + { + "download_count": 8068973, + "project": "pyaml" + }, + { + "download_count": 8068659, + "project": "azure-mgmt-iothub" + }, + { + "download_count": 8045085, + "project": "azure-mgmt-cosmosdb" + }, + { + "download_count": 8043637, + "project": "jira" + }, + { + "download_count": 8016426, + "project": "mozterm" + }, + { + "download_count": 8000597, + "project": "flask-login" + }, + { + "download_count": 7983143, + "project": "pycairo" + }, + { + "download_count": 7981647, + "project": "invoke" + }, + { + "download_count": 7969857, + "project": "pyxdg" + }, + { + "download_count": 7896477, + "project": "flask-restful" + }, + { + "download_count": 7892342, + "project": "pymssql" + }, + { + "download_count": 7872871, + "project": "plac" + }, + { + "download_count": 7871712, + "project": "colorlog" + }, + { + "download_count": 7841110, + "project": "stripe" + }, + { + "download_count": 7795667, + "project": "pygobject" + }, + { + "download_count": 7793570, + "project": "vsts" + }, + { + "download_count": 7786931, + "project": "azure-mgmt-applicationinsights" + }, + { + "download_count": 7755436, + "project": "azure-cosmosdb-table" + }, + { + "download_count": 7751414, + "project": "zope-event" + }, + { + "download_count": 7745717, + "project": "gspread" + }, + { + "download_count": 7724172, + "project": "phonenumbers" + }, + { + "download_count": 7698105, + "project": "torch" + }, + { + "download_count": 7677484, + "project": "django-debug-toolbar" + }, + { + "download_count": 7669014, + "project": "azure-mgmt-eventhub" + }, + { + "download_count": 7653695, + "project": "sendgrid" + }, + { + "download_count": 7621120, + "project": "azure-core" + }, + { + "download_count": 7618409, + "project": "requests-aws4auth" + }, + { + "download_count": 7606270, + "project": "zope-component" + }, + { + "download_count": 7602809, + "project": "azure-mgmt-marketplaceordering" + }, + { + "download_count": 7589910, + "project": "holidays" + }, + { + "download_count": 7568947, + "project": "azure-cosmosdb-nspkg" + }, + { + "download_count": 7560913, + "project": "azure-mgmt-servicebus" + }, + { + "download_count": 7555791, + "project": "azure-mgmt-loganalytics" + }, + { + "download_count": 7533328, + "project": "azure-mgmt-recoveryservices" + }, + { + "download_count": 7532133, + "project": "azure-mgmt-recoveryservicesbackup" + }, + { + "download_count": 7519987, + "project": "azure-mgmt-eventgrid" + }, + { + "download_count": 7511851, + "project": "simple-salesforce" + }, + { + "download_count": 7493612, + "project": "azure-mgmt-reservations" + }, + { + "download_count": 7490404, + "project": "mysql-python" + }, + { + "download_count": 7471849, + "project": "azure-mgmt-advisor" + }, + { + "download_count": 7470909, + "project": "azure-mgmt-media" + }, + { + "download_count": 7461600, + "project": "backports-tempfile" + }, + { + "download_count": 7452831, + "project": "azure-mgmt-msi" + }, + { + "download_count": 7444403, + "project": "azure-mgmt-batchai" + }, + { + "download_count": 7443190, + "project": "azure-mgmt-iothubprovisioningservices" + }, + { + "download_count": 7427082, + "project": "azure-mgmt-search" + }, + { + "download_count": 7426073, + "project": "azure-mgmt-consumption" + }, + { + "download_count": 7421118, + "project": "azure-mgmt-servicefabric" + }, + { + "download_count": 7420661, + "project": "azure-mgmt-billing" + }, + { + "download_count": 7410977, + "project": "semver" + }, + { + "download_count": 7399599, + "project": "w3lib" + }, + { + "download_count": 7377445, + "project": "supervisor" + }, + { + "download_count": 7371140, + "project": "moto" + }, + { + "download_count": 7360517, + "project": "josepy" + }, + { + "download_count": 7359916, + "project": "azure-mgmt-relay" + }, + { + "download_count": 7325634, + "project": "pandas-gbq" + }, + { + "download_count": 7317868, + "project": "acme" + }, + { + "download_count": 7308144, + "project": "azure-servicebus" + }, + { + "download_count": 7271321, + "project": "xlwt" + }, + { + "download_count": 7270699, + "project": "structlog" + }, + { + "download_count": 7268987, + "project": "sphinxcontrib-serializinghtml" + }, + { + "download_count": 7268175, + "project": "sphinxcontrib-htmlhelp" + }, + { + "download_count": 7251725, + "project": "keyring" + }, + { + "download_count": 7251674, + "project": "sphinxcontrib-qthelp" + }, + { + "download_count": 7251256, + "project": "sphinxcontrib-devhelp" + }, + { + "download_count": 7251076, + "project": "sphinxcontrib-applehelp" + }, + { + "download_count": 7250627, + "project": "sphinxcontrib-jsmath" + }, + { + "download_count": 7239285, + "project": "pytest-django" + }, + { + "download_count": 7236146, + "project": "voluptuous" + }, + { + "download_count": 7235602, + "project": "llvmlite" + }, + { + "download_count": 7112734, + "project": "theano" + }, + { + "download_count": 7042677, + "project": "numba" + }, + { + "download_count": 7038235, + "project": "shellingham" + }, + { + "download_count": 7023740, + "project": "pydocumentdb" + }, + { + "download_count": 7014759, + "project": "parse" + }, + { + "download_count": 7011858, + "project": "coloredlogs" + }, + { + "download_count": 6991011, + "project": "certbot" + }, + { + "download_count": 6989202, + "project": "google-cloud-vision" + }, + { + "download_count": 6983443, + "project": "influxdb" + }, + { + "download_count": 6981795, + "project": "azure-mgmt-managementgroups" + }, + { + "download_count": 6962527, + "project": "azure-mgmt-datamigration" + }, + { + "download_count": 6935874, + "project": "cheetah" + }, + { + "download_count": 6931267, + "project": "azure-mgmt-policyinsights" + }, + { + "download_count": 6910342, + "project": "python-augeas" + }, + { + "download_count": 6902895, + "project": "tblib" + }, + { + "download_count": 6885492, + "project": "azure-mgmt-iotcentral" + }, + { + "download_count": 6882533, + "project": "azure-mgmt-signalr" + }, + { + "download_count": 6879787, + "project": "instana" + }, + { + "download_count": 6848658, + "project": "uptime" + }, + { + "download_count": 6823328, + "project": "azure-mgmt-maps" + }, + { + "download_count": 6811121, + "project": "coreapi" + }, + { + "download_count": 6805884, + "project": "setproctitle" + }, + { + "download_count": 6803339, + "project": "pymemcache" + }, + { + "download_count": 6790921, + "project": "opt-einsum" + }, + { + "download_count": 6746204, + "project": "coreschema" + }, + { + "download_count": 6733204, + "project": "dicttoxml" + }, + { + "download_count": 6709540, + "project": "python-mimeparse" + }, + { + "download_count": 6686487, + "project": "letsencrypt" + }, + { + "download_count": 6671209, + "project": "pypdf2" + }, + { + "download_count": 6659143, + "project": "certbot-apache" + }, + { + "download_count": 6650051, + "project": "feedparser" + }, + { + "download_count": 6629341, + "project": "itypes" + }, + { + "download_count": 6607528, + "project": "datetime" + }, + { + "download_count": 6595896, + "project": "pyglet" + }, + { + "download_count": 6565703, + "project": "pywin32" + }, + { + "download_count": 6555587, + "project": "cachecontrol" + }, + { + "download_count": 6537738, + "project": "whichcraft" + }, + { + "download_count": 6493687, + "project": "repoze-lru" + }, + { + "download_count": 6483589, + "project": "opentracing" + }, + { + "download_count": 6471332, + "project": "yapf" + }, + { + "download_count": 6470521, + "project": "reportlab" + }, + { + "download_count": 6454108, + "project": "pyperclip" + }, + { + "download_count": 6427226, + "project": "sasl" + }, + { + "download_count": 6416154, + "project": "pydocstyle" + }, + { + "download_count": 6412179, + "project": "ldap3" + }, + { + "download_count": 6364528, + "project": "python-http-client" + }, + { + "download_count": 6363103, + "project": "pycountry" + }, + { + "download_count": 6348755, + "project": "azure-servicemanagement-legacy" + }, + { + "download_count": 6348419, + "project": "certbot-nginx" + }, + { + "download_count": 6347386, + "project": "python-gnupg" + }, + { + "download_count": 6338642, + "project": "suds-jurko" + }, + { + "download_count": 6325028, + "project": "promise" + }, + { + "download_count": 6321828, + "project": "twine" + }, + { + "download_count": 6310843, + "project": "django-redis" + }, + { + "download_count": 6310630, + "project": "redis-py-cluster" + }, + { + "download_count": 6301931, + "project": "mysql-connector" + }, + { + "download_count": 6295377, + "project": "python-jenkins" + }, + { + "download_count": 6275920, + "project": "azure-servicefabric" + }, + { + "download_count": 6251258, + "project": "expiringdict" + }, + { + "download_count": 6237744, + "project": "pyvcf" + }, + { + "download_count": 6217846, + "project": "watchtower" + }, + { + "download_count": 6191358, + "project": "poyo" + }, + { + "download_count": 6177944, + "project": "html2text" + }, + { + "download_count": 6167605, + "project": "binaryornot" + }, + { + "download_count": 6156388, + "project": "azure-mgmt" + }, + { + "download_count": 6141630, + "project": "bokeh" + }, + { + "download_count": 6124335, + "project": "python3-openid" + }, + { + "download_count": 6124110, + "project": "azure-storage-file" + }, + { + "download_count": 6123086, + "project": "oscrypto" + }, + { + "download_count": 6089609, + "project": "kazoo" + }, + { + "download_count": 6087309, + "project": "cookiecutter" + }, + { + "download_count": 6069231, + "project": "jinja2-time" + }, + { + "download_count": 6060397, + "project": "azure" + }, + { + "download_count": 6048114, + "project": "google-cloud-translate" + }, + { + "download_count": 6041366, + "project": "humanize" + }, + { + "download_count": 6039221, + "project": "numexpr" + }, + { + "download_count": 6020894, + "project": "twilio" + }, + { + "download_count": 6012401, + "project": "cerberus" + }, + { + "download_count": 6012147, + "project": "azure-mgmt-logic" + }, + { + "download_count": 6006198, + "project": "google-cloud-language" + }, + { + "download_count": 6003966, + "project": "nodeenv" + }, + { + "download_count": 5973514, + "project": "azure-mgmt-scheduler" + }, + { + "download_count": 5943411, + "project": "backports-csv" + }, + { + "download_count": 5918171, + "project": "multi-key-dict" + }, + { + "download_count": 5880962, + "project": "python-memcached" + }, + { + "download_count": 5873333, + "project": "srsly" + }, + { + "download_count": 5867465, + "project": "cx-oracle" + }, + { + "download_count": 5859924, + "project": "blis" + }, + { + "download_count": 5855262, + "project": "azure-mgmt-datafactory" + }, + { + "download_count": 5829317, + "project": "identify" + }, + { + "download_count": 5817248, + "project": "pydata-google-auth" + }, + { + "download_count": 5816751, + "project": "parsel" + }, + { + "download_count": 5808925, + "project": "setuptools-scm" + }, + { + "download_count": 5798570, + "project": "confluent-kafka" + }, + { + "download_count": 5780362, + "project": "lunardate" + }, + { + "download_count": 5770962, + "project": "eventlet" + }, + { + "download_count": 5764369, + "project": "webtest" + }, + { + "download_count": 5762114, + "project": "sqlalchemy-utils" + }, + { + "download_count": 5748385, + "project": "pre-commit" + }, + { + "download_count": 5744591, + "project": "flask-restplus" + }, + { + "download_count": 5741800, + "project": "google-cloud-error-reporting" + }, + { + "download_count": 5727692, + "project": "gapic-google-cloud-datastore-v1" + }, + { + "download_count": 5726258, + "project": "google-cloud-speech" + }, + { + "download_count": 5696390, + "project": "tensorflow-gpu" + }, + { + "download_count": 5671626, + "project": "youtube-dl" + }, + { + "download_count": 5669862, + "project": "zope-proxy" + }, + { + "download_count": 5668657, + "project": "zope-hookable" + }, + { + "download_count": 5666674, + "project": "aspy-yaml" + }, + { + "download_count": 5665846, + "project": "pystan" + }, + { + "download_count": 5658876, + "project": "meld3" + }, + { + "download_count": 5657136, + "project": "zope-deferredimport" + }, + { + "download_count": 5646525, + "project": "altgraph" + }, + { + "download_count": 5638012, + "project": "yamllint" + }, + { + "download_count": 5627465, + "project": "pydispatcher" + }, + { + "download_count": 5598597, + "project": "pytest-html" + }, + { + "download_count": 5589472, + "project": "queuelib" + }, + { + "download_count": 5580580, + "project": "mpmath" + }, + { + "download_count": 5556096, + "project": "wasabi" + }, + { + "download_count": 5538810, + "project": "dateparser" + }, + { + "download_count": 5522745, + "project": "azure-mgmt-subscription" + }, + { + "download_count": 5500243, + "project": "flask-migrate" + }, + { + "download_count": 5494861, + "project": "cfgv" + }, + { + "download_count": 5490908, + "project": "azure-mgmt-notificationhubs" + }, + { + "download_count": 5479229, + "project": "azure-mgmt-managementpartner" + }, + { + "download_count": 5477766, + "project": "azure-mgmt-powerbiembedded" + }, + { + "download_count": 5471458, + "project": "azure-eventgrid" + }, + { + "download_count": 5469115, + "project": "azure-mgmt-commerce" + }, + { + "download_count": 5465959, + "project": "azure-mgmt-machinelearningcompute" + }, + { + "download_count": 5462201, + "project": "readme-renderer" + }, + { + "download_count": 5461957, + "project": "azure-mgmt-hanaonazure" + }, + { + "download_count": 5447652, + "project": "rfc3986" + }, + { + "download_count": 5440586, + "project": "scrapy" + }, + { + "download_count": 5434695, + "project": "aenum" + }, + { + "download_count": 5420091, + "project": "anyjson" + }, + { + "download_count": 5407106, + "project": "proto-google-cloud-datastore-v1" + }, + { + "download_count": 5387258, + "project": "sympy" + }, + { + "download_count": 5374203, + "project": "pygithub" + }, + { + "download_count": 5373585, + "project": "pytest-metadata" + }, + { + "download_count": 5340852, + "project": "paho-mqtt" + }, + { + "download_count": 5335035, + "project": "multiprocess" + }, + { + "download_count": 5333251, + "project": "googledatastore" + }, + { + "download_count": 5328607, + "project": "phoenixdb" + }, + { + "download_count": 5322559, + "project": "nose-exclude" + }, + { + "download_count": 5309246, + "project": "importlib-resources" + }, + { + "download_count": 5299450, + "project": "cookies" + }, + { + "download_count": 5277019, + "project": "tensorflow-tensorboard" + }, + { + "download_count": 5255084, + "project": "thrift-sasl" + }, + { + "download_count": 5249244, + "project": "jsonpath-rw" + }, + { + "download_count": 5245636, + "project": "oslo-i18n" + }, + { + "download_count": 5245466, + "project": "s2sphere" + }, + { + "download_count": 5245010, + "project": "whitenoise" + }, + { + "download_count": 5236181, + "project": "google-cloud-dns" + }, + { + "download_count": 5223390, + "project": "aws-sam-translator" + }, + { + "download_count": 5213027, + "project": "slacker" + }, + { + "download_count": 5165706, + "project": "hypothesis" + }, + { + "download_count": 5155283, + "project": "google-cloud-resource-manager" + }, + { + "download_count": 5152438, + "project": "debtcollector" + }, + { + "download_count": 5141790, + "project": "ruamel-ordereddict" + }, + { + "download_count": 5136659, + "project": "azure-loganalytics" + }, + { + "download_count": 5089358, + "project": "rx" + }, + { + "download_count": 5083806, + "project": "discord" + }, + { + "download_count": 5082337, + "project": "click-plugins" + }, + { + "download_count": 5069136, + "project": "google-cloud-videointelligence" + }, + { + "download_count": 5067821, + "project": "google-cloud-runtimeconfig" + }, + { + "download_count": 5043933, + "project": "inflect" + }, + { + "download_count": 5006490, + "project": "pulp" + }, + { + "download_count": 5001567, + "project": "oslo-utils" + }, + { + "download_count": 4965630, + "project": "azure-mgmt-devspaces" + }, + { + "download_count": 4949806, + "project": "stringcase" + }, + { + "download_count": 4926195, + "project": "django-appconf" + }, + { + "download_count": 4913373, + "project": "pynamodb" + }, + { + "download_count": 4913090, + "project": "dogpile-cache" + }, + { + "download_count": 4899768, + "project": "python-consul" + }, + { + "download_count": 4896198, + "project": "milksnake" + }, + { + "download_count": 4875874, + "project": "pypng" + }, + { + "download_count": 4868256, + "project": "oslo-config" + }, + { + "download_count": 4857940, + "project": "haversine" + }, + { + "download_count": 4854545, + "project": "azure-applicationinsights" + }, + { + "download_count": 4830085, + "project": "flower" + }, + { + "download_count": 4787508, + "project": "bandit" + }, + { + "download_count": 4766743, + "project": "strict-rfc3339" + }, + { + "download_count": 4744246, + "project": "findspark" + }, + { + "download_count": 4742234, + "project": "flask-admin" + }, + { + "download_count": 4742026, + "project": "qds-sdk" + }, + { + "download_count": 4735803, + "project": "pip-tools" + }, + { + "download_count": 4701984, + "project": "cliff" + }, + { + "download_count": 4701803, + "project": "ddtrace" + }, + { + "download_count": 4693878, + "project": "progressbar2" + }, + { + "download_count": 4652633, + "project": "python-utils" + }, + { + "download_count": 4645712, + "project": "cairocffi" + }, + { + "download_count": 4645547, + "project": "google-cloud-trace" + }, + { + "download_count": 4636704, + "project": "docker-py" + }, + { + "download_count": 4632853, + "project": "tinycss2" + }, + { + "download_count": 4627762, + "project": "apscheduler" + }, + { + "download_count": 4606642, + "project": "python-pam" + }, + { + "download_count": 4606137, + "project": "grpcio-gcp" + }, + { + "download_count": 4605186, + "project": "parse-type" + }, + { + "download_count": 4601072, + "project": "parameterized" + }, + { + "download_count": 4600206, + "project": "avro-python3" + }, + { + "download_count": 4589906, + "project": "pypiwin32" + }, + { + "download_count": 4587705, + "project": "olefile" + }, + { + "download_count": 4586230, + "project": "testtools" + }, + { + "download_count": 4583482, + "project": "dj-database-url" + }, + { + "download_count": 4572193, + "project": "basictracer" + }, + { + "download_count": 4567533, + "project": "macholib" + }, + { + "download_count": 4563623, + "project": "cligj" + }, + { + "download_count": 4560977, + "project": "google-cloud-container" + }, + { + "download_count": 4553683, + "project": "oslo-serialization" + }, + { + "download_count": 4544031, + "project": "logging" + }, + { + "download_count": 4543347, + "project": "click-completion" + }, + { + "download_count": 4542581, + "project": "pycares" + }, + { + "download_count": 4461143, + "project": "fiona" + }, + { + "download_count": 4454845, + "project": "mmh3" + }, + { + "download_count": 4447608, + "project": "jws" + }, + { + "download_count": 4433310, + "project": "python-docx" + }, + { + "download_count": 4432803, + "project": "mleap" + }, + { + "download_count": 4430881, + "project": "extras" + }, + { + "download_count": 4394588, + "project": "dataclasses" + }, + { + "download_count": 4384805, + "project": "fixtures" + }, + { + "download_count": 4368983, + "project": "cfn-lint" + }, + { + "download_count": 4347507, + "project": "cairosvg" + }, + { + "download_count": 4345671, + "project": "lz4" + }, + { + "download_count": 4341286, + "project": "flask-script" + }, + { + "download_count": 4335840, + "project": "statistics" + }, + { + "download_count": 4332342, + "project": "fbprophet" + }, + { + "download_count": 4329185, + "project": "cmd2" + }, + { + "download_count": 4323965, + "project": "brotli" + }, + { + "download_count": 4323647, + "project": "cytoolz" + }, + { + "download_count": 4315817, + "project": "polyaxon-client" + }, + { + "download_count": 4309639, + "project": "portalocker" + }, + { + "download_count": 4302427, + "project": "torchvision" + }, + { + "download_count": 4299923, + "project": "bumpversion" + }, + { + "download_count": 4291946, + "project": "python-jwt" + }, + { + "download_count": 4264873, + "project": "polyaxon-cli" + }, + { + "download_count": 4263296, + "project": "polyaxon-deploy" + }, + { + "download_count": 4260496, + "project": "coveralls" + }, + { + "download_count": 4256821, + "project": "python-geohash" + }, + { + "download_count": 4247442, + "project": "flask-caching" + }, + { + "download_count": 4223430, + "project": "cssselect2" + }, + { + "download_count": 4217166, + "project": "behave" + }, + { + "download_count": 4198998, + "project": "mozfile" + }, + { + "download_count": 4198846, + "project": "ddt" + }, + { + "download_count": 4192314, + "project": "aiodns" + }, + { + "download_count": 4180658, + "project": "googleads" + }, + { + "download_count": 4151629, + "project": "flake8-polyfill" + }, + { + "download_count": 4142826, + "project": "pyphen" + }, + { + "download_count": 4130090, + "project": "fastparquet" + }, + { + "download_count": 4125828, + "project": "flask-babel" + }, + { + "download_count": 4114954, + "project": "gcloud" + }, + { + "download_count": 4098408, + "project": "google-cloud-bigquery-datatransfer" + }, + { + "download_count": 4088308, + "project": "gorilla" + }, + { + "download_count": 4081407, + "project": "keystoneauth1" + }, + { + "download_count": 4077553, + "project": "requests-futures" + }, + { + "download_count": 4054249, + "project": "azureml-core" + }, + { + "download_count": 4042252, + "project": "python-ldap" + }, + { + "download_count": 4007776, + "project": "pathos" + }, + { + "download_count": 3999757, + "project": "ephem" + }, + { + "download_count": 3969692, + "project": "hyperopt" + }, + { + "download_count": 3949966, + "project": "testfixtures" + }, + { + "download_count": 3937830, + "project": "fonttools" + }, + { + "download_count": 3935226, + "project": "terminaltables" + }, + { + "download_count": 3927254, + "project": "easyprocess" + }, + { + "download_count": 3922990, + "project": "python-gflags" + }, + { + "download_count": 3912801, + "project": "deprecation" + }, + { + "download_count": 3905705, + "project": "nvidia-ml-py" + }, + { + "download_count": 3885807, + "project": "google-cloud-kms" + }, + { + "download_count": 3865843, + "project": "geojson" + }, + { + "download_count": 3828132, + "project": "robotframework" + }, + { + "download_count": 3820453, + "project": "gcsfs" + }, + { + "download_count": 3810489, + "project": "convertdate" + }, + { + "download_count": 3809802, + "project": "sockjs-tornado" + }, + { + "download_count": 3799689, + "project": "multipledispatch" + }, + { + "download_count": 3798810, + "project": "weasyprint" + }, + { + "download_count": 3793665, + "project": "tomlkit" + }, + { + "download_count": 3792308, + "project": "python-snappy" + }, + { + "download_count": 3787259, + "project": "django-model-utils" + }, + { + "download_count": 3780397, + "project": "distributed" + }, + { + "download_count": 3775038, + "project": "grequests" + }, + { + "download_count": 3771741, + "project": "flask-bcrypt" + }, + { + "download_count": 3769931, + "project": "fakeredis" + }, + { + "download_count": 3752939, + "project": "schedule" + }, + { + "download_count": 3746896, + "project": "validators" + }, + { + "download_count": 3721493, + "project": "knack" + }, + { + "download_count": 3693854, + "project": "pox" + }, + { + "download_count": 3682964, + "project": "sshtunnel" + }, + { + "download_count": 3681065, + "project": "tftpy" + }, + { + "download_count": 3676291, + "project": "pdfminer" + }, + { + "download_count": 3664933, + "project": "google-compute-engine" + }, + { + "download_count": 3647507, + "project": "graphene" + }, + { + "download_count": 3639253, + "project": "setuptools-git" + }, + { + "download_count": 3630380, + "project": "unittest-xml-reporting" + }, + { + "download_count": 3627156, + "project": "ciso8601" + }, + { + "download_count": 3627033, + "project": "sockjs" + }, + { + "download_count": 3625069, + "project": "shortuuid" + }, + { + "download_count": 3616592, + "project": "ray" + }, + { + "download_count": 3613699, + "project": "ppft" + }, + { + "download_count": 3597147, + "project": "shap" + }, + { + "download_count": 3590917, + "project": "azureml-model-management-sdk" + }, + { + "download_count": 3588391, + "project": "pygsheets" + }, + { + "download_count": 3584999, + "project": "flask-swagger" + }, + { + "download_count": 3575551, + "project": "cssutils" + }, + { + "download_count": 3568283, + "project": "pattern" + }, + { + "download_count": 3549188, + "project": "pylev" + }, + { + "download_count": 3544798, + "project": "ibm-db-sa" + }, + { + "download_count": 3526181, + "project": "pyathenajdbc" + }, + { + "download_count": 3518011, + "project": "pylint-plugin-utils" + }, + { + "download_count": 3517988, + "project": "pg8000" + }, + { + "download_count": 3517712, + "project": "tensorflow-model-analysis" + }, + { + "download_count": 3507991, + "project": "os-service-types" + }, + { + "download_count": 3489788, + "project": "python-swiftclient" + }, + { + "download_count": 3477450, + "project": "openstacksdk" + }, + { + "download_count": 3465240, + "project": "cfn-flip" + }, + { + "download_count": 3459223, + "project": "catkin-pkg" + }, + { + "download_count": 3455963, + "project": "cleo" + }, + { + "download_count": 3448945, + "project": "python-keystoneclient" + }, + { + "download_count": 3448335, + "project": "jellyfish" + }, + { + "download_count": 3444950, + "project": "apispec" + }, + { + "download_count": 3443490, + "project": "pastel" + }, + { + "download_count": 3434078, + "project": "django-tables2" + }, + { + "download_count": 3429540, + "project": "qrcode" + }, + { + "download_count": 3426160, + "project": "collectd-nvidianvml" + }, + { + "download_count": 3420045, + "project": "apache-airflow" + }, + { + "download_count": 3411604, + "project": "prison" + }, + { + "download_count": 3402478, + "project": "pefile" + }, + { + "download_count": 3393690, + "project": "commonmark" + }, + { + "download_count": 3388484, + "project": "tablib" + }, + { + "download_count": 3384168, + "project": "ntlm-auth" + }, + { + "download_count": 3377675, + "project": "geopandas" + }, + { + "download_count": 3366350, + "project": "jsmin" + }, + { + "download_count": 3361635, + "project": "antlr4-python3-runtime" + }, + { + "download_count": 3340033, + "project": "polyaxon-dockerizer" + }, + { + "download_count": 3293582, + "project": "odfpy" + }, + { + "download_count": 3269264, + "project": "openapi-codec" + }, + { + "download_count": 3258675, + "project": "utm" + }, + { + "download_count": 3251855, + "project": "pyvmomi" + }, + { + "download_count": 3251588, + "project": "poetry" + }, + { + "download_count": 3247520, + "project": "bitarray" + }, + { + "download_count": 3244587, + "project": "python-crontab" + }, + { + "download_count": 3243979, + "project": "django-mysql" + }, + { + "download_count": 3242901, + "project": "databricks-pypi1" + }, + { + "download_count": 3238235, + "project": "marshmallow-sqlalchemy" + }, + { + "download_count": 3226761, + "project": "emoji" + }, + { + "download_count": 3224704, + "project": "initools" + }, + { + "download_count": 3209542, + "project": "capstone" + }, + { + "download_count": 3200795, + "project": "djangorestframework-jwt" + }, + { + "download_count": 3184641, + "project": "django-rest-swagger" + }, + { + "download_count": 3181604, + "project": "tensorflow-hub" + }, + { + "download_count": 3179141, + "project": "ratelimit" + }, + { + "download_count": 3176283, + "project": "asyncio" + }, + { + "download_count": 3176119, + "project": "spark-sklearn" + }, + { + "download_count": 3173008, + "project": "paste" + }, + { + "download_count": 3169917, + "project": "pytest-asyncio" + }, + { + "download_count": 3159532, + "project": "django-crispy-forms" + }, + { + "download_count": 3156134, + "project": "cachy" + }, + { + "download_count": 3150001, + "project": "asgiref" + }, + { + "download_count": 3138323, + "project": "django-environ" + }, + { + "download_count": 3127100, + "project": "fire" + }, + { + "download_count": 3123851, + "project": "salesforce-bulk" + }, + { + "download_count": 3117730, + "project": "lightstep" + }, + { + "download_count": 3116358, + "project": "azure-cli-core" + }, + { + "download_count": 3110959, + "project": "recommonmark" + }, + { + "download_count": 3095813, + "project": "pysqlite" + }, + { + "download_count": 3088484, + "project": "clickclick" + }, + { + "download_count": 3077942, + "project": "heapdict" + }, + { + "download_count": 3077928, + "project": "google-cloud-dataflow" + }, + { + "download_count": 3073863, + "project": "spotinst-agent" + }, + { + "download_count": 3073217, + "project": "analytics-python" + }, + { + "download_count": 3065872, + "project": "nose-timer" + }, + { + "download_count": 3064209, + "project": "rq" + }, + { + "download_count": 3062467, + "project": "wandb" + }, + { + "download_count": 3060966, + "project": "jsonfield" + }, + { + "download_count": 3050206, + "project": "pyinotify" + }, + { + "download_count": 3048455, + "project": "pygame" + }, + { + "download_count": 3043542, + "project": "intel-openmp" + }, + { + "download_count": 3042574, + "project": "zict" + }, + { + "download_count": 3040916, + "project": "pytest-split-tests" + }, + { + "download_count": 3036872, + "project": "pep8-naming" + }, + { + "download_count": 3029439, + "project": "ordered-set" + }, + { + "download_count": 3025549, + "project": "graphql-relay" + }, + { + "download_count": 3019093, + "project": "troposphere" + }, + { + "download_count": 3009250, + "project": "azure-kusto-data" + }, + { + "download_count": 3008025, + "project": "opencv-contrib-python" + }, + { + "download_count": 3003750, + "project": "requests-ntlm" + }, + { + "download_count": 3003003, + "project": "tb-nightly" + }, + { + "download_count": 2996766, + "project": "credstash" + }, + { + "download_count": 2989520, + "project": "flask-appbuilder" + }, + { + "download_count": 2980537, + "project": "plumbum" + }, + { + "download_count": 2973597, + "project": "pager" + }, + { + "download_count": 2967237, + "project": "schema" + }, + { + "download_count": 2965535, + "project": "mkl" + }, + { + "download_count": 2963377, + "project": "blessed" + }, + { + "download_count": 2953182, + "project": "datashape" + }, + { + "download_count": 2941855, + "project": "validate-email" + }, + { + "download_count": 2939744, + "project": "pylint-django" + }, + { + "download_count": 2938945, + "project": "webapp2" + }, + { + "download_count": 2936891, + "project": "livereload" + }, + { + "download_count": 2935073, + "project": "cvxopt" + }, + { + "download_count": 2934589, + "project": "cement" + }, + { + "download_count": 2931314, + "project": "tfx-bsl" + }, + { + "download_count": 2922270, + "project": "rospkg" + }, + { + "download_count": 2912677, + "project": "flaky" + }, + { + "download_count": 2909121, + "project": "filemagic" + }, + { + "download_count": 2902933, + "project": "msgpack-numpy" + }, + { + "download_count": 2895921, + "project": "uamqp" + }, + { + "download_count": 2895636, + "project": "accumulation-tree" + }, + { + "download_count": 2894366, + "project": "pyudorandom" + }, + { + "download_count": 2892673, + "project": "tdigest" + }, + { + "download_count": 2888615, + "project": "tensorflow-data-validation" + }, + { + "download_count": 2886531, + "project": "python-subunit" + }, + { + "download_count": 2878388, + "project": "gitdb" + }, + { + "download_count": 2874189, + "project": "python-novaclient" + }, + { + "download_count": 2857065, + "project": "asyncpg" + }, + { + "download_count": 2847295, + "project": "social-auth-core" + }, + { + "download_count": 2838600, + "project": "azure-cli-nspkg" + }, + { + "download_count": 2838428, + "project": "requestsexceptions" + }, + { + "download_count": 2834024, + "project": "filechunkio" + }, + { + "download_count": 2828975, + "project": "argon2-cffi" + }, + { + "download_count": 2822266, + "project": "beautifulsoup" + }, + { + "download_count": 2821979, + "project": "smmap" + }, + { + "download_count": 2819754, + "project": "django-multiselectfield" + }, + { + "download_count": 2815640, + "project": "drf-yasg" + }, + { + "download_count": 2813694, + "project": "boltons" + }, + { + "download_count": 2810269, + "project": "httpretty" + }, + { + "download_count": 2806190, + "project": "pyqt5" + }, + { + "download_count": 2802770, + "project": "hashids" + }, + { + "download_count": 2792830, + "project": "pdfrw" + }, + { + "download_count": 2792334, + "project": "flask-openid" + }, + { + "download_count": 2791834, + "project": "gapic-google-cloud-error-reporting-v1beta1" + }, + { + "download_count": 2790983, + "project": "cookiejar" + }, + { + "download_count": 2788259, + "project": "proto-google-cloud-error-reporting-v1beta1" + }, + { + "download_count": 2779755, + "project": "flask-marshmallow" + }, + { + "download_count": 2753420, + "project": "pyinstaller" + }, + { + "download_count": 2752867, + "project": "sqlalchemy-redshift" + }, + { + "download_count": 2749279, + "project": "python-logstash" + }, + { + "download_count": 2747409, + "project": "django-nose" + }, + { + "download_count": 2744486, + "project": "azure-cosmos" + }, + { + "download_count": 2738853, + "project": "verboselogs" + }, + { + "download_count": 2724920, + "project": "googlemaps" + }, + { + "download_count": 2722861, + "project": "social-auth-app-django" + }, + { + "download_count": 2706844, + "project": "async-generator" + }, + { + "download_count": 2704711, + "project": "funcy" + }, + { + "download_count": 2703274, + "project": "clint" + }, + { + "download_count": 2701212, + "project": "pytest-sugar" + }, + { + "download_count": 2699840, + "project": "django-timezone-field" + }, + { + "download_count": 2697450, + "project": "jaydebeapi" + }, + { + "download_count": 2693049, + "project": "brotlipy" + }, + { + "download_count": 2686973, + "project": "args" + }, + { + "download_count": 2683870, + "project": "vcrpy" + }, + { + "download_count": 2677855, + "project": "marshmallow-enum" + }, + { + "download_count": 2673327, + "project": "peewee" + }, + { + "download_count": 2670889, + "project": "osc-lib" + }, + { + "download_count": 2670484, + "project": "langdetect" + }, + { + "download_count": 2663228, + "project": "enum" + }, + { + "download_count": 2655265, + "project": "azure-cli-telemetry" + }, + { + "download_count": 2651881, + "project": "tables" + }, + { + "download_count": 2649758, + "project": "pastedeploy" + }, + { + "download_count": 2646163, + "project": "swagger-spec-validator" + }, + { + "download_count": 2644724, + "project": "tld" + }, + { + "download_count": 2642975, + "project": "kafka" + }, + { + "download_count": 2641270, + "project": "cchardet" + }, + { + "download_count": 2636532, + "project": "timezonefinder" + }, + { + "download_count": 2634114, + "project": "mongoengine" + }, + { + "download_count": 2615568, + "project": "python-crfsuite" + }, + { + "download_count": 2600491, + "project": "timeout-decorator" + }, + { + "download_count": 2592520, + "project": "rjsmin" + }, + { + "download_count": 2589546, + "project": "brunel" + }, + { + "download_count": 2585708, + "project": "autobahn" + }, + { + "download_count": 2584709, + "project": "webargs" + }, + { + "download_count": 2584111, + "project": "pyvirtualdisplay" + }, + { + "download_count": 2580140, + "project": "descartes" + }, + { + "download_count": 2551557, + "project": "cassandra-driver" + }, + { + "download_count": 2549257, + "project": "aws-requests-auth" + }, + { + "download_count": 2540875, + "project": "rope" + }, + { + "download_count": 2538617, + "project": "aiofiles" + }, + { + "download_count": 2532557, + "project": "pycountry-convert" + }, + { + "download_count": 2528277, + "project": "branca" + }, + { + "download_count": 2524264, + "project": "mechanize" + }, + { + "download_count": 2519234, + "project": "mysql-connector-python-rf" + }, + { + "download_count": 2517497, + "project": "pywebhdfs" + }, + { + "download_count": 2503645, + "project": "folium" + }, + { + "download_count": 2498263, + "project": "aiohttp-cors" + }, + { + "download_count": 2497590, + "project": "flask-httpauth" + }, + { + "download_count": 2495242, + "project": "django-ipware" + }, + { + "download_count": 2494397, + "project": "jupyterlab" + }, + { + "download_count": 2493673, + "project": "pybind11" + }, + { + "download_count": 2492477, + "project": "diff-match-patch" + }, + { + "download_count": 2491248, + "project": "jupyter-pip" + }, + { + "download_count": 2488659, + "project": "dpath" + }, + { + "download_count": 2488591, + "project": "marionette-driver" + }, + { + "download_count": 2484149, + "project": "dotnetcore2" + }, + { + "download_count": 2478052, + "project": "pythonwhois" + }, + { + "download_count": 2470002, + "project": "google-cloud-dataproc" + }, + { + "download_count": 2458163, + "project": "enum-compat" + }, + { + "download_count": 2455272, + "project": "awsebcli" + }, + { + "download_count": 2454145, + "project": "django-celery-beat" + }, + { + "download_count": 2453795, + "project": "rfc3987" + }, + { + "download_count": 2447431, + "project": "py-bcrypt" + }, + { + "download_count": 2442569, + "project": "python-gitlab" + }, + { + "download_count": 2439713, + "project": "translationstring" + }, + { + "download_count": 2439355, + "project": "yq" + }, + { + "download_count": 2435098, + "project": "pysnmp" + }, + { + "download_count": 2432521, + "project": "first" + }, + { + "download_count": 2429585, + "project": "hpack" + }, + { + "download_count": 2428283, + "project": "python-glanceclient" + }, + { + "download_count": 2422100, + "project": "venusian" + }, + { + "download_count": 2416591, + "project": "bitstring" + }, + { + "download_count": 2408841, + "project": "flake8-docstrings" + }, + { + "download_count": 2407495, + "project": "attrdict" + }, + { + "download_count": 2404932, + "project": "ws4py" + }, + { + "download_count": 2402857, + "project": "os-client-config" + }, + { + "download_count": 2401078, + "project": "locustio" + }, + { + "download_count": 2398281, + "project": "junit-xml" + }, + { + "download_count": 2395343, + "project": "mozversion" + }, + { + "download_count": 2395052, + "project": "azureml-dataprep" + }, + { + "download_count": 2390036, + "project": "sshpubkeys" + }, + { + "download_count": 2387469, + "project": "h2" + }, + { + "download_count": 2386629, + "project": "ansible-lint" + }, + { + "download_count": 2381639, + "project": "txaio" + }, + { + "download_count": 2380783, + "project": "wget" + }, + { + "download_count": 2375129, + "project": "pytest-rerunfailures" + }, + { + "download_count": 2371842, + "project": "oslo-log" + }, + { + "download_count": 2370221, + "project": "hyperframe" + }, + { + "download_count": 2364172, + "project": "python-openid" + }, + { + "download_count": 2357263, + "project": "flask-jwt-extended" + }, + { + "download_count": 2354920, + "project": "azureml-dataprep-native" + }, + { + "download_count": 2346411, + "project": "flake8-import-order" + }, + { + "download_count": 2334525, + "project": "pypandoc" + }, + { + "download_count": 2329461, + "project": "pysmi" + }, + { + "download_count": 2328121, + "project": "json-merge-patch" + }, + { + "download_count": 2325050, + "project": "falcon" + }, + { + "download_count": 2314962, + "project": "google-cloud-automl" + }, + { + "download_count": 2313548, + "project": "azure-kusto-ingest" + }, + { + "download_count": 2311574, + "project": "aioredis" + }, + { + "download_count": 2307595, + "project": "py-cpuinfo" + }, + { + "download_count": 2305070, + "project": "imbalanced-learn" + }, + { + "download_count": 2304296, + "project": "django-compressor" + }, + { + "download_count": 2304263, + "project": "memoized-property" + }, + { + "download_count": 2304114, + "project": "azureml-telemetry" + }, + { + "download_count": 2301461, + "project": "textblob" + }, + { + "download_count": 2299510, + "project": "snowflake-sqlalchemy" + }, + { + "download_count": 2287102, + "project": "schematics" + }, + { + "download_count": 2276329, + "project": "virtualenvwrapper" + }, + { + "download_count": 2272329, + "project": "aws-encryption-sdk" + }, + { + "download_count": 2272227, + "project": "opencensus" + }, + { + "download_count": 2267894, + "project": "django-allauth" + }, + { + "download_count": 2267072, + "project": "ibm-db" + }, + { + "download_count": 2258528, + "project": "python-cinderclient" + }, + { + "download_count": 2252312, + "project": "objectpath" + }, + { + "download_count": 2242218, + "project": "tf-estimator-nightly" + }, + { + "download_count": 2231619, + "project": "flask-compress" + }, + { + "download_count": 2224267, + "project": "azureml-pipeline-core" + }, + { + "download_count": 2221757, + "project": "connexion" + }, + { + "download_count": 2219740, + "project": "django-phonenumber-field" + }, + { + "download_count": 2214496, + "project": "warlock" + }, + { + "download_count": 2213923, + "project": "pyqt5-sip" + }, + { + "download_count": 2210221, + "project": "phonenumberslite" + }, + { + "download_count": 2209512, + "project": "oslo-context" + }, + { + "download_count": 2194021, + "project": "azure-cli-command-modules-nspkg" + }, + { + "download_count": 2185051, + "project": "pathlib-mate" + }, + { + "download_count": 2184347, + "project": "jsonref" + }, + { + "download_count": 2182555, + "project": "pytimeparse" + }, + { + "download_count": 2180696, + "project": "databricks-pypi2" + }, + { + "download_count": 2178821, + "project": "natsort" + }, + { + "download_count": 2176243, + "project": "ipaddr" + }, + { + "download_count": 2171374, + "project": "path-py" + }, + { + "download_count": 2170378, + "project": "azure-mgmt-hdinsight" + }, + { + "download_count": 2153590, + "project": "firebase-admin" + }, + { + "download_count": 2150903, + "project": "azureml-train-core" + }, + { + "download_count": 2148663, + "project": "pypyodbc" + }, + { + "download_count": 2145885, + "project": "uszipcode" + }, + { + "download_count": 2145383, + "project": "azureml-train-restclients-hyperdrive" + }, + { + "download_count": 2142865, + "project": "premailer" + }, + { + "download_count": 2137325, + "project": "h11" + }, + { + "download_count": 2132743, + "project": "pyformance" + }, + { + "download_count": 2132535, + "project": "shellescape" + }, + { + "download_count": 2130341, + "project": "django-import-export" + }, + { + "download_count": 2127667, + "project": "wsaccel" + }, + { + "download_count": 2126611, + "project": "django-js-asset" + }, + { + "download_count": 2126191, + "project": "snakebite" + }, + { + "download_count": 2124659, + "project": "wordcloud" + }, + { + "download_count": 2109163, + "project": "antlr4-python2-runtime" + }, + { + "download_count": 2099008, + "project": "naked" + }, + { + "download_count": 2098854, + "project": "jinja2-cli" + }, + { + "download_count": 2097764, + "project": "onnx" + }, + { + "download_count": 2081320, + "project": "pytesseract" + }, + { + "download_count": 2076961, + "project": "azureml-pipeline-steps" + }, + { + "download_count": 2073133, + "project": "flask-testing" + }, + { + "download_count": 2072907, + "project": "pytest-env" + }, + { + "download_count": 2072150, + "project": "django-widget-tweaks" + }, + { + "download_count": 2070728, + "project": "django-webpack-loader" + }, + { + "download_count": 2069730, + "project": "azureml-pipeline" + }, + { + "download_count": 2069241, + "project": "mrjob" + }, + { + "download_count": 2055974, + "project": "public" + }, + { + "download_count": 2053631, + "project": "python-whois" + }, + { + "download_count": 2052521, + "project": "safety" + }, + { + "download_count": 2038912, + "project": "azure-multiapi-storage" + }, + { + "download_count": 2038114, + "project": "google-cloud-tasks" + }, + { + "download_count": 2037912, + "project": "partd" + }, + { + "download_count": 2033573, + "project": "rcssmin" + }, + { + "download_count": 2032537, + "project": "uuid" + }, + { + "download_count": 2030463, + "project": "azureml-train" + }, + { + "download_count": 2028467, + "project": "vsts-cd-manager" + }, + { + "download_count": 2025661, + "project": "pyjks" + }, + { + "download_count": 2025022, + "project": "flake8-quotes" + }, + { + "download_count": 2022199, + "project": "python-socketio" + }, + { + "download_count": 2021994, + "project": "slimit" + }, + { + "download_count": 2021337, + "project": "pygeocoder" + }, + { + "download_count": 2020656, + "project": "javaobj-py3" + }, + { + "download_count": 2019345, + "project": "tweepy" + }, + { + "download_count": 2015977, + "project": "grpc-google-logging-v2" + }, + { + "download_count": 2013359, + "project": "twofish" + }, + { + "download_count": 2010440, + "project": "urwid" + }, + { + "download_count": 2008501, + "project": "pyathena" + }, + { + "download_count": 2004648, + "project": "azureml-sdk" + }, + { + "download_count": 2002586, + "project": "pdfminer-six" + }, + { + "download_count": 2000934, + "project": "grpc-google-pubsub-v1" + }, + { + "download_count": 1999960, + "project": "astral" + }, + { + "download_count": 1996773, + "project": "python-box" + }, + { + "download_count": 1992382, + "project": "python-openstackclient" + }, + { + "download_count": 1987939, + "project": "toposort" + }, + { + "download_count": 1984547, + "project": "httptools" + }, + { + "download_count": 1980989, + "project": "asynctest" + }, + { + "download_count": 1978811, + "project": "pycalverter" + }, + { + "download_count": 1975990, + "project": "django-mptt" + }, + { + "download_count": 1974600, + "project": "nameparser" + }, + { + "download_count": 1974472, + "project": "geomet" + }, + { + "download_count": 1974084, + "project": "rtree" + }, + { + "download_count": 1970886, + "project": "gax-google-logging-v2" + }, + { + "download_count": 1967604, + "project": "openapi-spec-validator" + }, + { + "download_count": 1966141, + "project": "simpleeval" + }, + { + "download_count": 1965371, + "project": "gax-google-pubsub-v1" + }, + { + "download_count": 1964155, + "project": "pympler" + }, + { + "download_count": 1957946, + "project": "pint" + }, + { + "download_count": 1954321, + "project": "django-celery-results" + }, + { + "download_count": 1950586, + "project": "oauth2" + }, + { + "download_count": 1947313, + "project": "collections-extended" + }, + { + "download_count": 1943588, + "project": "dparse" + }, + { + "download_count": 1937747, + "project": "azure-mgmt-botservice" + }, + { + "download_count": 1935888, + "project": "facebook-business" + }, + { + "download_count": 1932910, + "project": "django-localflavor" + }, + { + "download_count": 1931470, + "project": "slackweb" + }, + { + "download_count": 1919103, + "project": "azure-eventhub" + }, + { + "download_count": 1918652, + "project": "django-braces" + }, + { + "download_count": 1917375, + "project": "fake-useragent" + }, + { + "download_count": 1916732, + "project": "python-engineio" + }, + { + "download_count": 1904465, + "project": "django-countries" + }, + { + "download_count": 1901273, + "project": "ptvsd" + }, + { + "download_count": 1899393, + "project": "orderedmultidict" + }, + { + "download_count": 1897121, + "project": "jwcrypto" + }, + { + "download_count": 1895022, + "project": "azure-mgmt-security" + }, + { + "download_count": 1893082, + "project": "awacs" + }, + { + "download_count": 1889385, + "project": "azure-functions-devops-build" + }, + { + "download_count": 1884376, + "project": "locket" + }, + { + "download_count": 1882404, + "project": "ctutlz" + }, + { + "download_count": 1875062, + "project": "snapshottest" + }, + { + "download_count": 1874184, + "project": "pdfkit" + }, + { + "download_count": 1870591, + "project": "scapy" + }, + { + "download_count": 1869037, + "project": "opencensus-context" + }, + { + "download_count": 1862753, + "project": "flask-mail" + }, + { + "download_count": 1860985, + "project": "intervaltree" + }, + { + "download_count": 1856012, + "project": "azure-mgmt-sqlvirtualmachine" + }, + { + "download_count": 1853788, + "project": "azure-mgmt-kusto" + }, + { + "download_count": 1853245, + "project": "luigi" + }, + { + "download_count": 1852083, + "project": "pylru" + }, + { + "download_count": 1848356, + "project": "sklearn-pandas" + }, + { + "download_count": 1846838, + "project": "pydantic" + }, + { + "download_count": 1845633, + "project": "email-validator" + }, + { + "download_count": 1844376, + "project": "pyquery" + }, + { + "download_count": 1841139, + "project": "django-oauth-toolkit" + }, + { + "download_count": 1839835, + "project": "memory-profiler" + }, + { + "download_count": 1839825, + "project": "jupyterlab-server" + }, + { + "download_count": 1835726, + "project": "sqlalchemy-migrate" + }, + { + "download_count": 1832053, + "project": "retry-decorator" + }, + { + "download_count": 1830194, + "project": "robotframework-seleniumlibrary" + }, + { + "download_count": 1825914, + "project": "koalas" + }, + { + "download_count": 1822090, + "project": "amazon-dax-client" + }, + { + "download_count": 1821759, + "project": "python-nvd3" + }, + { + "download_count": 1818147, + "project": "utlz" + }, + { + "download_count": 1813328, + "project": "requests-kerberos" + }, + { + "download_count": 1803051, + "project": "ftfy" + }, + { + "download_count": 1798001, + "project": "crypto" + }, + { + "download_count": 1792237, + "project": "distlib" + }, + { + "download_count": 1791068, + "project": "wordsegment" + }, + { + "download_count": 1790178, + "project": "django-taggit" + }, + { + "download_count": 1783750, + "project": "suds" + }, + { + "download_count": 1782898, + "project": "fabric3" + }, + { + "download_count": 1782756, + "project": "socksipy-branch" + }, + { + "download_count": 1778530, + "project": "webcolors" + }, + { + "download_count": 1773769, + "project": "orderedset" + }, + { + "download_count": 1770892, + "project": "mxnet" + }, + { + "download_count": 1767740, + "project": "mixpanel" + }, + { + "download_count": 1766756, + "project": "python-stdnum" + }, + { + "download_count": 1765611, + "project": "polib" + }, + { + "download_count": 1762017, + "project": "pysaml2" + }, + { + "download_count": 1760938, + "project": "pywinpty" + }, + { + "download_count": 1760472, + "project": "curlify" + }, + { + "download_count": 1759532, + "project": "dulwich" + }, + { + "download_count": 1755858, + "project": "tzwhere" + }, + { + "download_count": 1753697, + "project": "pyotp" + }, + { + "download_count": 1752520, + "project": "dropbox" + }, + { + "download_count": 1748789, + "project": "thriftpy" + }, + { + "download_count": 1744492, + "project": "yattag" + }, + { + "download_count": 1744207, + "project": "xxhash" + }, + { + "download_count": 1740901, + "project": "colorlover" + }, + { + "download_count": 1740812, + "project": "mkdocs" + }, + { + "download_count": 1723311, + "project": "iso3166" + }, + { + "download_count": 1722795, + "project": "gcs-oauth2-boto-plugin" + }, + { + "download_count": 1720946, + "project": "protorpc" + }, + { + "download_count": 1717972, + "project": "sentinels" + }, + { + "download_count": 1716396, + "project": "pykalman" + }, + { + "download_count": 1715123, + "project": "pkgconfig" + }, + { + "download_count": 1714704, + "project": "geohash" + }, + { + "download_count": 1712854, + "project": "google-cloud-dlp" + }, + { + "download_count": 1711556, + "project": "resampy" + }, + { + "download_count": 1705164, + "project": "request" + }, + { + "download_count": 1696070, + "project": "usaddress" + }, + { + "download_count": 1694720, + "project": "superlance" + }, + { + "download_count": 1692010, + "project": "librato-metrics" + }, + { + "download_count": 1690356, + "project": "flask-oauthlib" + }, + { + "download_count": 1686047, + "project": "google-cloud-texttospeech" + }, + { + "download_count": 1677666, + "project": "post" + }, + { + "download_count": 1675876, + "project": "get" + }, + { + "download_count": 1669578, + "project": "daphne" + }, + { + "download_count": 1665895, + "project": "librosa" + }, + { + "download_count": 1665557, + "project": "pyelftools" + }, + { + "download_count": 1665384, + "project": "query-string" + }, + { + "download_count": 1663244, + "project": "pywinrm" + }, + { + "download_count": 1660863, + "project": "pyreadline" + }, + { + "download_count": 1657504, + "project": "ez-setup" + }, + { + "download_count": 1656438, + "project": "channels" + }, + { + "download_count": 1640299, + "project": "node-semver" + }, + { + "download_count": 1638276, + "project": "tensorboardx" + }, + { + "download_count": 1631659, + "project": "htmlmin" + }, + { + "download_count": 1625146, + "project": "tensorflow-datasets" + }, + { + "download_count": 1624914, + "project": "audioread" + }, + { + "download_count": 1621703, + "project": "couchdb" + }, + { + "download_count": 1618223, + "project": "google-reauth" + }, + { + "download_count": 1616648, + "project": "google-cloud-redis" + }, + { + "download_count": 1615335, + "project": "autograd" + }, + { + "download_count": 1609038, + "project": "rollbar" + }, + { + "download_count": 1608426, + "project": "pyu2f" + }, + { + "download_count": 1603406, + "project": "iptools" + }, + { + "download_count": 1601716, + "project": "compatibility-lib" + }, + { + "download_count": 1599718, + "project": "google-cloud-asset" + }, + { + "download_count": 1599709, + "project": "azure-mgmt-privatedns" + }, + { + "download_count": 1596670, + "project": "python-decouple" + }, + { + "download_count": 1592734, + "project": "oslo-concurrency" + }, + { + "download_count": 1590149, + "project": "mongomock" + }, + { + "download_count": 1590067, + "project": "fluent-logger" + }, + { + "download_count": 1589332, + "project": "pygrok" + }, + { + "download_count": 1586920, + "project": "rauth" + }, + { + "download_count": 1585024, + "project": "probableparsing" + }, + { + "download_count": 1580625, + "project": "dominate" + }, + { + "download_count": 1577725, + "project": "pykerberos" + }, + { + "download_count": 1577380, + "project": "pyramid" + }, + { + "download_count": 1575279, + "project": "flask-cache" + }, + { + "download_count": 1575048, + "project": "pytest-cache" + }, + { + "download_count": 1574450, + "project": "pyee" + }, + { + "download_count": 1572539, + "project": "bingads" + }, + { + "download_count": 1569151, + "project": "appium-python-client" + }, + { + "download_count": 1567159, + "project": "pygam" + }, + { + "download_count": 1564680, + "project": "fysom" + }, + { + "download_count": 1563117, + "project": "tempita" + }, + { + "download_count": 1561979, + "project": "pywin32-ctypes" + }, + { + "download_count": 1561323, + "project": "diskcache" + }, + { + "download_count": 1558407, + "project": "pyhs2" + }, + { + "download_count": 1556417, + "project": "frozendict" + }, + { + "download_count": 1556392, + "project": "immutables" + }, + { + "download_count": 1550611, + "project": "python-neutronclient" + }, + { + "download_count": 1549879, + "project": "gspread-dataframe" + }, + { + "download_count": 1545947, + "project": "pyro4" + }, + { + "download_count": 1539049, + "project": "vertica-python" + }, + { + "download_count": 1538249, + "project": "google-cloud-securitycenter" + }, + { + "download_count": 1532048, + "project": "m3u8" + }, + { + "download_count": 1530674, + "project": "serpent" + }, + { + "download_count": 1527389, + "project": "aiobotocore" + }, + { + "download_count": 1526900, + "project": "django-reversion" + }, + { + "download_count": 1525911, + "project": "tox-travis" + }, + { + "download_count": 1524549, + "project": "pluginbase" + }, + { + "download_count": 1523680, + "project": "google-cloud-iot" + }, + { + "download_count": 1523139, + "project": "pykafka" + }, + { + "download_count": 1522621, + "project": "anyconfig" + }, + { + "download_count": 1520539, + "project": "pyjwkest" + }, + { + "download_count": 1520176, + "project": "django-formtools" + }, + { + "download_count": 1519701, + "project": "vowpalwabbit" + }, + { + "download_count": 1518864, + "project": "gprof2dot" + }, + { + "download_count": 1517841, + "project": "presto-python-client" + }, + { + "download_count": 1515284, + "project": "delorean" + }, + { + "download_count": 1514817, + "project": "json5" + }, + { + "download_count": 1511462, + "project": "num2words" + }, + { + "download_count": 1507178, + "project": "pylibmc" + }, + { + "download_count": 1505966, + "project": "httpagentparser" + }, + { + "download_count": 1504331, + "project": "drf-nested-routers" + }, + { + "download_count": 1504075, + "project": "icalendar" + }, + { + "download_count": 1503765, + "project": "google-cloud-websecurityscanner" + }, + { + "download_count": 1501399, + "project": "lru-dict" + }, + { + "download_count": 1496923, + "project": "cloudant" + }, + { + "download_count": 1493340, + "project": "keyrings-alt" + }, + { + "download_count": 1492739, + "project": "cattrs" + }, + { + "download_count": 1491297, + "project": "model-mommy" + }, + { + "download_count": 1490933, + "project": "jenkinsapi" + }, + { + "download_count": 1488901, + "project": "workalendar" + }, + { + "download_count": 1486683, + "project": "lifetimes" + }, + { + "download_count": 1484449, + "project": "sseclient-py" + }, + { + "download_count": 1481519, + "project": "python-etcd" + }, + { + "download_count": 1480386, + "project": "testinfra" + }, + { + "download_count": 1479219, + "project": "sentencepiece" + }, + { + "download_count": 1479194, + "project": "scikit-optimize" + }, + { + "download_count": 1477712, + "project": "flask-responses" + }, + { + "download_count": 1468207, + "project": "django-polymorphic" + }, + { + "download_count": 1467601, + "project": "azure-mgmt-deploymentmanager" + }, + { + "download_count": 1464092, + "project": "routes" + }, + { + "download_count": 1463152, + "project": "editdistance" + }, + { + "download_count": 1460523, + "project": "bugsnag" + }, + { + "download_count": 1453426, + "project": "conan" + }, + { + "download_count": 1449766, + "project": "autowrapt" + }, + { + "download_count": 1448235, + "project": "fasttext" + }, + { + "download_count": 1445709, + "project": "django-rest-auth" + }, + { + "download_count": 1444092, + "project": "catboost" + }, + { + "download_count": 1442809, + "project": "pydash" + }, + { + "download_count": 1442503, + "project": "libsass" + }, + { + "download_count": 1441996, + "project": "importlib" + }, + { + "download_count": 1440920, + "project": "pytest-flask" + }, + { + "download_count": 1440731, + "project": "django-simple-history" + }, + { + "download_count": 1439129, + "project": "django-picklefield" + }, + { + "download_count": 1437255, + "project": "trollius" + }, + { + "download_count": 1433413, + "project": "ml-metadata" + }, + { + "download_count": 1428493, + "project": "port-for" + }, + { + "download_count": 1426881, + "project": "flake8-bugbear" + }, + { + "download_count": 1425070, + "project": "python-nmap" + }, + { + "download_count": 1424275, + "project": "newlinejson" + }, + { + "download_count": 1423507, + "project": "pytest-benchmark" + }, + { + "download_count": 1422061, + "project": "hacking" + }, + { + "download_count": 1420833, + "project": "ratelim" + }, + { + "download_count": 1416683, + "project": "rdflib" + }, + { + "download_count": 1415247, + "project": "ninja" + }, + { + "download_count": 1413811, + "project": "geocoder" + }, + { + "download_count": 1413778, + "project": "parsimonious" + }, + { + "download_count": 1409060, + "project": "xmlsec" + }, + { + "download_count": 1407612, + "project": "jsonpath-ng" + }, + { + "download_count": 1404958, + "project": "authy" + }, + { + "download_count": 1399670, + "project": "python3-saml" + }, + { + "download_count": 1399023, + "project": "django-ratelimit" + }, + { + "download_count": 1398229, + "project": "watson-machine-learning-client" + }, + { + "download_count": 1397882, + "project": "motor" + }, + { + "download_count": 1397503, + "project": "pyusb" + }, + { + "download_count": 1393071, + "project": "eli5" + }, + { + "download_count": 1392124, + "project": "facebook-sdk" + }, + { + "download_count": 1391265, + "project": "py-zabbix" + }, + { + "download_count": 1390039, + "project": "threatconnect" + }, + { + "download_count": 1389772, + "project": "github3-py" + }, + { + "download_count": 1384962, + "project": "dash-renderer" + }, + { + "download_count": 1384373, + "project": "pyzipcode3" + }, + { + "download_count": 1384208, + "project": "transaction" + }, + { + "download_count": 1377748, + "project": "dash" + }, + { + "download_count": 1377392, + "project": "contextvars" + }, + { + "download_count": 1375491, + "project": "pyppeteer" + }, + { + "download_count": 1374745, + "project": "imutils" + }, + { + "download_count": 1373022, + "project": "predicthq" + }, + { + "download_count": 1371449, + "project": "furl" + }, + { + "download_count": 1370079, + "project": "graypy" + }, + { + "download_count": 1368582, + "project": "ipy" + }, + { + "download_count": 1365609, + "project": "apache-libcloud" + }, + { + "download_count": 1363504, + "project": "langid" + }, + { + "download_count": 1362248, + "project": "happybase" + }, + { + "download_count": 1362080, + "project": "wand" + }, + { + "download_count": 1359167, + "project": "dash-core-components" + }, + { + "download_count": 1355835, + "project": "teamcity-messages" + }, + { + "download_count": 1353938, + "project": "django-treebeard" + }, + { + "download_count": 1353094, + "project": "bottleneck" + }, + { + "download_count": 1347193, + "project": "pipdeptree" + }, + { + "download_count": 1346804, + "project": "flask-socketio" + }, + { + "download_count": 1345086, + "project": "feather-format" + }, + { + "download_count": 1345015, + "project": "pyshp" + }, + { + "download_count": 1340081, + "project": "cerberus-python-client" + }, + { + "download_count": 1339531, + "project": "pytest-ordering" + }, + { + "download_count": 1337974, + "project": "dateutils" + }, + { + "download_count": 1337690, + "project": "ccy" + }, + { + "download_count": 1336766, + "project": "ec2-metadata" + }, + { + "download_count": 1336028, + "project": "gevent-websocket" + }, + { + "download_count": 1333439, + "project": "pyenchant" + }, + { + "download_count": 1333043, + "project": "pykwalify" + }, + { + "download_count": 1331164, + "project": "ptable" + }, + { + "download_count": 1324399, + "project": "dash-html-components" + }, + { + "download_count": 1323369, + "project": "wmctrl" + }, + { + "download_count": 1322854, + "project": "markdown2" + }, + { + "download_count": 1320709, + "project": "fancycompleter" + }, + { + "download_count": 1320502, + "project": "genson" + }, + { + "download_count": 1317756, + "project": "pyhocon" + }, + { + "download_count": 1317236, + "project": "pdbpp" + }, + { + "download_count": 1316522, + "project": "crc16" + }, + { + "download_count": 1310312, + "project": "gnupg" + }, + { + "download_count": 1306934, + "project": "palettable" + }, + { + "download_count": 1306842, + "project": "fake-factory" + }, + { + "download_count": 1302234, + "project": "bson" + }, + { + "download_count": 1293536, + "project": "jsonpath-rw-ext" + }, + { + "download_count": 1291830, + "project": "graphene-django" + }, + { + "download_count": 1288532, + "project": "elasticsearch-curator" + }, + { + "download_count": 1287159, + "project": "agate" + }, + { + "download_count": 1286419, + "project": "pyluach" + }, + { + "download_count": 1276264, + "project": "pytoml" + }, + { + "download_count": 1275859, + "project": "xhtml2pdf" + }, + { + "download_count": 1275165, + "project": "mandrill" + }, + { + "download_count": 1274724, + "project": "aws-sam-cli" + }, + { + "download_count": 1274476, + "project": "aws-lambda-builders" + }, + { + "download_count": 1274226, + "project": "algoliasearch" + }, + { + "download_count": 1273921, + "project": "hupper" + }, + { + "download_count": 1261688, + "project": "testscenarios" + }, + { + "download_count": 1259972, + "project": "cufflinks" + }, + { + "download_count": 1258105, + "project": "signalfx" + }, + { + "download_count": 1257144, + "project": "moviepy" + }, + { + "download_count": 1255798, + "project": "objgraph" + }, + { + "download_count": 1252062, + "project": "chevron" + }, + { + "download_count": 1235194, + "project": "pdf2image" + }, + { + "download_count": 1234160, + "project": "uvicorn" + }, + { + "download_count": 1233486, + "project": "tlslite" + }, + { + "download_count": 1231831, + "project": "pybase64" + }, + { + "download_count": 1230654, + "project": "createsend" + }, + { + "download_count": 1230170, + "project": "gql" + }, + { + "download_count": 1230039, + "project": "imagehash" + }, + { + "download_count": 1228048, + "project": "azureml-defaults" + }, + { + "download_count": 1227477, + "project": "azure-mgmt-imagebuilder" + }, + { + "download_count": 1226165, + "project": "serverlessrepo" + }, + { + "download_count": 1221206, + "project": "pytest-watch" + }, + { + "download_count": 1220741, + "project": "google-cloud-bigquery-storage" + }, + { + "download_count": 1218278, + "project": "django-ses" + }, + { + "download_count": 1217113, + "project": "luminol" + }, + { + "download_count": 1213653, + "project": "pyaes" + }, + { + "download_count": 1213392, + "project": "flask-mongoalchemy" + }, + { + "download_count": 1212483, + "project": "flake8-print" + }, + { + "download_count": 1208573, + "project": "resource" + }, + { + "download_count": 1207795, + "project": "stemming" + }, + { + "download_count": 1206452, + "project": "python-easyconfig" + }, + { + "download_count": 1206109, + "project": "jsonform" + }, + { + "download_count": 1205968, + "project": "jsonsir" + }, + { + "download_count": 1202856, + "project": "logbook" + }, + { + "download_count": 1198077, + "project": "import-from-github-com" + }, + { + "download_count": 1195471, + "project": "mss" + }, + { + "download_count": 1195405, + "project": "robotframework-requests" + }, + { + "download_count": 1194828, + "project": "nose2" + }, + { + "download_count": 1194314, + "project": "fusepy" + }, + { + "download_count": 1193288, + "project": "cmake" + }, + { + "download_count": 1192641, + "project": "httpbin" + }, + { + "download_count": 1190084, + "project": "graphql-server-core" + }, + { + "download_count": 1189375, + "project": "stestr" + }, + { + "download_count": 1188229, + "project": "recordclass" + }, + { + "download_count": 1186101, + "project": "django-bootstrap4" + }, + { + "download_count": 1181472, + "project": "tree-format" + }, + { + "download_count": 1180564, + "project": "django-guardian" + }, + { + "download_count": 1180286, + "project": "django-celery" + }, + { + "download_count": 1179046, + "project": "publicsuffix" + }, + { + "download_count": 1178235, + "project": "astropy" + }, + { + "download_count": 1177835, + "project": "konlpy" + }, + { + "download_count": 1174516, + "project": "threadloop" + }, + { + "download_count": 1174367, + "project": "radon" + }, + { + "download_count": 1172767, + "project": "azure-cli-profile" + }, + { + "download_count": 1172663, + "project": "jieba" + }, + { + "download_count": 1172300, + "project": "pyfakefs" + }, + { + "download_count": 1172278, + "project": "namedlist" + }, + { + "download_count": 1171988, + "project": "pubnub" + }, + { + "download_count": 1170778, + "project": "flasgger" + }, + { + "download_count": 1168270, + "project": "pymeeus" + }, + { + "download_count": 1164230, + "project": "transitions" + }, + { + "download_count": 1163775, + "project": "visitor" + }, + { + "download_count": 1161777, + "project": "django-redis-cache" + }, + { + "download_count": 1161264, + "project": "lmdb" + }, + { + "download_count": 1160572, + "project": "json-logging-py" + }, + { + "download_count": 1159436, + "project": "protobuf3-to-dict" + }, + { + "download_count": 1153262, + "project": "patch" + }, + { + "download_count": 1152875, + "project": "horovod" + }, + { + "download_count": 1152461, + "project": "pyzabbix" + }, + { + "download_count": 1148339, + "project": "tailer" + }, + { + "download_count": 1146680, + "project": "azure-cli-resource" + }, + { + "download_count": 1145300, + "project": "etcd3" + }, + { + "download_count": 1143148, + "project": "azure-cli-iot" + }, + { + "download_count": 1143069, + "project": "djangorestframework-xml" + }, + { + "download_count": 1139676, + "project": "logutils" + }, + { + "download_count": 1138222, + "project": "javaproperties" + }, + { + "download_count": 1137231, + "project": "azure-cli-extension" + }, + { + "download_count": 1137033, + "project": "python-telegram-bot" + }, + { + "download_count": 1135140, + "project": "platformio" + }, + { + "download_count": 1134846, + "project": "xvfbwrapper" + }, + { + "download_count": 1133241, + "project": "pytest-pythonpath" + }, + { + "download_count": 1129508, + "project": "google-cloud-iam" + }, + { + "download_count": 1129177, + "project": "pydrive" + }, + { + "download_count": 1128895, + "project": "minio" + }, + { + "download_count": 1128310, + "project": "python-heatclient" + }, + { + "download_count": 1127447, + "project": "azure-cli-dls" + }, + { + "download_count": 1127383, + "project": "demjson" + }, + { + "download_count": 1126928, + "project": "pygal" + }, + { + "download_count": 1123556, + "project": "azure-cli-role" + }, + { + "download_count": 1123087, + "project": "azure-cli-monitor" + }, + { + "download_count": 1121560, + "project": "azure-cli-storage" + }, + { + "download_count": 1121500, + "project": "azure-cli-sql" + }, + { + "download_count": 1121354, + "project": "azure-cli-keyvault" + }, + { + "download_count": 1121021, + "project": "azure-cli-network" + }, + { + "download_count": 1120955, + "project": "azure-cli-interactive" + }, + { + "download_count": 1120732, + "project": "azure-cli-container" + }, + { + "download_count": 1120661, + "project": "azure-cli-appservice" + }, + { + "download_count": 1120619, + "project": "azure-cli-lab" + }, + { + "download_count": 1120596, + "project": "pydub" + }, + { + "download_count": 1120448, + "project": "azure-cli-acr" + }, + { + "download_count": 1120440, + "project": "pem" + }, + { + "download_count": 1119943, + "project": "azure-cli-acs" + }, + { + "download_count": 1119731, + "project": "azure-cli-cognitiveservices" + }, + { + "download_count": 1118667, + "project": "azure-cli-batch" + }, + { + "download_count": 1118554, + "project": "azure-cli-rdbms" + }, + { + "download_count": 1118179, + "project": "dumbyaml" + }, + { + "download_count": 1118164, + "project": "azure-cli-cosmosdb" + }, + { + "download_count": 1117990, + "project": "azure-cli-dla" + }, + { + "download_count": 1117671, + "project": "azure-cli-vm" + }, + { + "download_count": 1117663, + "project": "graphite-web" + }, + { + "download_count": 1117633, + "project": "easy-thumbnails" + }, + { + "download_count": 1117629, + "project": "ggplot" + }, + { + "download_count": 1117326, + "project": "ncclient" + }, + { + "download_count": 1115734, + "project": "azure-cli-cdn" + }, + { + "download_count": 1115095, + "project": "ipyparallel" + }, + { + "download_count": 1114052, + "project": "uritemplate-py" + }, + { + "download_count": 1113849, + "project": "azure-cli-servicefabric" + }, + { + "download_count": 1112830, + "project": "azure-cli-batchai" + }, + { + "download_count": 1112111, + "project": "colander" + }, + { + "download_count": 1112004, + "project": "libhoney" + }, + { + "download_count": 1111031, + "project": "robotframework-selenium2library" + }, + { + "download_count": 1110924, + "project": "azure-cli-reservations" + }, + { + "download_count": 1110554, + "project": "selectors34" + }, + { + "download_count": 1109781, + "project": "python-redis-lock" + }, + { + "download_count": 1109474, + "project": "django-waffle" + }, + { + "download_count": 1109341, + "project": "construct" + }, + { + "download_count": 1107612, + "project": "pyhcl" + }, + { + "download_count": 1107023, + "project": "allure-python-commons" + }, + { + "download_count": 1106855, + "project": "opencv-python-headless" + }, + { + "download_count": 1104732, + "project": "nibabel" + }, + { + "download_count": 1104394, + "project": "ntplib" + }, + { + "download_count": 1101855, + "project": "gsutil" + }, + { + "download_count": 1099271, + "project": "python-redis" + }, + { + "download_count": 1099171, + "project": "honeycomb-beeline" + }, + { + "download_count": 1095266, + "project": "google-cloud-profiler" + }, + { + "download_count": 1094548, + "project": "djangorestframework-csv" + }, + { + "download_count": 1093507, + "project": "imageio-ffmpeg" + }, + { + "download_count": 1093006, + "project": "rpyc" + }, + { + "download_count": 1092127, + "project": "databricks-api" + }, + { + "download_count": 1091012, + "project": "django-otp" + }, + { + "download_count": 1089786, + "project": "atlassian-jwt-auth" + }, + { + "download_count": 1089668, + "project": "pyscreeze" + }, + { + "download_count": 1088119, + "project": "jsonlines" + }, + { + "download_count": 1087785, + "project": "google-cloud-scheduler" + }, + { + "download_count": 1086837, + "project": "py-moneyed" + }, + { + "download_count": 1086168, + "project": "prospector" + }, + { + "download_count": 1084845, + "project": "pyfcm" + }, + { + "download_count": 1084588, + "project": "leather" + }, + { + "download_count": 1083842, + "project": "flask-session" + }, + { + "download_count": 1083772, + "project": "flask-principal" + }, + { + "download_count": 1081797, + "project": "azure-mgmt-managedservices" + }, + { + "download_count": 1080061, + "project": "zope-sqlalchemy" + }, + { + "download_count": 1079118, + "project": "wikipedia" + }, + { + "download_count": 1078680, + "project": "pyopengl" + }, + { + "download_count": 1077281, + "project": "django-anymail" + }, + { + "download_count": 1075981, + "project": "cov-core" + }, + { + "download_count": 1075897, + "project": "azure-mgmt-netapp" + }, + { + "download_count": 1074798, + "project": "pytest-flake8" + }, + { + "download_count": 1071887, + "project": "requests-cache" + }, + { + "download_count": 1071617, + "project": "plaster-pastedeploy" + }, + { + "download_count": 1071057, + "project": "boxsdk" + }, + { + "download_count": 1070181, + "project": "numpydoc" + }, + { + "download_count": 1069130, + "project": "dodgy" + }, + { + "download_count": 1067802, + "project": "sphinxcontrib-httpdomain" + }, + { + "download_count": 1067667, + "project": "git-url-parse" + }, + { + "download_count": 1065839, + "project": "restructuredtext-lint" + }, + { + "download_count": 1063327, + "project": "django-storages-redux" + }, + { + "download_count": 1061635, + "project": "h2o-pysparkling-2-4" + }, + { + "download_count": 1060942, + "project": "flatbuffers" + }, + { + "download_count": 1059650, + "project": "webassets" + }, + { + "download_count": 1057175, + "project": "gdata" + }, + { + "download_count": 1055836, + "project": "pytest-pep8" + }, + { + "download_count": 1054787, + "project": "setoptconf" + }, + { + "download_count": 1053777, + "project": "flask-graphql" + }, + { + "download_count": 1051978, + "project": "lark-parser" + }, + { + "download_count": 1046552, + "project": "google-cloud-datacatalog" + }, + { + "download_count": 1045356, + "project": "requirements-detector" + }, + { + "download_count": 1043870, + "project": "google-cloud-talent" + }, + { + "download_count": 1043546, + "project": "utils" + }, + { + "download_count": 1043075, + "project": "google-cloud-datalabeling" + }, + { + "download_count": 1042791, + "project": "django-mailgun" + }, + { + "download_count": 1041833, + "project": "google-cloud-os-login" + }, + { + "download_count": 1040789, + "project": "plaster" + }, + { + "download_count": 1040645, + "project": "google-cloud-webrisk" + }, + { + "download_count": 1040329, + "project": "beaker" + }, + { + "download_count": 1039677, + "project": "django-fsm" + }, + { + "download_count": 1039618, + "project": "grpcio-health-checking" + }, + { + "download_count": 1039569, + "project": "flask-apispec" + }, + { + "download_count": 1037586, + "project": "flake8-comprehensions" + }, + { + "download_count": 1036471, + "project": "pylint-flask" + }, + { + "download_count": 1036185, + "project": "pygerduty" + }, + { + "download_count": 1036096, + "project": "pudb" + }, + { + "download_count": 1036044, + "project": "biopython" + }, + { + "download_count": 1035148, + "project": "brewer2mpl" + }, + { + "download_count": 1034346, + "project": "rpy2" + }, + { + "download_count": 1033958, + "project": "dash-table" + }, + { + "download_count": 1033827, + "project": "base58" + }, + { + "download_count": 1033818, + "project": "proto-google-cloud-pubsub-v1" + }, + { + "download_count": 1033419, + "project": "maxminddb-geolite2" + }, + { + "download_count": 1032216, + "project": "bravado-core" + }, + { + "download_count": 1031978, + "project": "starlette" + }, + { + "download_count": 1031797, + "project": "cftime" + }, + { + "download_count": 1030527, + "project": "papermill" + }, + { + "download_count": 1030356, + "project": "pytest-aiohttp" + }, + { + "download_count": 1028784, + "project": "neotime" + }, + { + "download_count": 1028024, + "project": "django-grappelli" + }, + { + "download_count": 1026556, + "project": "csvkit" + }, + { + "download_count": 1026453, + "project": "azure-mgmt-appconfiguration" + }, + { + "download_count": 1025532, + "project": "mando" + }, + { + "download_count": 1025061, + "project": "python-pptx" + }, + { + "download_count": 1024849, + "project": "futurist" + }, + { + "download_count": 1024564, + "project": "tfx" + }, + { + "download_count": 1023148, + "project": "shyaml" + }, + { + "download_count": 1020560, + "project": "whoosh" + }, + { + "download_count": 1019249, + "project": "netcdf4" + }, + { + "download_count": 1018441, + "project": "braintree" + }, + { + "download_count": 1017498, + "project": "pylint-celery" + }, + { + "download_count": 1015935, + "project": "pyautogui" + }, + { + "download_count": 1015329, + "project": "uritools" + }, + { + "download_count": 1014941, + "project": "openshift" + }, + { + "download_count": 1014682, + "project": "jinjasql" + }, + { + "download_count": 1011470, + "project": "bunch" + }, + { + "download_count": 1011345, + "project": "tribool" + }, + { + "download_count": 1010041, + "project": "shade" + }, + { + "download_count": 1009923, + "project": "geoalchemy2" + }, + { + "download_count": 1007914, + "project": "stups-tokens" + }, + { + "download_count": 1007728, + "project": "django-health-check" + }, + { + "download_count": 1006511, + "project": "ansiwrap" + }, + { + "download_count": 1005973, + "project": "djangorestframework-simplejwt" + }, + { + "download_count": 1004447, + "project": "repoze-who" + }, + { + "download_count": 1003341, + "project": "u-msgpack-python" + }, + { + "download_count": 1002884, + "project": "psycogreen" + }, + { + "download_count": 1002180, + "project": "pyroute2" + }, + { + "download_count": 997107, + "project": "impyla" + }, + { + "download_count": 997057, + "project": "functools" + }, + { + "download_count": 995470, + "project": "rq-scheduler" + }, + { + "download_count": 995174, + "project": "xarray" + }, + { + "download_count": 995018, + "project": "dictionaries" + }, + { + "download_count": 995017, + "project": "django-haystack" + }, + { + "download_count": 992160, + "project": "check-manifest" + }, + { + "download_count": 990507, + "project": "python-rapidjson" + }, + { + "download_count": 989611, + "project": "py-vapid" + }, + { + "download_count": 989525, + "project": "textwrap3" + }, + { + "download_count": 988451, + "project": "soundfile" + }, + { + "download_count": 987924, + "project": "python-string-utils" + }, + { + "download_count": 987136, + "project": "pywinauto" + }, + { + "download_count": 985267, + "project": "oslo-db" + }, + { + "download_count": 984514, + "project": "xmlrunner" + }, + { + "download_count": 983293, + "project": "pymdown-extensions" + }, + { + "download_count": 982272, + "project": "sphinx-autobuild" + }, + { + "download_count": 981717, + "project": "django-ckeditor" + }, + { + "download_count": 979521, + "project": "sorl-thumbnail" + }, + { + "download_count": 979220, + "project": "pysmb" + }, + { + "download_count": 978290, + "project": "pymsgbox" + }, + { + "download_count": 977363, + "project": "gapic-google-cloud-pubsub-v1" + }, + { + "download_count": 977316, + "project": "flake8-isort" + }, + { + "download_count": 976939, + "project": "tensorflow-probability" + }, + { + "download_count": 976069, + "project": "oslo-messaging" + }, + { + "download_count": 975772, + "project": "python-coveralls" + }, + { + "download_count": 975418, + "project": "flex" + }, + { + "download_count": 973597, + "project": "seleniumbase" + }, + { + "download_count": 972851, + "project": "flake8-commas" + }, + { + "download_count": 972025, + "project": "dirq" + }, + { + "download_count": 971725, + "project": "glfw" + }, + { + "download_count": 968128, + "project": "trains" + }, + { + "download_count": 967325, + "project": "hjson" + }, + { + "download_count": 966886, + "project": "fs" + }, + { + "download_count": 965395, + "project": "pyahocorasick" + }, + { + "download_count": 965068, + "project": "pytest-repeat" + }, + { + "download_count": 964628, + "project": "swagger-ui-bundle" + }, + { + "download_count": 964597, + "project": "typing-inspect" + }, + { + "download_count": 964448, + "project": "sagemaker" + }, + { + "download_count": 964057, + "project": "vobject" + }, + { + "download_count": 963489, + "project": "dbfread" + }, + { + "download_count": 962456, + "project": "bidict" + }, + { + "download_count": 960677, + "project": "google-python-cloud-debugger" + }, + { + "download_count": 958036, + "project": "cognite-sdk" + }, + { + "download_count": 957690, + "project": "vulture" + }, + { + "download_count": 957559, + "project": "pytweening" + }, + { + "download_count": 954913, + "project": "circleci" + }, + { + "download_count": 954734, + "project": "onnxmltools" + }, + { + "download_count": 953896, + "project": "django-jsonfield" + }, + { + "download_count": 952673, + "project": "skl2onnx" + }, + { + "download_count": 951906, + "project": "azure-cli-configure" + }, + { + "download_count": 951530, + "project": "readerwriterlock" + }, + { + "download_count": 951124, + "project": "django-silk" + }, + { + "download_count": 948790, + "project": "json-log-formatter" + }, + { + "download_count": 948696, + "project": "stups-zign" + }, + { + "download_count": 948084, + "project": "commentjson" + }, + { + "download_count": 947759, + "project": "opentracing-instrumentation" + }, + { + "download_count": 947140, + "project": "hurry-filesize" + }, + { + "download_count": 946596, + "project": "httpie" + }, + { + "download_count": 945434, + "project": "comtypes" + }, + { + "download_count": 944648, + "project": "azure-cli-cloud" + }, + { + "download_count": 942122, + "project": "stups-cli-support" + }, + { + "download_count": 941812, + "project": "textfsm" + }, + { + "download_count": 941227, + "project": "django-bulk-update" + }, + { + "download_count": 940485, + "project": "pydotplus" + }, + { + "download_count": 939994, + "project": "logilab-common" + }, + { + "download_count": 939219, + "project": "thriftpy2" + }, + { + "download_count": 937977, + "project": "pyldap" + }, + { + "download_count": 937103, + "project": "progressbar" + }, + { + "download_count": 936822, + "project": "limits" + }, + { + "download_count": 935302, + "project": "empy" + }, + { + "download_count": 933336, + "project": "interval" + }, + { + "download_count": 933102, + "project": "twitter-common-lang" + }, + { + "download_count": 932594, + "project": "sanic" + }, + { + "download_count": 932344, + "project": "twitter-common-dirutil" + }, + { + "download_count": 931618, + "project": "uhashring" + }, + { + "download_count": 929734, + "project": "asana" + }, + { + "download_count": 926851, + "project": "base64io" + }, + { + "download_count": 925789, + "project": "django-user-agents" + }, + { + "download_count": 924447, + "project": "reno" + }, + { + "download_count": 923715, + "project": "netmiko" + }, + { + "download_count": 923299, + "project": "twitter-common-options" + }, + { + "download_count": 923153, + "project": "twitter-common-log" + }, + { + "download_count": 923141, + "project": "parsley" + }, + { + "download_count": 921602, + "project": "azure-cli-find" + }, + { + "download_count": 920951, + "project": "azure-cli-redis" + }, + { + "download_count": 920654, + "project": "aws-encryption-sdk-cli" + }, + { + "download_count": 920109, + "project": "stop-words" + }, + { + "download_count": 919963, + "project": "azure-cli-consumption" + }, + { + "download_count": 919735, + "project": "pydevd" + }, + { + "download_count": 919608, + "project": "azure-cli-billing" + }, + { + "download_count": 919364, + "project": "azure-cli-feedback" + }, + { + "download_count": 919204, + "project": "click-log" + }, + { + "download_count": 916168, + "project": "pypd" + }, + { + "download_count": 914683, + "project": "azure-cli-advisor" + }, + { + "download_count": 914682, + "project": "neobolt" + }, + { + "download_count": 911537, + "project": "azure-cli-eventgrid" + }, + { + "download_count": 911471, + "project": "annoy" + }, + { + "download_count": 910544, + "project": "scramp" + }, + { + "download_count": 910046, + "project": "azure-cli-backup" + }, + { + "download_count": 908651, + "project": "flask-assets" + }, + { + "download_count": 908244, + "project": "oslo-service" + }, + { + "download_count": 905587, + "project": "flask-bootstrap" + }, + { + "download_count": 903282, + "project": "proglog" + }, + { + "download_count": 903200, + "project": "keras2onnx" + }, + { + "download_count": 902334, + "project": "plyvel" + }, + { + "download_count": 900779, + "project": "pybluez" + }, + { + "download_count": 899502, + "project": "pyudev" + }, + { + "download_count": 899012, + "project": "testrepository" + }, + { + "download_count": 898793, + "project": "oslo-policy" + }, + { + "download_count": 897914, + "project": "pmdarima" + }, + { + "download_count": 897653, + "project": "django-autocomplete-light" + }, + { + "download_count": 895791, + "project": "artifactory" + }, + { + "download_count": 895766, + "project": "pytest-variables" + }, + { + "download_count": 895437, + "project": "azure-cli-eventhubs" + }, + { + "download_count": 895142, + "project": "twitter-common-collections" + }, + { + "download_count": 894979, + "project": "azure-cli-servicebus" + }, + { + "download_count": 894815, + "project": "testresources" + }, + { + "download_count": 894191, + "project": "pybs" + }, + { + "download_count": 893842, + "project": "azure-cli-dms" + }, + { + "download_count": 893592, + "project": "channels-redis" + }, + { + "download_count": 893412, + "project": "junitparser" + }, + { + "download_count": 891540, + "project": "tifffile" + }, + { + "download_count": 891533, + "project": "easydict" + }, + { + "download_count": 891481, + "project": "json2parquet" + }, + { + "download_count": 891341, + "project": "pyicu" + }, + { + "download_count": 888690, + "project": "azure-cli-ams" + }, + { + "download_count": 886402, + "project": "pyeapi" + }, + { + "download_count": 885171, + "project": "python-gilt" + }, + { + "download_count": 884033, + "project": "azure-cli-search" + }, + { + "download_count": 882989, + "project": "jupyter-nbextensions-configurator" + }, + { + "download_count": 881790, + "project": "monthdelta" + }, + { + "download_count": 880765, + "project": "pynput" + }, + { + "download_count": 880406, + "project": "pyfiglet" + }, + { + "download_count": 878563, + "project": "jsonnet" + }, + { + "download_count": 874987, + "project": "pvlib" + }, + { + "download_count": 874000, + "project": "jupyter-contrib-core" + }, + { + "download_count": 872790, + "project": "mockito" + }, + { + "download_count": 872554, + "project": "nosexcover" + }, + { + "download_count": 872485, + "project": "peakutils" + }, + { + "download_count": 872331, + "project": "rednose" + }, + { + "download_count": 872127, + "project": "ansicolors" + }, + { + "download_count": 871498, + "project": "j2cli" + }, + { + "download_count": 868629, + "project": "awsiotpythonsdk" + }, + { + "download_count": 867297, + "project": "pywfm" + }, + { + "download_count": 866741, + "project": "lml" + }, + { + "download_count": 865346, + "project": "imblearn" + }, + { + "download_count": 863870, + "project": "openstackdocstheme" + }, + { + "download_count": 863120, + "project": "jupyter-contrib-nbextensions" + }, + { + "download_count": 860421, + "project": "molecule" + }, + { + "download_count": 858716, + "project": "zstandard" + }, + { + "download_count": 858408, + "project": "pyqrcode" + }, + { + "download_count": 856466, + "project": "line-profiler" + }, + { + "download_count": 856334, + "project": "flask-api" + }, + { + "download_count": 856299, + "project": "honcho" + }, + { + "download_count": 856226, + "project": "jplephem" + }, + { + "download_count": 855767, + "project": "rpqueue" + }, + { + "download_count": 854839, + "project": "autoflake" + }, + { + "download_count": 854260, + "project": "azure-mgmt-apimanagement" + }, + { + "download_count": 854182, + "project": "cognite-model-hosting" + }, + { + "download_count": 852933, + "project": "pytest-dependency" + }, + { + "download_count": 852580, + "project": "pytest-pylint" + }, + { + "download_count": 852418, + "project": "deepmerge" + }, + { + "download_count": 850683, + "project": "jupyter-latex-envs" + }, + { + "download_count": 849484, + "project": "polyline" + }, + { + "download_count": 849092, + "project": "yappi" + }, + { + "download_count": 849002, + "project": "logmatic-python" + }, + { + "download_count": 848508, + "project": "sgp4" + }, + { + "download_count": 848205, + "project": "onnxconverter-common" + }, + { + "download_count": 847724, + "project": "django-pipeline" + }, + { + "download_count": 847508, + "project": "envs" + }, + { + "download_count": 847487, + "project": "jupyter-highlight-selected-word" + }, + { + "download_count": 846088, + "project": "googletrans" + }, + { + "download_count": 845652, + "project": "mkdocs-material" + }, + { + "download_count": 845331, + "project": "django-bootstrap3" + }, + { + "download_count": 843583, + "project": "isoweek" + }, + { + "download_count": 843510, + "project": "image" + }, + { + "download_count": 842232, + "project": "solartime" + }, + { + "download_count": 841714, + "project": "flask-debugtoolbar" + }, + { + "download_count": 840214, + "project": "rasterio" + }, + { + "download_count": 839139, + "project": "diamond" + }, + { + "download_count": 837673, + "project": "mailchimp3" + }, + { + "download_count": 835610, + "project": "oslo-middleware" + }, + { + "download_count": 835257, + "project": "mutagen" + }, + { + "download_count": 834695, + "project": "catalogue" + }, + { + "download_count": 834133, + "project": "faulthandler" + }, + { + "download_count": 832671, + "project": "sacrebleu" + }, + { + "download_count": 832545, + "project": "python-jose-cryptodome" + }, + { + "download_count": 831517, + "project": "zeroconf" + }, + { + "download_count": 830534, + "project": "jinja2-pluralize" + }, + { + "download_count": 829948, + "project": "suds-py3" + }, + { + "download_count": 829228, + "project": "pandasql" + }, + { + "download_count": 828892, + "project": "logstash-formatter" + }, + { + "download_count": 828549, + "project": "lifelines" + }, + { + "download_count": 827727, + "project": "liac-arff" + }, + { + "download_count": 827554, + "project": "diff-cover" + }, + { + "download_count": 826205, + "project": "elastic-apm" + }, + { + "download_count": 826135, + "project": "django-coverage-plugin" + }, + { + "download_count": 825300, + "project": "skyfield" + }, + { + "download_count": 824924, + "project": "drf-extensions" + }, + { + "download_count": 823613, + "project": "databricks-pypi-extras" + }, + { + "download_count": 823180, + "project": "azure-cli-relay" + }, + { + "download_count": 822954, + "project": "azure-cli-iotcentral" + }, + { + "download_count": 822898, + "project": "azure-cli-hdinsight" + }, + { + "download_count": 822664, + "project": "azure-cli-maps" + }, + { + "download_count": 822562, + "project": "azure-cli-botservice" + }, + { + "download_count": 822180, + "project": "azure-cli-signalr" + }, + { + "download_count": 822129, + "project": "lime" + }, + { + "download_count": 821534, + "project": "transifex-client" + }, + { + "download_count": 820293, + "project": "azure-cli-policyinsights" + }, + { + "download_count": 819714, + "project": "django-classy-tags" + }, + { + "download_count": 818561, + "project": "clickhouse-driver" + }, + { + "download_count": 815459, + "project": "scrapy-splash" + }, + { + "download_count": 815166, + "project": "pybrake" + }, + { + "download_count": 814136, + "project": "carbon" + }, + { + "download_count": 813628, + "project": "wmi" + }, + { + "download_count": 810452, + "project": "python-ironicclient" + }, + { + "download_count": 808082, + "project": "pusher" + }, + { + "download_count": 806951, + "project": "datadiff" + }, + { + "download_count": 806876, + "project": "js2py" + }, + { + "download_count": 805430, + "project": "urlobject" + }, + { + "download_count": 804845, + "project": "tinydb" + }, + { + "download_count": 804621, + "project": "pytest-randomly" + }, + { + "download_count": 804371, + "project": "placebo" + }, + { + "download_count": 804270, + "project": "progress" + }, + { + "download_count": 804201, + "project": "nimbusml" + }, + { + "download_count": 803677, + "project": "ffmpeg-python" + }, + { + "download_count": 803390, + "project": "pandas-profiling" + }, + { + "download_count": 803033, + "project": "pyspark-flame" + }, + { + "download_count": 802518, + "project": "nose-xunitmp" + }, + { + "download_count": 801270, + "project": "ftputil" + }, + { + "download_count": 800466, + "project": "pyexcel-io" + }, + { + "download_count": 800452, + "project": "pysam" + }, + { + "download_count": 800033, + "project": "oslo-cache" + }, + { + "download_count": 799400, + "project": "jinja2schema" + }, + { + "download_count": 797811, + "project": "skyfield-data" + }, + { + "download_count": 797080, + "project": "bashate" + }, + { + "download_count": 796778, + "project": "pytest-base-url" + }, + { + "download_count": 795722, + "project": "mpld3" + }, + { + "download_count": 795138, + "project": "pytest-selenium" + }, + { + "download_count": 794945, + "project": "facebookads" + }, + { + "download_count": 792726, + "project": "testing-common-database" + }, + { + "download_count": 792699, + "project": "requests-unixsocket" + }, + { + "download_count": 791454, + "project": "ansible-tower-cli" + }, + { + "download_count": 790178, + "project": "dlib" + }, + { + "download_count": 788016, + "project": "web3" + }, + { + "download_count": 787379, + "project": "pygresql" + }, + { + "download_count": 786501, + "project": "update-checker" + }, + { + "download_count": 784385, + "project": "pygetwindow" + }, + { + "download_count": 783264, + "project": "allure-pytest" + }, + { + "download_count": 782719, + "project": "pycontracts" + }, + { + "download_count": 782492, + "project": "wsgi-request-logger" + }, + { + "download_count": 780141, + "project": "m2crypto" + }, + { + "download_count": 779854, + "project": "scrapyd" + }, + { + "download_count": 779681, + "project": "centrosome" + }, + { + "download_count": 779517, + "project": "flask-mongoengine" + }, + { + "download_count": 778027, + "project": "dataclasses-json" + }, + { + "download_count": 777762, + "project": "splinter" + }, + { + "download_count": 777345, + "project": "htmlparser" + }, + { + "download_count": 775376, + "project": "loguru" + }, + { + "download_count": 774793, + "project": "dumb-init" + }, + { + "download_count": 774504, + "project": "python-designateclient" + }, + { + "download_count": 774495, + "project": "speaklater" + }, + { + "download_count": 773679, + "project": "eth-utils" + }, + { + "download_count": 772719, + "project": "spark-df-profiling" + }, + { + "download_count": 772355, + "project": "javabridge" + }, + { + "download_count": 771179, + "project": "us" + }, + { + "download_count": 769552, + "project": "xdg" + }, + { + "download_count": 769306, + "project": "librabbitmq" + }, + { + "download_count": 769240, + "project": "lepl" + }, + { + "download_count": 769163, + "project": "pysolr" + }, + { + "download_count": 768526, + "project": "google-cloud-happybase" + }, + { + "download_count": 768426, + "project": "graphene-sqlalchemy" + }, + { + "download_count": 768057, + "project": "google-endpoints-api-management" + }, + { + "download_count": 767991, + "project": "affine" + }, + { + "download_count": 767570, + "project": "colour" + }, + { + "download_count": 764562, + "project": "django-constance" + }, + { + "download_count": 762359, + "project": "infinity" + }, + { + "download_count": 761920, + "project": "djangorestframework-filters" + }, + { + "download_count": 760164, + "project": "robotremoteserver" + }, + { + "download_count": 759992, + "project": "keystonemiddleware" + }, + { + "download_count": 758677, + "project": "distribute" + }, + { + "download_count": 757044, + "project": "hyper" + }, + { + "download_count": 755707, + "project": "pyscreenshot" + }, + { + "download_count": 755554, + "project": "google-endpoints" + }, + { + "download_count": 754592, + "project": "intervals" + }, + { + "download_count": 754564, + "project": "pysal" + }, + { + "download_count": 754317, + "project": "svgwrite" + }, + { + "download_count": 753732, + "project": "cognite-logger" + }, + { + "download_count": 753586, + "project": "pytest-spark" + }, + { + "download_count": 753503, + "project": "nose-parallel" + }, + { + "download_count": 753048, + "project": "dynaconf" + }, + { + "download_count": 752651, + "project": "mahotas" + }, + { + "download_count": 751112, + "project": "databricks-pypi" + }, + { + "download_count": 749141, + "project": "mysql" + }, + { + "download_count": 749102, + "project": "flake8-builtins" + }, + { + "download_count": 748778, + "project": "humpty" + }, + { + "download_count": 748490, + "project": "pyspark-dist-explore" + }, + { + "download_count": 746836, + "project": "django-annoying" + }, + { + "download_count": 746781, + "project": "tinyrpc" + }, + { + "download_count": 746415, + "project": "wincertstore" + }, + { + "download_count": 745591, + "project": "django-axes" + }, + { + "download_count": 742692, + "project": "aerospike" + }, + { + "download_count": 739560, + "project": "pycadf" + }, + { + "download_count": 739333, + "project": "django-csp" + }, + { + "download_count": 737212, + "project": "django-compat" + }, + { + "download_count": 735567, + "project": "azure-cli-security" + }, + { + "download_count": 735347, + "project": "asyncssh" + }, + { + "download_count": 734370, + "project": "robotframework-sshlibrary" + }, + { + "download_count": 734265, + "project": "concurrentloghandler" + }, + { + "download_count": 734033, + "project": "django-object-actions" + }, + { + "download_count": 733362, + "project": "azure-cli-kusto" + }, + { + "download_count": 733347, + "project": "tensorflowonspark" + }, + { + "download_count": 732849, + "project": "aioresponses" + }, + { + "download_count": 731576, + "project": "jenkins-job-builder" + }, + { + "download_count": 731088, + "project": "bravado" + }, + { + "download_count": 728665, + "project": "prometheus-flask-exporter" + }, + { + "download_count": 727540, + "project": "pprint" + }, + { + "download_count": 726931, + "project": "jaeger-client" + }, + { + "download_count": 726893, + "project": "nose-parameterized" + }, + { + "download_count": 726613, + "project": "pyrect" + }, + { + "download_count": 726590, + "project": "htcondor" + }, + { + "download_count": 723307, + "project": "pip-licenses" + }, + { + "download_count": 723172, + "project": "mlxtend" + }, + { + "download_count": 721353, + "project": "py2-ipaddress" + }, + { + "download_count": 719973, + "project": "osprofiler" + }, + { + "download_count": 719532, + "project": "pandas-datareader" + }, + { + "download_count": 718534, + "project": "ngram" + }, + { + "download_count": 718362, + "project": "h2o" + }, + { + "download_count": 717198, + "project": "homeassistant" + }, + { + "download_count": 716605, + "project": "pytest-mypy" + }, + { + "download_count": 716398, + "project": "eth-typing" + }, + { + "download_count": 716263, + "project": "django-auth-ldap" + }, + { + "download_count": 714558, + "project": "jsonmerge" + }, + { + "download_count": 714088, + "project": "django-cacheops" + }, + { + "download_count": 713825, + "project": "python-bioformats" + }, + { + "download_count": 713644, + "project": "stomp-py" + }, + { + "download_count": 713346, + "project": "scrypt" + }, + { + "download_count": 710233, + "project": "prokaryote" + }, + { + "download_count": 709352, + "project": "testing-postgresql" + }, + { + "download_count": 708670, + "project": "azure-cli-sqlvm" + }, + { + "download_count": 708401, + "project": "shrub-py" + }, + { + "download_count": 708219, + "project": "django-tinymce" + }, + { + "download_count": 708181, + "project": "scrapyd-client" + }, + { + "download_count": 707527, + "project": "apiclient" + }, + { + "download_count": 707254, + "project": "imgaug" + }, + { + "download_count": 707113, + "project": "nbsphinx" + }, + { + "download_count": 707083, + "project": "waiting" + }, + { + "download_count": 705264, + "project": "colorclass" + }, + { + "download_count": 703706, + "project": "consul-kv" + }, + { + "download_count": 702978, + "project": "html" + }, + { + "download_count": 702738, + "project": "rlp" + }, + { + "download_count": 702351, + "project": "nose-cov" + }, + { + "download_count": 702193, + "project": "python-twitter" + }, + { + "download_count": 701163, + "project": "splunk-sdk" + }, + { + "download_count": 700250, + "project": "fastcluster" + }, + { + "download_count": 698719, + "project": "yamale" + }, + { + "download_count": 698219, + "project": "pyramid-arima" + }, + { + "download_count": 697868, + "project": "termstyle" + }, + { + "download_count": 697474, + "project": "xstatic-bootstrap-scss" + }, + { + "download_count": 695211, + "project": "pyrouge" + }, + { + "download_count": 694603, + "project": "snuggs" + }, + { + "download_count": 693279, + "project": "python-barbicanclient" + }, + { + "download_count": 693249, + "project": "pyaudio" + }, + { + "download_count": 692957, + "project": "cvxpy" + }, + { + "download_count": 692001, + "project": "async-lru" + }, + { + "download_count": 691907, + "project": "mizani" + }, + { + "download_count": 691307, + "project": "petname" + }, + { + "download_count": 691300, + "project": "rouge" + }, + { + "download_count": 689543, + "project": "agate-dbf" + }, + { + "download_count": 688981, + "project": "fastapi" + }, + { + "download_count": 687783, + "project": "category-encoders" + }, + { + "download_count": 687548, + "project": "oyaml" + }, + { + "download_count": 687522, + "project": "gnureadline" + }, + { + "download_count": 687081, + "project": "rake-nltk" + }, + { + "download_count": 686921, + "project": "titlecase" + }, + { + "download_count": 685900, + "project": "robotframework-pabot" + }, + { + "download_count": 685000, + "project": "pygraphviz" + }, + { + "download_count": 684549, + "project": "awesome-slugify" + }, + { + "download_count": 684157, + "project": "ibmiotf" + }, + { + "download_count": 683792, + "project": "cpplint" + }, + { + "download_count": 683191, + "project": "transforms3d" + }, + { + "download_count": 681681, + "project": "junos-eznc" + }, + { + "download_count": 680817, + "project": "edn-format" + }, + { + "download_count": 680484, + "project": "kappa" + }, + { + "download_count": 680439, + "project": "dist-keras" + }, + { + "download_count": 679352, + "project": "wagtail" + }, + { + "download_count": 679107, + "project": "xstatic" + }, + { + "download_count": 678488, + "project": "sparkpost" + }, + { + "download_count": 677907, + "project": "django-configurations" + }, + { + "download_count": 676671, + "project": "warrant" + }, + { + "download_count": 675669, + "project": "coremltools" + }, + { + "download_count": 675660, + "project": "pystemmer" + }, + { + "download_count": 674957, + "project": "piexif" + }, + { + "download_count": 674880, + "project": "xstatic-jquery" + }, + { + "download_count": 674487, + "project": "ebaysdk" + }, + { + "download_count": 672829, + "project": "durationpy" + }, + { + "download_count": 670913, + "project": "odo" + }, + { + "download_count": 670060, + "project": "django-admin-rangefilter" + }, + { + "download_count": 669445, + "project": "pytrie" + }, + { + "download_count": 669083, + "project": "wxpython" + }, + { + "download_count": 667717, + "project": "ovs" + }, + { + "download_count": 667474, + "project": "ecos" + }, + { + "download_count": 666906, + "project": "tinycss" + }, + { + "download_count": 666871, + "project": "osqp" + }, + { + "download_count": 666786, + "project": "eth-hash" + }, + { + "download_count": 666275, + "project": "requirements-parser" + }, + { + "download_count": 665693, + "project": "glom" + }, + { + "download_count": 661492, + "project": "cbor" + }, + { + "download_count": 661312, + "project": "typeguard" + }, + { + "download_count": 660570, + "project": "auth0-python" + }, + { + "download_count": 660013, + "project": "grpcio-opentracing" + }, + { + "download_count": 659377, + "project": "fastcache" + }, + { + "download_count": 659193, + "project": "eth-abi" + }, + { + "download_count": 659114, + "project": "django-modelcluster" + }, + { + "download_count": 657030, + "project": "jgscm" + }, + { + "download_count": 656904, + "project": "xlocal" + }, + { + "download_count": 656475, + "project": "plotnine" + }, + { + "download_count": 655373, + "project": "oslo-reports" + }, + { + "download_count": 654961, + "project": "selectors2" + }, + { + "download_count": 653743, + "project": "pyexcel" + }, + { + "download_count": 653621, + "project": "mongoalchemy" + }, + { + "download_count": 652980, + "project": "django-celery-monitor" + }, + { + "download_count": 652428, + "project": "django-modeltranslation" + }, + { + "download_count": 651995, + "project": "m3-cdecimal" + }, + { + "download_count": 651743, + "project": "django-prometheus" + }, + { + "download_count": 649810, + "project": "pylama" + }, + { + "download_count": 649753, + "project": "pygtrie" + }, + { + "download_count": 649300, + "project": "zappa" + }, + { + "download_count": 648596, + "project": "lambda-packages" + }, + { + "download_count": 648298, + "project": "chainmap" + }, + { + "download_count": 648259, + "project": "sqlitedict" + }, + { + "download_count": 646634, + "project": "weakrefmethod" + }, + { + "download_count": 646583, + "project": "pyephem" + }, + { + "download_count": 646316, + "project": "pecan" + }, + { + "download_count": 646192, + "project": "grpcio-testing" + }, + { + "download_count": 645984, + "project": "ptpython" + }, + { + "download_count": 645726, + "project": "uwsgitop" + }, + { + "download_count": 645705, + "project": "xattr" + }, + { + "download_count": 645542, + "project": "sseclient" + }, + { + "download_count": 644773, + "project": "distance" + }, + { + "download_count": 641990, + "project": "crayons" + }, + { + "download_count": 641666, + "project": "scs" + }, + { + "download_count": 641155, + "project": "youtube-dl-server" + }, + { + "download_count": 640583, + "project": "pydicom" + }, + { + "download_count": 640562, + "project": "disklist" + }, + { + "download_count": 640283, + "project": "oslo-versionedobjects" + }, + { + "download_count": 639381, + "project": "property-manager" + }, + { + "download_count": 639343, + "project": "pyramid-tm" + }, + { + "download_count": 638235, + "project": "civis" + }, + { + "download_count": 638153, + "project": "flask-sslify" + }, + { + "download_count": 637064, + "project": "tflearn" + }, + { + "download_count": 635676, + "project": "pygeoif" + }, + { + "download_count": 635375, + "project": "anytree" + }, + { + "download_count": 634585, + "project": "prawcore" + }, + { + "download_count": 633579, + "project": "httmock" + }, + { + "download_count": 633551, + "project": "praw" + }, + { + "download_count": 633536, + "project": "blaze" + }, + { + "download_count": 630085, + "project": "dogstatsd-python" + }, + { + "download_count": 629789, + "project": "df2gspread" + }, + { + "download_count": 629728, + "project": "intelhex" + }, + { + "download_count": 628881, + "project": "flask-pymongo" + }, + { + "download_count": 628208, + "project": "ara" + }, + { + "download_count": 628016, + "project": "supervisor-checks" + }, + { + "download_count": 626928, + "project": "portpicker" + }, + { + "download_count": 626822, + "project": "willow" + }, + { + "download_count": 624147, + "project": "django-admin-sortable2" + }, + { + "download_count": 623219, + "project": "py2neo" + }, + { + "download_count": 622538, + "project": "dis3" + }, + { + "download_count": 621132, + "project": "dask-ml" + }, + { + "download_count": 620942, + "project": "doc8" + }, + { + "download_count": 620211, + "project": "duo-client" + }, + { + "download_count": 620141, + "project": "django-rq" + }, + { + "download_count": 619804, + "project": "cronex" + }, + { + "download_count": 619350, + "project": "quandl" + }, + { + "download_count": 616490, + "project": "fpdf" + }, + { + "download_count": 615575, + "project": "dpkt" + }, + { + "download_count": 615407, + "project": "img2pdf" + }, + { + "download_count": 614677, + "project": "twython" + }, + { + "download_count": 612945, + "project": "django-tastypie" + }, + { + "download_count": 612710, + "project": "fastkml" + }, + { + "download_count": 611741, + "project": "pychef" + }, + { + "download_count": 611286, + "project": "pbkdf2" + }, + { + "download_count": 611114, + "project": "envparse" + }, + { + "download_count": 610989, + "project": "pytest-profiling" + }, + { + "download_count": 610971, + "project": "face" + }, + { + "download_count": 609341, + "project": "sphinxcontrib-plantuml" + }, + { + "download_count": 609245, + "project": "pockets" + }, + { + "download_count": 609190, + "project": "pex" + }, + { + "download_count": 607985, + "project": "codacy-coverage" + }, + { + "download_count": 607915, + "project": "smtpapi" + }, + { + "download_count": 607247, + "project": "recordtype" + }, + { + "download_count": 604747, + "project": "django-sekizai" + }, + { + "download_count": 604376, + "project": "glances" + }, + { + "download_count": 603378, + "project": "pysha3" + }, + { + "download_count": 602654, + "project": "sphinxcontrib-napoleon" + }, + { + "download_count": 601446, + "project": "authlib" + }, + { + "download_count": 601374, + "project": "python-intercom" + }, + { + "download_count": 600575, + "project": "flask-limiter" + }, + { + "download_count": 600277, + "project": "python-statsd" + }, + { + "download_count": 599602, + "project": "draftjs-exporter" + }, + { + "download_count": 598699, + "project": "flake8-debugger" + }, + { + "download_count": 598674, + "project": "oslo-upgradecheck" + }, + { + "download_count": 598119, + "project": "libvirt-python" + }, + { + "download_count": 597629, + "project": "cron-descriptor" + }, + { + "download_count": 597332, + "project": "wsproto" + }, + { + "download_count": 597238, + "project": "asyncio-nats-client" + }, + { + "download_count": 597234, + "project": "pytorch-pretrained-bert" + }, + { + "download_count": 597090, + "project": "fixture" + }, + { + "download_count": 596614, + "project": "alpha-vantage" + }, + { + "download_count": 596308, + "project": "edgegrid-python" + }, + { + "download_count": 596233, + "project": "eth-keys" + }, + { + "download_count": 596043, + "project": "impacket" + }, + { + "download_count": 595545, + "project": "win-inet-pton" + }, + { + "download_count": 595350, + "project": "mox3" + }, + { + "download_count": 595102, + "project": "rarfile" + }, + { + "download_count": 593426, + "project": "yarn-api-client" + }, + { + "download_count": 593291, + "project": "colored" + }, + { + "download_count": 592042, + "project": "txaws" + }, + { + "download_count": 591199, + "project": "speechrecognition" + }, + { + "download_count": 591134, + "project": "frozen-flask" + }, + { + "download_count": 590993, + "project": "django-log-request-id" + }, + { + "download_count": 589804, + "project": "funcparserlib" + }, + { + "download_count": 589445, + "project": "djangorestframework-camel-case" + }, + { + "download_count": 588165, + "project": "oslo-privsep" + }, + { + "download_count": 587455, + "project": "tf-nightly" + }, + { + "download_count": 587372, + "project": "caniusepython3" + }, + { + "download_count": 586559, + "project": "envtpl" + }, + { + "download_count": 586159, + "project": "mockredispy" + }, + { + "download_count": 586076, + "project": "properties" + }, + { + "download_count": 585723, + "project": "ansi2html" + }, + { + "download_count": 585253, + "project": "pyzipcode" + }, + { + "download_count": 584788, + "project": "sphinx-autodoc-typehints" + }, + { + "download_count": 583551, + "project": "environs" + }, + { + "download_count": 583517, + "project": "junit2html" + }, + { + "download_count": 583339, + "project": "yoyo-migrations" + }, + { + "download_count": 582030, + "project": "junitxml" + }, + { + "download_count": 580290, + "project": "django-heroku" + }, + { + "download_count": 579947, + "project": "chart-studio" + }, + { + "download_count": 579171, + "project": "pyexecjs" + }, + { + "download_count": 578063, + "project": "datasketch" + }, + { + "download_count": 577373, + "project": "django-autoslug" + }, + { + "download_count": 577155, + "project": "pyrepl" + }, + { + "download_count": 576195, + "project": "polygon-geohasher" + }, + { + "download_count": 575933, + "project": "addict" + }, + { + "download_count": 575932, + "project": "tooz" + }, + { + "download_count": 575622, + "project": "mecab-python3" + }, + { + "download_count": 575453, + "project": "shippo" + }, + { + "download_count": 575188, + "project": "bindep" + }, + { + "download_count": 574250, + "project": "requests-html" + }, + { + "download_count": 573651, + "project": "python-louvain" + }, + { + "download_count": 572787, + "project": "zmq" + }, + { + "download_count": 571317, + "project": "eth-account" + }, + { + "download_count": 571250, + "project": "ortools" + }, + { + "download_count": 570798, + "project": "automaton" + }, + { + "download_count": 570379, + "project": "django-cors-middleware" + }, + { + "download_count": 570213, + "project": "rq-dashboard" + }, + { + "download_count": 569967, + "project": "oslo-rootwrap" + }, + { + "download_count": 569775, + "project": "pilkit" + }, + { + "download_count": 569584, + "project": "readthedocs-sphinx-ext" + }, + { + "download_count": 569334, + "project": "latexcodec" + }, + { + "download_count": 568887, + "project": "south" + }, + { + "download_count": 568427, + "project": "agate-excel" + }, + { + "download_count": 568046, + "project": "hexbytes" + }, + { + "download_count": 567653, + "project": "django-money" + }, + { + "download_count": 567483, + "project": "agate-sql" + }, + { + "download_count": 566872, + "project": "kitchen" + }, + { + "download_count": 566696, + "project": "unipath" + }, + { + "download_count": 566631, + "project": "sshuttle" + }, + { + "download_count": 566158, + "project": "robotframework-faker" + }, + { + "download_count": 565395, + "project": "pybtex" + }, + { + "download_count": 565136, + "project": "django-nested-admin" + }, + { + "download_count": 564284, + "project": "eth-keyfile" + }, + { + "download_count": 564232, + "project": "djangorestframework-bulk" + }, + { + "download_count": 564010, + "project": "dataset" + }, + { + "download_count": 563254, + "project": "trafaret" + }, + { + "download_count": 562622, + "project": "cheetah3" + }, + { + "download_count": 561733, + "project": "flask-security" + }, + { + "download_count": 560775, + "project": "aliyun-python-sdk-core-v3" + }, + { + "download_count": 560763, + "project": "azureml-train-automl" + }, + { + "download_count": 559850, + "project": "control" + }, + { + "download_count": 559644, + "project": "implicit" + }, + { + "download_count": 559092, + "project": "dependency-injector" + }, + { + "download_count": 558284, + "project": "lazy" + }, + { + "download_count": 558189, + "project": "unidiff" + }, + { + "download_count": 557350, + "project": "textdistance" + }, + { + "download_count": 557098, + "project": "python-monkey-business" + }, + { + "download_count": 556600, + "project": "untangle" + }, + { + "download_count": 556409, + "project": "reverse-geocoder" + }, + { + "download_count": 556261, + "project": "pygeoip" + }, + { + "download_count": 554953, + "project": "eth-rlp" + }, + { + "download_count": 552622, + "project": "databricks" + }, + { + "download_count": 552459, + "project": "pyvim" + }, + { + "download_count": 551935, + "project": "taskflow" + }, + { + "download_count": 551365, + "project": "ifaddr" + }, + { + "download_count": 549608, + "project": "eeweather" + }, + { + "download_count": 549360, + "project": "clickhouse-cityhash" + }, + { + "download_count": 548549, + "project": "django-hijack" + }, + { + "download_count": 547813, + "project": "names" + }, + { + "download_count": 547796, + "project": "castellan" + }, + { + "download_count": 547711, + "project": "sacremoses" + }, + { + "download_count": 547488, + "project": "flake8-blind-except" + }, + { + "download_count": 547363, + "project": "mozdebug" + }, + { + "download_count": 547215, + "project": "ofxparse" + }, + { + "download_count": 546668, + "project": "vatnumber" + }, + { + "download_count": 546665, + "project": "remoto" + }, + { + "download_count": 546052, + "project": "checksumdir" + }, + { + "download_count": 545735, + "project": "pyowm" + }, + { + "download_count": 545330, + "project": "poster" + }, + { + "download_count": 543997, + "project": "lzstring" + }, + { + "download_count": 543850, + "project": "pyminizip" + }, + { + "download_count": 543634, + "project": "np-utils" + }, + { + "download_count": 543596, + "project": "injector" + }, + { + "download_count": 543183, + "project": "django-imagekit" + }, + { + "download_count": 542497, + "project": "five9" + }, + { + "download_count": 542414, + "project": "static3" + }, + { + "download_count": 541667, + "project": "oset" + }, + { + "download_count": 540962, + "project": "jsbeautifier" + }, + { + "download_count": 540750, + "project": "hdbscan" + }, + { + "download_count": 540280, + "project": "os-testr" + }, + { + "download_count": 540000, + "project": "flask-babelex" + }, + { + "download_count": 539901, + "project": "positional" + }, + { + "download_count": 539021, + "project": "profilehooks" + }, + { + "download_count": 538332, + "project": "flask-rq2" + }, + { + "download_count": 538314, + "project": "pygpgme" + }, + { + "download_count": 538159, + "project": "ts-flint" + }, + { + "download_count": 538112, + "project": "google-api-helper" + }, + { + "download_count": 537857, + "project": "markuppy" + }, + { + "download_count": 537565, + "project": "keras-mxnet" + }, + { + "download_count": 535795, + "project": "kwargs-only" + }, + { + "download_count": 534335, + "project": "django-mathfilters" + }, + { + "download_count": 534222, + "project": "dj-static" + }, + { + "download_count": 533502, + "project": "web-py" + }, + { + "download_count": 533322, + "project": "zenpy" + }, + { + "download_count": 533300, + "project": "django-enumfields" + }, + { + "download_count": 533281, + "project": "georaptor" + }, + { + "download_count": 533198, + "project": "heroku3" + }, + { + "download_count": 533034, + "project": "oci" + }, + { + "download_count": 532545, + "project": "django-fernet-fields" + }, + { + "download_count": 531368, + "project": "pyftpdlib" + }, + { + "download_count": 529065, + "project": "neutron-lib" + }, + { + "download_count": 529026, + "project": "grpcio-reflection" + }, + { + "download_count": 528753, + "project": "python-jsonschema-objects" + }, + { + "download_count": 528555, + "project": "django-dynamic-fixture" + }, + { + "download_count": 528426, + "project": "pyod" + }, + { + "download_count": 528307, + "project": "simplekml" + }, + { + "download_count": 527593, + "project": "overrides" + }, + { + "download_count": 526989, + "project": "ovsdbapp" + }, + { + "download_count": 526603, + "project": "tavern" + }, + { + "download_count": 526180, + "project": "peppercorn" + }, + { + "download_count": 526018, + "project": "cbapi" + }, + { + "download_count": 525952, + "project": "twitter-common-contextutil" + }, + { + "download_count": 523345, + "project": "pypdf" + }, + { + "download_count": 523091, + "project": "couchbase" + }, + { + "download_count": 522723, + "project": "profanityfilter" + }, + { + "download_count": 522269, + "project": "blist" + }, + { + "download_count": 522185, + "project": "pydns" + }, + { + "download_count": 521431, + "project": "stopit" + }, + { + "download_count": 521064, + "project": "keyboard" + }, + { + "download_count": 520346, + "project": "twitter-common-util" + }, + { + "download_count": 520255, + "project": "flatten-json" + }, + { + "download_count": 519427, + "project": "twitter-common-string" + }, + { + "download_count": 519406, + "project": "tableauserverclient" + }, + { + "download_count": 519368, + "project": "m2r" + }, + { + "download_count": 519326, + "project": "twitter-common-process" + }, + { + "download_count": 519222, + "project": "twitter-common-app" + }, + { + "download_count": 518985, + "project": "json-rpc" + }, + { + "download_count": 517770, + "project": "slack-webhook-cli" + }, + { + "download_count": 517297, + "project": "antigate" + }, + { + "download_count": 516754, + "project": "sphinxcontrib-bibtex" + }, + { + "download_count": 516195, + "project": "pybtex-docutils" + }, + { + "download_count": 515133, + "project": "rfc6266-parser" + }, + { + "download_count": 514541, + "project": "nflx-genie-client" + }, + { + "download_count": 513202, + "project": "missingno" + }, + { + "download_count": 513069, + "project": "mitmproxy" + }, + { + "download_count": 512838, + "project": "conan-package-tools" + }, + { + "download_count": 512668, + "project": "xlutils" + }, + { + "download_count": 512441, + "project": "pprintpp" + }, + { + "download_count": 512440, + "project": "os-traits" + }, + { + "download_count": 512397, + "project": "svglib" + }, + { + "download_count": 510713, + "project": "btrees" + }, + { + "download_count": 510636, + "project": "graphframes" + }, + { + "download_count": 509946, + "project": "sarge" + }, + { + "download_count": 509466, + "project": "shadowsocks" + }, + { + "download_count": 509388, + "project": "hmsclient" + }, + { + "download_count": 509166, + "project": "azure-mgmt-servermanager" + }, + { + "download_count": 508757, + "project": "elasticache-pyclient" + }, + { + "download_count": 508756, + "project": "xstatic-patternfly" + }, + { + "download_count": 508352, + "project": "pep257" + }, + { + "download_count": 508010, + "project": "xstatic-patternfly-bootstrap-treeview" + }, + { + "download_count": 507803, + "project": "xstatic-datatables" + }, + { + "download_count": 507499, + "project": "django-recaptcha" + }, + { + "download_count": 507473, + "project": "persistent" + }, + { + "download_count": 507135, + "project": "altair" + }, + { + "download_count": 505888, + "project": "edx-enterprise" + }, + { + "download_count": 505690, + "project": "graphy" + }, + { + "download_count": 505101, + "project": "redlock-py" + }, + { + "download_count": 504911, + "project": "pymc3" + }, + { + "download_count": 504787, + "project": "mercantile" + }, + { + "download_count": 504175, + "project": "lftools" + }, + { + "download_count": 502985, + "project": "robotframework-httplibrary" + }, + { + "download_count": 501914, + "project": "tsfresh" + }, + { + "download_count": 501627, + "project": "fitbit" + }, + { + "download_count": 501439, + "project": "lightfm" + }, + { + "download_count": 501354, + "project": "djoser" + }, + { + "download_count": 501217, + "project": "pytest-faulthandler" + }, + { + "download_count": 500476, + "project": "formencode" + }, + { + "download_count": 500465, + "project": "spyne" + }, + { + "download_count": 500288, + "project": "backports-os" + }, + { + "download_count": 500147, + "project": "customerio" + }, + { + "download_count": 499726, + "project": "os-win" + }, + { + "download_count": 499639, + "project": "neptune-client" + }, + { + "download_count": 499204, + "project": "googleappenginecloudstorageclient" + }, + { + "download_count": 498658, + "project": "sparqlwrapper" + }, + { + "download_count": 498519, + "project": "sphinxcontrib-spelling" + }, + { + "download_count": 498177, + "project": "geotext" + }, + { + "download_count": 497560, + "project": "pytest-lazy-fixture" + }, + { + "download_count": 497085, + "project": "pyarabic" + }, + { + "download_count": 497017, + "project": "auditwheel" + }, + { + "download_count": 496676, + "project": "django-debug-panel" + }, + { + "download_count": 495919, + "project": "cssmin" + }, + { + "download_count": 495656, + "project": "nose-progressive" + }, + { + "download_count": 495187, + "project": "django-suit" + }, + { + "download_count": 495183, + "project": "mercurial" + }, + { + "download_count": 495032, + "project": "python-hosts" + }, + { + "download_count": 494652, + "project": "pywatchman" + }, + { + "download_count": 494192, + "project": "pip-lock" + }, + { + "download_count": 494177, + "project": "clikit" + }, + { + "download_count": 494100, + "project": "flake8-per-file-ignores" + }, + { + "download_count": 493208, + "project": "os-brick" + }, + { + "download_count": 492737, + "project": "cloudinary" + }, + { + "download_count": 492342, + "project": "pyroma" + }, + { + "download_count": 491821, + "project": "aiohttp-jinja2" + }, + { + "download_count": 491668, + "project": "func-timeout" + }, + { + "download_count": 491557, + "project": "ldapdomaindump" + }, + { + "download_count": 490771, + "project": "logzio-python-handler" + }, + { + "download_count": 490651, + "project": "yarg" + }, + { + "download_count": 490261, + "project": "python-geoip" + }, + { + "download_count": 489169, + "project": "gremlinpython" + }, + { + "download_count": 488646, + "project": "uplink" + }, + { + "download_count": 487621, + "project": "pyjarowinkler" + }, + { + "download_count": 485859, + "project": "qt4reactor" + }, + { + "download_count": 485712, + "project": "records" + }, + { + "download_count": 485512, + "project": "flake8-string-format" + }, + { + "download_count": 485371, + "project": "django-rest-framework" + }, + { + "download_count": 485084, + "project": "pydruid" + }, + { + "download_count": 484914, + "project": "meson" + }, + { + "download_count": 484556, + "project": "django-select2" + }, + { + "download_count": 484267, + "project": "pamqp" + }, + { + "download_count": 484090, + "project": "xmljson" + }, + { + "download_count": 483920, + "project": "slots" + }, + { + "download_count": 483748, + "project": "doublemetaphone" + }, + { + "download_count": 483545, + "project": "pycli" + }, + { + "download_count": 483354, + "project": "jupyterlab-launcher" + }, + { + "download_count": 482936, + "project": "editorconfig" + }, + { + "download_count": 482719, + "project": "pamela" + }, + { + "download_count": 482539, + "project": "rdpy" + }, + { + "download_count": 482395, + "project": "word2number" + }, + { + "download_count": 482346, + "project": "pykmip" + }, + { + "download_count": 480460, + "project": "recurly" + }, + { + "download_count": 479945, + "project": "datarobot" + }, + { + "download_count": 479251, + "project": "email-reply-parser" + }, + { + "download_count": 479059, + "project": "geohash2" + }, + { + "download_count": 478838, + "project": "readchar" + }, + { + "download_count": 478822, + "project": "mohawk" + }, + { + "download_count": 478394, + "project": "orjson" + }, + { + "download_count": 478032, + "project": "pycocotools" + }, + { + "download_count": 477626, + "project": "pythonnet" + }, + { + "download_count": 477384, + "project": "deap" + }, + { + "download_count": 476311, + "project": "cursor" + }, + { + "download_count": 475480, + "project": "django-jenkins" + }, + { + "download_count": 475049, + "project": "azureml-automl-core" + }, + { + "download_count": 474562, + "project": "sklearn-crfsuite" + }, + { + "download_count": 472571, + "project": "azure-mgmt-documentdb" + }, + { + "download_count": 471293, + "project": "paretochart" + }, + { + "download_count": 471137, + "project": "python-debian" + }, + { + "download_count": 471045, + "project": "rply" + }, + { + "download_count": 469934, + "project": "pynliner" + }, + { + "download_count": 469110, + "project": "ipwhois" + }, + { + "download_count": 468984, + "project": "pylint-quotes" + }, + { + "download_count": 468853, + "project": "sfmergeutility" + }, + { + "download_count": 468745, + "project": "pyside2" + }, + { + "download_count": 468673, + "project": "cupy-cuda100" + }, + { + "download_count": 468012, + "project": "tokenize-rt" + }, + { + "download_count": 467174, + "project": "halo" + }, + { + "download_count": 467029, + "project": "pyblake2" + }, + { + "download_count": 466658, + "project": "python-keyczar" + }, + { + "download_count": 466596, + "project": "pytest-factoryboy" + }, + { + "download_count": 466322, + "project": "pyramid-mako" + }, + { + "download_count": 465692, + "project": "speedtest-cli" + }, + { + "download_count": 465559, + "project": "ansible-vault" + }, + { + "download_count": 465439, + "project": "sure" + }, + { + "download_count": 465170, + "project": "h3" + }, + { + "download_count": 464606, + "project": "pysolar" + }, + { + "download_count": 464135, + "project": "os-vif" + }, + { + "download_count": 462962, + "project": "gcovr" + }, + { + "download_count": 462652, + "project": "gputil" + }, + { + "download_count": 462649, + "project": "pyexcel-xlsx" + }, + { + "download_count": 462258, + "project": "pytest-bdd" + }, + { + "download_count": 462062, + "project": "qtpy" + }, + { + "download_count": 461447, + "project": "marshmallow-jsonschema" + }, + { + "download_count": 461130, + "project": "xmlschema" + }, + { + "download_count": 461066, + "project": "log-symbols" + }, + { + "download_count": 461026, + "project": "aiopg" + }, + { + "download_count": 461021, + "project": "paypalrestsdk" + }, + { + "download_count": 459361, + "project": "bpython" + }, + { + "download_count": 459221, + "project": "django-memoize" + }, + { + "download_count": 458741, + "project": "pastescript" + }, + { + "download_count": 458467, + "project": "djangorestframework-gis" + }, + { + "download_count": 458421, + "project": "yamlordereddictloader" + }, + { + "download_count": 458237, + "project": "azure-cli-privatedns" + }, + { + "download_count": 457094, + "project": "jupyterhub" + }, + { + "download_count": 457021, + "project": "pytest-random-order" + }, + { + "download_count": 456889, + "project": "cli-helpers" + }, + { + "download_count": 456492, + "project": "django-jet" + }, + { + "download_count": 456487, + "project": "django-solo" + }, + { + "download_count": 455927, + "project": "easypkg" + }, + { + "download_count": 455745, + "project": "oslotest" + }, + { + "download_count": 455660, + "project": "td-client" + }, + { + "download_count": 455550, + "project": "docker-buildtool" + }, + { + "download_count": 455228, + "project": "pyactiveresource" + }, + { + "download_count": 455148, + "project": "filetype" + }, + { + "download_count": 454275, + "project": "integrationhelper" + }, + { + "download_count": 454060, + "project": "treeinterpreter" + }, + { + "download_count": 453726, + "project": "spinners" + }, + { + "download_count": 453478, + "project": "tinys3" + }, + { + "download_count": 452911, + "project": "google-nucleus" + }, + { + "download_count": 452905, + "project": "sfctl" + }, + { + "download_count": 452659, + "project": "wsme" + }, + { + "download_count": 452548, + "project": "cloudml-hypertune" + }, + { + "download_count": 452284, + "project": "djrill" + }, + { + "download_count": 451894, + "project": "rdflib-jsonld" + }, + { + "download_count": 451751, + "project": "pyhull" + }, + { + "download_count": 451388, + "project": "weka-easypy" + }, + { + "download_count": 451340, + "project": "zerorpc" + }, + { + "download_count": 450074, + "project": "requests-aws-sign" + }, + { + "download_count": 449859, + "project": "apns2" + }, + { + "download_count": 449829, + "project": "pytest-freezegun" + }, + { + "download_count": 449733, + "project": "logentries" + }, + { + "download_count": 449274, + "project": "polling" + }, + { + "download_count": 449144, + "project": "ner" + }, + { + "download_count": 448946, + "project": "pycuber" + }, + { + "download_count": 448187, + "project": "dfply" + }, + { + "download_count": 447960, + "project": "elasticsearch5" + }, + { + "download_count": 447647, + "project": "pyramid-debugtoolbar" + }, + { + "download_count": 447433, + "project": "dohq-artifactory" + }, + { + "download_count": 447042, + "project": "graphyte" + }, + { + "download_count": 446699, + "project": "gtts-token" + }, + { + "download_count": 446599, + "project": "s3io" + }, + { + "download_count": 446457, + "project": "pyldavis" + }, + { + "download_count": 446070, + "project": "dm-xmlsec-binding" + }, + { + "download_count": 445558, + "project": "oslo-vmware" + }, + { + "download_count": 445493, + "project": "mkdocs-minify-plugin" + }, + { + "download_count": 442789, + "project": "systemd-python" + }, + { + "download_count": 441825, + "project": "django-daterange-filter" + }, + { + "download_count": 441288, + "project": "pycld2" + }, + { + "download_count": 441011, + "project": "ffmpy" + }, + { + "download_count": 440747, + "project": "onnxruntime" + }, + { + "download_count": 440442, + "project": "pathmatch" + }, + { + "download_count": 440074, + "project": "beatbox" + }, + { + "download_count": 439695, + "project": "dotmap" + }, + { + "download_count": 439566, + "project": "atari-py" + }, + { + "download_count": 436976, + "project": "pytest-socket" + }, + { + "download_count": 436145, + "project": "matplotlib-venn" + }, + { + "download_count": 434595, + "project": "dnslib" + }, + { + "download_count": 434167, + "project": "leveldb" + }, + { + "download_count": 433865, + "project": "django-dirtyfields" + }, + { + "download_count": 433860, + "project": "shiboken2" + }, + { + "download_count": 433596, + "project": "chameleon" + }, + { + "download_count": 433574, + "project": "python-social-auth" + }, + { + "download_count": 433514, + "project": "xunitparser" + }, + { + "download_count": 433494, + "project": "tempest" + }, + { + "download_count": 433330, + "project": "django-extra-views" + }, + { + "download_count": 433032, + "project": "django-sslserver" + }, + { + "download_count": 432924, + "project": "netstorageapi" + }, + { + "download_count": 432577, + "project": "django-bootstrap-form" + }, + { + "download_count": 431716, + "project": "aio-pika" + }, + { + "download_count": 431533, + "project": "curtsies" + }, + { + "download_count": 431368, + "project": "edx-proctoring" + }, + { + "download_count": 429918, + "project": "rules" + }, + { + "download_count": 429501, + "project": "treq" + }, + { + "download_count": 429446, + "project": "python2-pythondialog" + }, + { + "download_count": 429251, + "project": "shopifyapi" + }, + { + "download_count": 429239, + "project": "pyros-genmsg" + }, + { + "download_count": 428668, + "project": "pyros-genpy" + }, + { + "download_count": 427728, + "project": "django-webtest" + }, + { + "download_count": 427374, + "project": "cpp-coveralls" + }, + { + "download_count": 426629, + "project": "hyperloglog" + }, + { + "download_count": 425518, + "project": "pathvalidate" + }, + { + "download_count": 424129, + "project": "marisa-trie" + }, + { + "download_count": 423827, + "project": "graphene-file-upload" + }, + { + "download_count": 423528, + "project": "wurlitzer" + }, + { + "download_count": 423446, + "project": "geoip" + }, + { + "download_count": 423400, + "project": "nameko" + }, + { + "download_count": 422280, + "project": "pipreqs" + }, + { + "download_count": 422034, + "project": "airbrake" + }, + { + "download_count": 421423, + "project": "python-barcode" + }, + { + "download_count": 420487, + "project": "featuretools" + }, + { + "download_count": 420463, + "project": "pydes" + }, + { + "download_count": 420080, + "project": "oss2" + }, + { + "download_count": 419064, + "project": "win-unicode-console" + }, + { + "download_count": 418651, + "project": "aiocontextvars" + }, + { + "download_count": 417979, + "project": "flake8-logging-format" + }, + { + "download_count": 417452, + "project": "aiokafka" + }, + { + "download_count": 416219, + "project": "astunparse" + }, + { + "download_count": 414872, + "project": "doit" + }, + { + "download_count": 414706, + "project": "scikit-surprise" + }, + { + "download_count": 414280, + "project": "flask-mysql" + }, + { + "download_count": 414268, + "project": "pygerrit2" + }, + { + "download_count": 412851, + "project": "requests-http-signature" + }, + { + "download_count": 412476, + "project": "django-dotenv" + }, + { + "download_count": 412152, + "project": "ffmpeg-quality-metrics" + }, + { + "download_count": 412022, + "project": "spotify-tensorflow" + }, + { + "download_count": 411026, + "project": "wsgi-intercept" + }, + { + "download_count": 410904, + "project": "breathe" + }, + { + "download_count": 410783, + "project": "google-api-python-client-uritemplate" + }, + { + "download_count": 408750, + "project": "django-ajax-selects" + }, + { + "download_count": 408606, + "project": "websocket" + }, + { + "download_count": 408486, + "project": "healthcheck" + }, + { + "download_count": 408427, + "project": "redo" + }, + { + "download_count": 408117, + "project": "pypiserver" + }, + { + "download_count": 408017, + "project": "localstack-client" + }, + { + "download_count": 407856, + "project": "fastai" + }, + { + "download_count": 407560, + "project": "django-impersonate" + }, + { + "download_count": 407287, + "project": "zipcodes" + }, + { + "download_count": 407121, + "project": "treelib" + }, + { + "download_count": 407028, + "project": "django-stubs" + }, + { + "download_count": 406712, + "project": "django-two-factor-auth" + }, + { + "download_count": 405396, + "project": "json-delta" + }, + { + "download_count": 405170, + "project": "socketio-client" + }, + { + "download_count": 405065, + "project": "gin-config" + }, + { + "download_count": 405060, + "project": "coverage-badge" + }, + { + "download_count": 404993, + "project": "django-sendgrid-v5" + }, + { + "download_count": 404902, + "project": "shutilwhich" + }, + { + "download_count": 404866, + "project": "flask-redis" + }, + { + "download_count": 404373, + "project": "pep562" + }, + { + "download_count": 404209, + "project": "niet" + }, + { + "download_count": 403508, + "project": "dask-glm" + }, + { + "download_count": 402928, + "project": "evergreen-py" + }, + { + "download_count": 402697, + "project": "zxcvbn" + }, + { + "download_count": 402692, + "project": "dataproperty" + }, + { + "download_count": 402398, + "project": "pygeohash" + }, + { + "download_count": 401062, + "project": "ast" + }, + { + "download_count": 400982, + "project": "pyobjc-core" + }, + { + "download_count": 400958, + "project": "http-ece" + }, + { + "download_count": 400803, + "project": "readline" + }, + { + "download_count": 400450, + "project": "django-elasticsearch-dsl" + }, + { + "download_count": 400436, + "project": "python-xlib" + }, + { + "download_count": 400407, + "project": "flatten-dict" + }, + { + "download_count": 399614, + "project": "gherkin-official" + }, + { + "download_count": 399263, + "project": "elementpath" + }, + { + "download_count": 399214, + "project": "gdal" + }, + { + "download_count": 399000, + "project": "roman" + }, + { + "download_count": 398885, + "project": "click-spinner" + }, + { + "download_count": 398873, + "project": "chalice" + }, + { + "download_count": 398463, + "project": "django-filer" + }, + { + "download_count": 398402, + "project": "ldclient-py" + }, + { + "download_count": 398269, + "project": "gtts" + }, + { + "download_count": 397948, + "project": "django-registration" + }, + { + "download_count": 397646, + "project": "collectfast" + }, + { + "download_count": 396999, + "project": "django-jinja" + }, + { + "download_count": 396968, + "project": "eradicate" + }, + { + "download_count": 396714, + "project": "neo4j-driver" + }, + { + "download_count": 396369, + "project": "cybox" + }, + { + "download_count": 396364, + "project": "asgi-redis" + }, + { + "download_count": 396056, + "project": "boto3-type-annotations" + }, + { + "download_count": 395861, + "project": "etcd3gw" + }, + { + "download_count": 395415, + "project": "face-recognition" + }, + { + "download_count": 395184, + "project": "os-xenapi" + }, + { + "download_count": 395153, + "project": "neo4j" + }, + { + "download_count": 394185, + "project": "pytrends" + }, + { + "download_count": 393950, + "project": "grpcio-status" + }, + { + "download_count": 393467, + "project": "sailthru-client" + }, + { + "download_count": 393315, + "project": "repoze-sendmail" + }, + { + "download_count": 393244, + "project": "bayesian-optimization" + }, + { + "download_count": 393069, + "project": "pillow-simd" + }, + { + "download_count": 392655, + "project": "inquirer" + }, + { + "download_count": 391989, + "project": "watson-developer-cloud" + }, + { + "download_count": 391807, + "project": "assertpy" + }, + { + "download_count": 391722, + "project": "chainer" + }, + { + "download_count": 391162, + "project": "aiogithubapi" + }, + { + "download_count": 391117, + "project": "pyclustering" + }, + { + "download_count": 390635, + "project": "django-test-plus" + }, + { + "download_count": 389572, + "project": "azureml-explain-model" + }, + { + "download_count": 389554, + "project": "param" + }, + { + "download_count": 388843, + "project": "smartsheet-python-sdk" + }, + { + "download_count": 388646, + "project": "google-ads" + }, + { + "download_count": 387346, + "project": "unicode-slugify" + }, + { + "download_count": 387007, + "project": "django-smtp-ssl" + }, + { + "download_count": 386636, + "project": "udatetime" + }, + { + "download_count": 386540, + "project": "pyobjc-framework-cocoa" + }, + { + "download_count": 386296, + "project": "confuse" + }, + { + "download_count": 386037, + "project": "hdfs3" + }, + { + "download_count": 385593, + "project": "moznetwork" + }, + { + "download_count": 385320, + "project": "pydot2" + }, + { + "download_count": 385150, + "project": "djangocms-admin-style" + }, + { + "download_count": 384650, + "project": "pyquaternion" + }, + { + "download_count": 384272, + "project": "xblock" + }, + { + "download_count": 384195, + "project": "flask-talisman" + }, + { + "download_count": 383670, + "project": "paver" + }, + { + "download_count": 383579, + "project": "pytorch-transformers" + }, + { + "download_count": 383499, + "project": "netdisco" + }, + { + "download_count": 383345, + "project": "kivy" + }, + { + "download_count": 383182, + "project": "django-uuidfield" + }, + { + "download_count": 382848, + "project": "jwt" + }, + { + "download_count": 382404, + "project": "logdna" + }, + { + "download_count": 382235, + "project": "relativetimebuilder" + }, + { + "download_count": 381845, + "project": "json2html" + }, + { + "download_count": 381570, + "project": "pytest-helpers-namespace" + }, + { + "download_count": 381409, + "project": "codespell" + }, + { + "download_count": 381241, + "project": "open3d-python" + }, + { + "download_count": 381173, + "project": "aws" + }, + { + "download_count": 381129, + "project": "plyfile" + }, + { + "download_count": 380993, + "project": "py-spy" + }, + { + "download_count": 380964, + "project": "aliyun-python-sdk-kms" + }, + { + "download_count": 380771, + "project": "stix" + }, + { + "download_count": 379960, + "project": "pywebpush" + }, + { + "download_count": 379915, + "project": "paramiko-expect" + }, + { + "download_count": 379467, + "project": "face-recognition-models" + }, + { + "download_count": 379302, + "project": "umap-learn" + }, + { + "download_count": 378977, + "project": "cbor2" + }, + { + "download_count": 378025, + "project": "django-redis-sessions" + }, + { + "download_count": 377737, + "project": "pymisp" + }, + { + "download_count": 377661, + "project": "django-test-without-migrations" + }, + { + "download_count": 377526, + "project": "readability-lxml" + }, + { + "download_count": 377300, + "project": "python-jsonrpc-server" + }, + { + "download_count": 377259, + "project": "yara-python" + }, + { + "download_count": 376371, + "project": "scikit-build" + }, + { + "download_count": 376213, + "project": "wasmer" + }, + { + "download_count": 376182, + "project": "django-templated-email" + }, + { + "download_count": 375778, + "project": "www-authenticate" + }, + { + "download_count": 375656, + "project": "plaid-python" + }, + { + "download_count": 375163, + "project": "mixbox" + }, + { + "download_count": 374823, + "project": "fastdiff" + }, + { + "download_count": 374712, + "project": "pyang" + }, + { + "download_count": 373785, + "project": "flake8-tidy-imports" + }, + { + "download_count": 373672, + "project": "dnspython3" + }, + { + "download_count": 373668, + "project": "twitter-common-confluence" + }, + { + "download_count": 373502, + "project": "cursive" + }, + { + "download_count": 372891, + "project": "requests-oauth" + }, + { + "download_count": 372768, + "project": "edx-opaque-keys" + }, + { + "download_count": 372679, + "project": "flake8-mutable" + }, + { + "download_count": 372516, + "project": "docxtpl" + }, + { + "download_count": 372505, + "project": "reloader" + }, + { + "download_count": 371987, + "project": "ibm-cos-sdk" + }, + { + "download_count": 371891, + "project": "python-multipart" + }, + { + "download_count": 371361, + "project": "shodan" + }, + { + "download_count": 370894, + "project": "glance-store" + }, + { + "download_count": 370618, + "project": "blobxfer" + }, + { + "download_count": 370307, + "project": "mailchimp" + }, + { + "download_count": 370281, + "project": "amazon-kclpy" + }, + { + "download_count": 369713, + "project": "azure-cli-deploymentmanager" + }, + { + "download_count": 369303, + "project": "cfscrape" + }, + { + "download_count": 369271, + "project": "gabbi" + }, + { + "download_count": 368704, + "project": "docker-registry-client" + }, + { + "download_count": 368627, + "project": "visdom" + }, + { + "download_count": 368133, + "project": "djangosaml2" + }, + { + "download_count": 367774, + "project": "torchfile" + }, + { + "download_count": 367743, + "project": "python-language-server" + }, + { + "download_count": 367741, + "project": "django-registration-redux" + }, + { + "download_count": 366408, + "project": "pypowervm" + }, + { + "download_count": 365959, + "project": "pypubsub" + }, + { + "download_count": 365726, + "project": "flake8-mypy" + }, + { + "download_count": 365550, + "project": "mixer" + }, + { + "download_count": 365313, + "project": "config" + }, + { + "download_count": 365224, + "project": "pytorch" + }, + { + "download_count": 364756, + "project": "py-geohash-any" + }, + { + "download_count": 364330, + "project": "pantsbuild-pants" + }, + { + "download_count": 364200, + "project": "strif" + }, + { + "download_count": 364189, + "project": "pgc-interface" + }, + { + "download_count": 363919, + "project": "pyrasite" + }, + { + "download_count": 363463, + "project": "browsermob-proxy" + }, + { + "download_count": 362770, + "project": "marshmallow-oneofschema" + }, + { + "download_count": 362569, + "project": "python-saml" + }, + { + "download_count": 362447, + "project": "pymc" + }, + { + "download_count": 362409, + "project": "vadersentiment" + }, + { + "download_count": 362107, + "project": "pyxero" + }, + { + "download_count": 361277, + "project": "ccxt" + }, + { + "download_count": 361145, + "project": "executor" + }, + { + "download_count": 360517, + "project": "requests-pkcs12" + }, + { + "download_count": 360423, + "project": "instaclone" + }, + { + "download_count": 360015, + "project": "exchangelib" + }, + { + "download_count": 359650, + "project": "lomond" + }, + { + "download_count": 359422, + "project": "mibian" + }, + { + "download_count": 359376, + "project": "sip" + }, + { + "download_count": 358575, + "project": "django-ordered-model" + }, + { + "download_count": 358484, + "project": "eyed3" + }, + { + "download_count": 358443, + "project": "pysendfile" + }, + { + "download_count": 358260, + "project": "nose-testconfig" + }, + { + "download_count": 358034, + "project": "delegator-py" + }, + { + "download_count": 357573, + "project": "currencyconverter" + }, + { + "download_count": 356478, + "project": "backports-lzma" + }, + { + "download_count": 356429, + "project": "p4python" + }, + { + "download_count": 356412, + "project": "zope-index" + }, + { + "download_count": 356169, + "project": "cloudflare" + }, + { + "download_count": 356004, + "project": "cql" + }, + { + "download_count": 355945, + "project": "dacite" + }, + { + "download_count": 355827, + "project": "python-cjson" + }, + { + "download_count": 355794, + "project": "marshmallow-arrow" + }, + { + "download_count": 355729, + "project": "mbstrdecoder" + }, + { + "download_count": 354987, + "project": "urlextract" + }, + { + "download_count": 354886, + "project": "typepy" + }, + { + "download_count": 354885, + "project": "htpasswd" + }, + { + "download_count": 354555, + "project": "mod-wsgi" + }, + { + "download_count": 354506, + "project": "django-cms" + }, + { + "download_count": 353955, + "project": "flask-apscheduler" + }, + { + "download_count": 353201, + "project": "pymobiledetect" + }, + { + "download_count": 353184, + "project": "times" + }, + { + "download_count": 352996, + "project": "zabbix-api" + }, + { + "download_count": 352927, + "project": "bcdoc" + }, + { + "download_count": 352725, + "project": "torchtext" + }, + { + "download_count": 352313, + "project": "flashtext" + }, + { + "download_count": 351678, + "project": "referer-parser" + }, + { + "download_count": 350758, + "project": "pyexcel-xls" + }, + { + "download_count": 350681, + "project": "edx-drf-extensions" + }, + { + "download_count": 350665, + "project": "falcon-multipart" + }, + { + "download_count": 350619, + "project": "inotify" + }, + { + "download_count": 350184, + "project": "tpot" + }, + { + "download_count": 349490, + "project": "mypy-protobuf" + }, + { + "download_count": 349330, + "project": "pygit2" + }, + { + "download_count": 348567, + "project": "robotbackgroundlogger" + }, + { + "download_count": 348256, + "project": "traces" + }, + { + "download_count": 348166, + "project": "django-extra-fields" + }, + { + "download_count": 348009, + "project": "rook" + }, + { + "download_count": 348008, + "project": "ssh2-python" + }, + { + "download_count": 347979, + "project": "jupytext" + }, + { + "download_count": 347497, + "project": "optunity" + }, + { + "download_count": 347125, + "project": "django-safedelete" + }, + { + "download_count": 347040, + "project": "django-jsonview" + }, + { + "download_count": 347003, + "project": "allure-behave" + }, + { + "download_count": 346883, + "project": "forex-python" + }, + { + "download_count": 346742, + "project": "logger" + }, + { + "download_count": 346329, + "project": "django-choices" + }, + { + "download_count": 345484, + "project": "xdis" + }, + { + "download_count": 345296, + "project": "django-babel" + }, + { + "download_count": 345262, + "project": "parse-accept-language" + }, + { + "download_count": 344856, + "project": "scons" + }, + { + "download_count": 344819, + "project": "klein" + }, + { + "download_count": 344742, + "project": "flask-shell-ipython" + }, + { + "download_count": 344586, + "project": "amqplib" + }, + { + "download_count": 344301, + "project": "betamax" + }, + { + "download_count": 344260, + "project": "flask-basicauth" + }, + { + "download_count": 344021, + "project": "pybarcode" + }, + { + "download_count": 343992, + "project": "pytest-json" + }, + { + "download_count": 343912, + "project": "uiautomation" + }, + { + "download_count": 343788, + "project": "pyemd" + }, + { + "download_count": 343547, + "project": "flufl-enum" + }, + { + "download_count": 342092, + "project": "normality" + }, + { + "download_count": 341312, + "project": "osc-placement" + }, + { + "download_count": 340998, + "project": "pytest-parallel" + }, + { + "download_count": 340763, + "project": "crochet" + }, + { + "download_count": 340105, + "project": "proximityhash" + }, + { + "download_count": 339952, + "project": "pyscss" + }, + { + "download_count": 339480, + "project": "python-qpid-proton" + }, + { + "download_count": 339302, + "project": "vtk" + }, + { + "download_count": 338910, + "project": "hmmlearn" + }, + { + "download_count": 338542, + "project": "pyqtwebengine" + }, + { + "download_count": 337957, + "project": "django-watchman" + }, + { + "download_count": 337701, + "project": "python-igraph" + }, + { + "download_count": 337586, + "project": "edxval" + }, + { + "download_count": 337501, + "project": "ibm-cos-sdk-core" + }, + { + "download_count": 337200, + "project": "edx-django-utils" + }, + { + "download_count": 336856, + "project": "ibm-cos-sdk-s3transfer" + }, + { + "download_count": 336294, + "project": "spark-nlp" + }, + { + "download_count": 335964, + "project": "rhea" + }, + { + "download_count": 335873, + "project": "exifread" + }, + { + "download_count": 335709, + "project": "tensorflow-estimator-2-0-preview" + }, + { + "download_count": 335463, + "project": "python-binary-memcached" + }, + { + "download_count": 335218, + "project": "spyder" + }, + { + "download_count": 334977, + "project": "rstr" + }, + { + "download_count": 334204, + "project": "asteval" + }, + { + "download_count": 333818, + "project": "uncompyle6" + }, + { + "download_count": 333754, + "project": "requests-async" + }, + { + "download_count": 333266, + "project": "kaitaistruct" + }, + { + "download_count": 332129, + "project": "multiprocessing" + }, + { + "download_count": 332061, + "project": "chromedriver" + }, + { + "download_count": 332013, + "project": "iso-639" + }, + { + "download_count": 331946, + "project": "daiquiri" + }, + { + "download_count": 331588, + "project": "tendo" + }, + { + "download_count": 331525, + "project": "spark-parser" + }, + { + "download_count": 331379, + "project": "setuptools-git-version" + }, + { + "download_count": 331153, + "project": "priority" + }, + { + "download_count": 330940, + "project": "cachelib" + }, + { + "download_count": 330879, + "project": "os-ken" + }, + { + "download_count": 330608, + "project": "microversion-parse" + }, + { + "download_count": 329253, + "project": "django-contrib-comments" + }, + { + "download_count": 329155, + "project": "o365" + }, + { + "download_count": 328801, + "project": "panda" + }, + { + "download_count": 328625, + "project": "ed25519" + }, + { + "download_count": 327877, + "project": "pyxb" + }, + { + "download_count": 327798, + "project": "rest-condition" + }, + { + "download_count": 327008, + "project": "pandavro" + }, + { + "download_count": 326932, + "project": "flask-autoindex" + }, + { + "download_count": 326745, + "project": "jieba3k" + }, + { + "download_count": 326444, + "project": "pipfile" + }, + { + "download_count": 325679, + "project": "js2xml" + }, + { + "download_count": 325610, + "project": "freetype-py" + }, + { + "download_count": 325570, + "project": "sigopt" + }, + { + "download_count": 325566, + "project": "flask-silk" + }, + { + "download_count": 325431, + "project": "pynvim" + }, + { + "download_count": 324936, + "project": "hunspell" + }, + { + "download_count": 324782, + "project": "pytest-localserver" + }, + { + "download_count": 324466, + "project": "genshi" + }, + { + "download_count": 324252, + "project": "pyqtgraph" + }, + { + "download_count": 324239, + "project": "backport-collections" + }, + { + "download_count": 324070, + "project": "daemonize" + }, + { + "download_count": 324045, + "project": "pafy" + }, + { + "download_count": 323910, + "project": "pyvcloud" + }, + { + "download_count": 322541, + "project": "imapclient" + }, + { + "download_count": 321480, + "project": "tika" + }, + { + "download_count": 321355, + "project": "simplekv" + }, + { + "download_count": 321196, + "project": "rtslib-fb" + }, + { + "download_count": 321126, + "project": "flake8-colors" + }, + { + "download_count": 321035, + "project": "helper" + }, + { + "download_count": 320909, + "project": "guessit" + }, + { + "download_count": 320580, + "project": "ryu" + }, + { + "download_count": 320316, + "project": "salt" + }, + { + "download_count": 320262, + "project": "flexmock" + }, + { + "download_count": 320230, + "project": "pytils" + }, + { + "download_count": 320212, + "project": "phik" + }, + { + "download_count": 319164, + "project": "sphinx-bootstrap-theme" + }, + { + "download_count": 319042, + "project": "flake8-pep3101" + }, + { + "download_count": 318722, + "project": "turicreate" + }, + { + "download_count": 318705, + "project": "attr" + }, + { + "download_count": 318586, + "project": "spyder-kernels" + }, + { + "download_count": 318398, + "project": "drf-writable-nested" + }, + { + "download_count": 318092, + "project": "future-fstrings" + }, + { + "download_count": 317793, + "project": "python-mistralclient" + }, + { + "download_count": 317688, + "project": "fuzzy" + }, + { + "download_count": 317529, + "project": "pyxlsb" + }, + { + "download_count": 317467, + "project": "twitter" + }, + { + "download_count": 317447, + "project": "slumber" + }, + { + "download_count": 316898, + "project": "protobuf-to-dict" + }, + { + "download_count": 316783, + "project": "djangorestframework-recursive" + }, + { + "download_count": 316760, + "project": "treeherder-client" + }, + { + "download_count": 316758, + "project": "python-nomad" + }, + { + "download_count": 316352, + "project": "click-default-group" + }, + { + "download_count": 316307, + "project": "logzero" + }, + { + "download_count": 316290, + "project": "orionsdk" + }, + { + "download_count": 316243, + "project": "sanic-cors" + }, + { + "download_count": 316239, + "project": "fastdtw" + }, + { + "download_count": 315929, + "project": "python-moztelemetry" + }, + { + "download_count": 315911, + "project": "pytest-azurepipelines" + }, + { + "download_count": 315673, + "project": "expects" + }, + { + "download_count": 314691, + "project": "feedfinder2" + }, + { + "download_count": 314446, + "project": "multimethod" + }, + { + "download_count": 314259, + "project": "janome" + }, + { + "download_count": 314133, + "project": "voluptuous-serialize" + }, + { + "download_count": 314097, + "project": "pyculiar" + }, + { + "download_count": 314051, + "project": "mozdownload" + }, + { + "download_count": 313826, + "project": "pylzma" + }, + { + "download_count": 313796, + "project": "qtawesome" + }, + { + "download_count": 313736, + "project": "everett" + }, + { + "download_count": 313653, + "project": "coincurve" + }, + { + "download_count": 313244, + "project": "characteristic" + }, + { + "download_count": 312696, + "project": "python-can" + }, + { + "download_count": 312614, + "project": "planout" + }, + { + "download_count": 312044, + "project": "submit50" + }, + { + "download_count": 312044, + "project": "transformers" + }, + { + "download_count": 311745, + "project": "django-celery-email" + }, + { + "download_count": 311632, + "project": "check50" + }, + { + "download_count": 311531, + "project": "ansimarkup" + }, + { + "download_count": 311273, + "project": "flatdict" + }, + { + "download_count": 311140, + "project": "minimal-snowplow-tracker" + }, + { + "download_count": 311122, + "project": "python-troveclient" + }, + { + "download_count": 310826, + "project": "pycpfcnpj" + }, + { + "download_count": 310446, + "project": "python-lzf" + }, + { + "download_count": 310429, + "project": "apsw" + }, + { + "download_count": 310269, + "project": "stem" + }, + { + "download_count": 310019, + "project": "mozinstall" + }, + { + "download_count": 309655, + "project": "os-resource-classes" + }, + { + "download_count": 309355, + "project": "mimeparse" + }, + { + "download_count": 309293, + "project": "comet-ml" + }, + { + "download_count": 309286, + "project": "serpy" + }, + { + "download_count": 309092, + "project": "skimage" + }, + { + "download_count": 308894, + "project": "pandas-ml" + }, + { + "download_count": 308548, + "project": "python-magnumclient" + }, + { + "download_count": 307984, + "project": "azure-devtools" + }, + { + "download_count": 307690, + "project": "typesentry" + }, + { + "download_count": 307277, + "project": "awslogs" + }, + { + "download_count": 306928, + "project": "pytest-flakes" + }, + { + "download_count": 306784, + "project": "thespian" + }, + { + "download_count": 305826, + "project": "pykcs11" + }, + { + "download_count": 305226, + "project": "singer-python" + }, + { + "download_count": 304755, + "project": "pyprind" + }, + { + "download_count": 304717, + "project": "abbyy" + }, + { + "download_count": 304490, + "project": "flask-restful-swagger" + }, + { + "download_count": 304399, + "project": "os-api-ref" + }, + { + "download_count": 304195, + "project": "simpleitk" + }, + { + "download_count": 304060, + "project": "unicorn" + }, + { + "download_count": 304021, + "project": "jobspy" + }, + { + "download_count": 303998, + "project": "devpi-common" + }, + { + "download_count": 303970, + "project": "jsonpath" + }, + { + "download_count": 303806, + "project": "pysubnettree" + }, + { + "download_count": 303693, + "project": "hypercorn" + }, + { + "download_count": 303592, + "project": "scrapy-random-useragent" + }, + { + "download_count": 303497, + "project": "zope-schema" + }, + { + "download_count": 303260, + "project": "newspaper3k" + }, + { + "download_count": 302739, + "project": "pyspellchecker" + }, + { + "download_count": 302714, + "project": "password" + }, + { + "download_count": 302400, + "project": "testlink-api-python-client" + }, + { + "download_count": 302299, + "project": "dogpile-core" + }, + { + "download_count": 302266, + "project": "nilearn" + }, + { + "download_count": 302076, + "project": "pylibftdi" + }, + { + "download_count": 301868, + "project": "python-termstyle" + }, + { + "download_count": 301830, + "project": "pybreaker" + }, + { + "download_count": 301435, + "project": "django-wkhtmltopdf" + }, + { + "download_count": 300585, + "project": "pyxdameraulevenshtein" + }, + { + "download_count": 300425, + "project": "hpsklearn" + }, + { + "download_count": 300421, + "project": "tesserocr" + }, + { + "download_count": 300359, + "project": "django-templated-mail" + }, + { + "download_count": 300207, + "project": "comet-git-pure" + }, + { + "download_count": 299910, + "project": "httpcore" + }, + { + "download_count": 299706, + "project": "simhash" + }, + { + "download_count": 299276, + "project": "aspy-refactor-imports" + }, + { + "download_count": 298943, + "project": "fcm-django" + }, + { + "download_count": 298927, + "project": "flask-jwt" + }, + { + "download_count": 298823, + "project": "serial" + }, + { + "download_count": 298802, + "project": "binary" + }, + { + "download_count": 298544, + "project": "plaidml" + }, + { + "download_count": 298085, + "project": "python-oauth2" + }, + { + "download_count": 297969, + "project": "opencv-contrib-python-headless" + }, + { + "download_count": 297585, + "project": "djangocms-text-ckeditor" + }, + { + "download_count": 297361, + "project": "better-exceptions-fork" + }, + { + "download_count": 297253, + "project": "dynamodb-json" + }, + { + "download_count": 297052, + "project": "bitmath" + }, + { + "download_count": 296269, + "project": "condor-git-config" + }, + { + "download_count": 296162, + "project": "cornice" + }, + { + "download_count": 295986, + "project": "polyglot" + }, + { + "download_count": 295722, + "project": "pytelegrambotapi" + }, + { + "download_count": 295667, + "project": "mbed-cloud-sdk" + }, + { + "download_count": 295592, + "project": "behave-django" + }, + { + "download_count": 295509, + "project": "modernize" + }, + { + "download_count": 295419, + "project": "libusb1" + }, + { + "download_count": 295355, + "project": "edx-organizations" + }, + { + "download_count": 294743, + "project": "sendgrid-django" + }, + { + "download_count": 294453, + "project": "sniffio" + }, + { + "download_count": 294364, + "project": "slugid" + }, + { + "download_count": 294093, + "project": "pypika" + }, + { + "download_count": 293799, + "project": "oci-cli" + }, + { + "download_count": 293404, + "project": "django-rosetta" + }, + { + "download_count": 293277, + "project": "proxmoxer" + }, + { + "download_count": 292761, + "project": "anytemplate" + }, + { + "download_count": 292649, + "project": "raven-aiohttp" + }, + { + "download_count": 292327, + "project": "bbcode" + }, + { + "download_count": 292281, + "project": "protego" + }, + { + "download_count": 292277, + "project": "securesystemslib" + }, + { + "download_count": 292249, + "project": "outcome" + }, + { + "download_count": 291695, + "project": "crontab" + }, + { + "download_count": 291636, + "project": "pytelegraf" + }, + { + "download_count": 291495, + "project": "pylbfgs" + }, + { + "download_count": 291341, + "project": "asttokens" + }, + { + "download_count": 291275, + "project": "wtforms-components" + }, + { + "download_count": 291039, + "project": "elasticsearch-async" + }, + { + "download_count": 290811, + "project": "py-dateutil" + }, + { + "download_count": 290793, + "project": "buildbot-worker" + }, + { + "download_count": 290753, + "project": "atpublic" + }, + { + "download_count": 290628, + "project": "django-cleanup" + }, + { + "download_count": 290574, + "project": "urlopen" + }, + { + "download_count": 290457, + "project": "cleanco" + }, + { + "download_count": 290025, + "project": "home-assistant-frontend" + }, + { + "download_count": 289983, + "project": "azureml-widgets" + }, + { + "download_count": 289907, + "project": "pycallgraph" + }, + { + "download_count": 289633, + "project": "biplist" + }, + { + "download_count": 289587, + "project": "django-datatables-view" + }, + { + "download_count": 289573, + "project": "guppy" + }, + { + "download_count": 289366, + "project": "kaggle" + }, + { + "download_count": 289053, + "project": "ratelimiter" + }, + { + "download_count": 288392, + "project": "requests-aws" + }, + { + "download_count": 288145, + "project": "prov" + }, + { + "download_count": 288066, + "project": "xmodem" + }, + { + "download_count": 287756, + "project": "pyobjc-framework-fsevents" + }, + { + "download_count": 287736, + "project": "djangorestframework-stubs" + }, + { + "download_count": 287716, + "project": "dailymotion" + }, + { + "download_count": 287610, + "project": "airspeed" + }, + { + "download_count": 287211, + "project": "pdfminer3k" + }, + { + "download_count": 286932, + "project": "django-admin-tools" + }, + { + "download_count": 286676, + "project": "rfc3339" + }, + { + "download_count": 286568, + "project": "runlike" + }, + { + "download_count": 286494, + "project": "pyobjc-framework-systemconfiguration" + }, + { + "download_count": 286287, + "project": "flask-swagger-ui" + }, + { + "download_count": 286286, + "project": "pyrabbit" + }, + { + "download_count": 286217, + "project": "pyobjc-framework-cfnetwork" + }, + { + "download_count": 285962, + "project": "django-htmlmin" + }, + { + "download_count": 285937, + "project": "affinegap" + }, + { + "download_count": 285640, + "project": "django-smart-selects" + }, + { + "download_count": 285368, + "project": "jaraco-classes" + }, + { + "download_count": 285182, + "project": "pyjq" + }, + { + "download_count": 284862, + "project": "plaidml-keras" + }, + { + "download_count": 284806, + "project": "pyobjc-framework-webkit" + }, + { + "download_count": 284790, + "project": "jq" + }, + { + "download_count": 284781, + "project": "django-taggit-serializer" + }, + { + "download_count": 284424, + "project": "robotframework-databaselibrary" + }, + { + "download_count": 284410, + "project": "httpsig-cffi" + }, + { + "download_count": 284050, + "project": "instaloader" + }, + { + "download_count": 284049, + "project": "powerline-status" + }, + { + "download_count": 283986, + "project": "tap-py" + }, + { + "download_count": 283939, + "project": "devpi-client" + }, + { + "download_count": 283785, + "project": "banal" + }, + { + "download_count": 283663, + "project": "docx" + }, + { + "download_count": 283563, + "project": "python-geoip-geolite2" + }, + { + "download_count": 283441, + "project": "bitstruct" + }, + { + "download_count": 283402, + "project": "pyramid-jinja2" + }, + { + "download_count": 283279, + "project": "graphitesend" + }, + { + "download_count": 283227, + "project": "metafone" + }, + { + "download_count": 283149, + "project": "tinysegmenter" + }, + { + "download_count": 282747, + "project": "sqlalchemy-continuum" + }, + { + "download_count": 282696, + "project": "opencensus-ext-stackdriver" + }, + { + "download_count": 282668, + "project": "waiter" + }, + { + "download_count": 282655, + "project": "sphinx-gallery" + }, + { + "download_count": 282575, + "project": "git-pylint-commit-hook" + }, + { + "download_count": 282479, + "project": "fuzzyset" + }, + { + "download_count": 282254, + "project": "pytest-custom-exit-code" + }, + { + "download_count": 281823, + "project": "hyperas" + }, + { + "download_count": 281726, + "project": "django-simple-captcha" + }, + { + "download_count": 281640, + "project": "dynamodb-encryption-sdk" + }, + { + "download_count": 281597, + "project": "openexr" + }, + { + "download_count": 281522, + "project": "pid" + }, + { + "download_count": 281467, + "project": "irc3-plugins-test" + }, + { + "download_count": 280788, + "project": "murmurhash3" + }, + { + "download_count": 280402, + "project": "quart" + }, + { + "download_count": 280081, + "project": "salesforce-bulkipy" + }, + { + "download_count": 279935, + "project": "sphinx-argparse" + }, + { + "download_count": 279690, + "project": "pptree" + }, + { + "download_count": 279227, + "project": "djangorestframework-jsonapi" + }, + { + "download_count": 279117, + "project": "marshmallow-polyfield" + }, + { + "download_count": 278996, + "project": "tls-syslog" + }, + { + "download_count": 278801, + "project": "fastprogress" + }, + { + "download_count": 278661, + "project": "style" + }, + { + "download_count": 278616, + "project": "pyjsparser" + }, + { + "download_count": 278381, + "project": "celery-redbeat" + }, + { + "download_count": 278041, + "project": "dbutils" + }, + { + "download_count": 277922, + "project": "zvmcloudconnector" + }, + { + "download_count": 277703, + "project": "blockdiag" + }, + { + "download_count": 277555, + "project": "jsl" + }, + { + "download_count": 277355, + "project": "aiomysql" + }, + { + "download_count": 277155, + "project": "softlayer" + }, + { + "download_count": 276993, + "project": "levenshtein-search" + }, + { + "download_count": 276886, + "project": "gender-guesser" + }, + { + "download_count": 276825, + "project": "msal" + }, + { + "download_count": 276567, + "project": "sqlalchemy-stubs" + }, + { + "download_count": 276536, + "project": "pyliblzma" + }, + { + "download_count": 276486, + "project": "django-sass-processor" + }, + { + "download_count": 276464, + "project": "django-url-filter" + }, + { + "download_count": 276353, + "project": "sanic-plugins-framework" + }, + { + "download_count": 276240, + "project": "jxmlease" + }, + { + "download_count": 275861, + "project": "purl" + }, + { + "download_count": 275254, + "project": "base36" + }, + { + "download_count": 275159, + "project": "pytools" + }, + { + "download_count": 275147, + "project": "datrie" + }, + { + "download_count": 274643, + "project": "zxcvbn-python" + }, + { + "download_count": 274395, + "project": "pytest-datafiles" + }, + { + "download_count": 273920, + "project": "pyspark-stubs" + }, + { + "download_count": 273728, + "project": "natto-py" + }, + { + "download_count": 273719, + "project": "mechanicalsoup" + }, + { + "download_count": 273603, + "project": "sqlalchemy-postgres-copy" + }, + { + "download_count": 273574, + "project": "pycosat" + }, + { + "download_count": 273348, + "project": "q" + }, + { + "download_count": 273202, + "project": "backpack" + }, + { + "download_count": 273056, + "project": "gmplot" + }, + { + "download_count": 273050, + "project": "websockify" + }, + { + "download_count": 273001, + "project": "measurement" + }, + { + "download_count": 272990, + "project": "hass-nabucasa" + }, + { + "download_count": 272948, + "project": "virtualenvwrapper-win" + }, + { + "download_count": 272942, + "project": "email" + }, + { + "download_count": 272542, + "project": "pyobjc-framework-launchservices" + }, + { + "download_count": 272383, + "project": "webdriver-manager" + }, + { + "download_count": 272315, + "project": "google-oauth" + }, + { + "download_count": 272029, + "project": "django-js-reverse" + }, + { + "download_count": 271929, + "project": "meinheld" + }, + { + "download_count": 271914, + "project": "yapsy" + }, + { + "download_count": 271877, + "project": "nteract-scrapbook" + }, + { + "download_count": 271874, + "project": "mouseinfo" + }, + { + "download_count": 271864, + "project": "pyobjc-framework-exceptionhandling" + }, + { + "download_count": 271786, + "project": "dbt" + }, + { + "download_count": 271483, + "project": "django-tagging" + }, + { + "download_count": 271439, + "project": "taskcluster" + }, + { + "download_count": 271349, + "project": "evdev" + }, + { + "download_count": 270918, + "project": "dedupe-hcluster" + }, + { + "download_count": 270898, + "project": "tensor2tensor" + }, + { + "download_count": 270014, + "project": "pymacaroons" + }, + { + "download_count": 269770, + "project": "kivy-garden" + }, + { + "download_count": 269533, + "project": "nine" + }, + { + "download_count": 269249, + "project": "highered" + }, + { + "download_count": 269216, + "project": "sounddevice" + }, + { + "download_count": 268421, + "project": "docx2txt" + }, + { + "download_count": 268411, + "project": "robotframework-debuglibrary" + }, + { + "download_count": 268172, + "project": "aioamqp" + }, + { + "download_count": 268107, + "project": "cma" + }, + { + "download_count": 267772, + "project": "netstruct" + }, + { + "download_count": 267766, + "project": "pyhacrf-datamade" + }, + { + "download_count": 267588, + "project": "flake8-junit-report" + }, + { + "download_count": 267292, + "project": "wptools" + }, + { + "download_count": 266807, + "project": "bump2version" + }, + { + "download_count": 266733, + "project": "lesscpy" + }, + { + "download_count": 266561, + "project": "pytest-vcr" + }, + { + "download_count": 266544, + "project": "pyexcel-webio" + }, + { + "download_count": 266422, + "project": "maya" + }, + { + "download_count": 266355, + "project": "robotframework-xvfb" + }, + { + "download_count": 266132, + "project": "dedupe" + }, + { + "download_count": 266017, + "project": "pyminifier" + }, + { + "download_count": 265818, + "project": "winkerberos" + }, + { + "download_count": 265798, + "project": "mozanalysis" + }, + { + "download_count": 265437, + "project": "username-generator" + }, + { + "download_count": 265328, + "project": "phpserialize" + }, + { + "download_count": 265105, + "project": "crc32c" + }, + { + "download_count": 264933, + "project": "pretrainedmodels" + }, + { + "download_count": 264845, + "project": "pytest-remotedata" + }, + { + "download_count": 264729, + "project": "python-owasp-zap-v2-4" + }, + { + "download_count": 264669, + "project": "nexpose" + }, + { + "download_count": 264414, + "project": "http-parser" + }, + { + "download_count": 264412, + "project": "pyobjc-framework-diskarbitration" + }, + { + "download_count": 264322, + "project": "dsp3" + }, + { + "download_count": 264189, + "project": "rlr" + }, + { + "download_count": 263902, + "project": "pyqt5-tools" + }, + { + "download_count": 263840, + "project": "json-tricks" + }, + { + "download_count": 263390, + "project": "categorical-distance" + }, + { + "download_count": 263282, + "project": "datalab" + }, + { + "download_count": 263021, + "project": "update" + }, + { + "download_count": 262783, + "project": "blobfile" + }, + { + "download_count": 262644, + "project": "zc-buildout" + }, + { + "download_count": 262529, + "project": "dedupe-variable-datetime" + }, + { + "download_count": 262152, + "project": "simplecosine" + }, + { + "download_count": 261988, + "project": "pytest-mockito" + }, + { + "download_count": 261860, + "project": "django-otp-twilio" + }, + { + "download_count": 261797, + "project": "django-chartit" + }, + { + "download_count": 261611, + "project": "datetime-distance" + }, + { + "download_count": 260878, + "project": "jaraco-text" + }, + { + "download_count": 260837, + "project": "fastrlock" + }, + { + "download_count": 260816, + "project": "flake8-future-import" + }, + { + "download_count": 260795, + "project": "pyghmi" + }, + { + "download_count": 260576, + "project": "orator" + }, + { + "download_count": 260536, + "project": "flake8-tuple" + }, + { + "download_count": 260250, + "project": "aiocache" + }, + { + "download_count": 260202, + "project": "cli53" + }, + { + "download_count": 260043, + "project": "untokenize" + }, + { + "download_count": 259904, + "project": "newrelic-plugin-agent" + }, + { + "download_count": 259773, + "project": "pyangbind" + }, + { + "download_count": 259756, + "project": "django-pyodbc-azure" + }, + { + "download_count": 259273, + "project": "zstd" + }, + { + "download_count": 258974, + "project": "pymodbus" + }, + { + "download_count": 258942, + "project": "jupyter-spark" + }, + { + "download_count": 258875, + "project": "django-sortedm2m" + }, + { + "download_count": 258300, + "project": "python-logstash-async" + }, + { + "download_count": 258254, + "project": "django-graphql-jwt" + }, + { + "download_count": 257389, + "project": "elasticquery" + }, + { + "download_count": 257227, + "project": "python-keycloak" + }, + { + "download_count": 257086, + "project": "dbus-python" + }, + { + "download_count": 257005, + "project": "cmarkgfm" + }, + { + "download_count": 256972, + "project": "pysrt" + }, + { + "download_count": 256801, + "project": "pyobjc-framework-coreservices" + }, + { + "download_count": 256683, + "project": "django-paypal" + }, + { + "download_count": 256576, + "project": "spur" + }, + { + "download_count": 256447, + "project": "iniparse" + }, + { + "download_count": 256111, + "project": "python-terraform" + }, + { + "download_count": 255860, + "project": "djangorestframework-jsonp" + }, + { + "download_count": 255835, + "project": "rethinkdb" + }, + { + "download_count": 255719, + "project": "mozcrash" + }, + { + "download_count": 255201, + "project": "pyobjc-framework-quartz" + }, + { + "download_count": 254935, + "project": "django-organizations" + }, + { + "download_count": 254677, + "project": "django-colorfield" + }, + { + "download_count": 254646, + "project": "marshmallow-jsonapi" + }, + { + "download_count": 254107, + "project": "djangorestframework-expander" + }, + { + "download_count": 253885, + "project": "dci-utils" + }, + { + "download_count": 253884, + "project": "pql" + }, + { + "download_count": 253867, + "project": "tf-nightly-2-0-preview" + }, + { + "download_count": 253608, + "project": "django-parler" + }, + { + "download_count": 253475, + "project": "telethon" + }, + { + "download_count": 253099, + "project": "celery-once" + }, + { + "download_count": 253054, + "project": "scales" + }, + { + "download_count": 253035, + "project": "rocketchat-api" + }, + { + "download_count": 252896, + "project": "jaraco-collections" + }, + { + "download_count": 252760, + "project": "yaql" + }, + { + "download_count": 252588, + "project": "pyinquirer" + }, + { + "download_count": 252471, + "project": "django-session-security" + }, + { + "download_count": 252413, + "project": "django-rest-knox" + }, + { + "download_count": 252295, + "project": "django-redshift-backend" + }, + { + "download_count": 251901, + "project": "sphinx-markdown-tables" + }, + { + "download_count": 251862, + "project": "sceptre" + }, + { + "download_count": 251840, + "project": "py-mini-racer" + }, + { + "download_count": 251759, + "project": "python-rake" + }, + { + "download_count": 251594, + "project": "oauth2-client" + }, + { + "download_count": 251347, + "project": "env" + }, + { + "download_count": 251337, + "project": "timedelta" + }, + { + "download_count": 250784, + "project": "awkward" + }, + { + "download_count": 250362, + "project": "edx-rbac" + }, + { + "download_count": 250192, + "project": "flask-log-request-id" + }, + { + "download_count": 250110, + "project": "globre" + }, + { + "download_count": 249752, + "project": "django-easy-pdf" + }, + { + "download_count": 249646, + "project": "prettyexc" + }, + { + "download_count": 249416, + "project": "django-notifications-hq" + }, + { + "download_count": 249316, + "project": "mozleak" + }, + { + "download_count": 249286, + "project": "autograd-gamma" + }, + { + "download_count": 249216, + "project": "flask-injector" + }, + { + "download_count": 249101, + "project": "holoviews" + }, + { + "download_count": 249064, + "project": "inflector" + }, + { + "download_count": 248895, + "project": "django-honeypot" + }, + { + "download_count": 248839, + "project": "pip-api" + }, + { + "download_count": 248670, + "project": "pytest-testmon" + }, + { + "download_count": 248527, + "project": "pycapnp" + }, + { + "download_count": 248395, + "project": "pgpy" + }, + { + "download_count": 248134, + "project": "pretend" + }, + { + "download_count": 247952, + "project": "webhelpers" + }, + { + "download_count": 247612, + "project": "iso4217" + }, + { + "download_count": 247588, + "project": "chargebee" + }, + { + "download_count": 247194, + "project": "logging-tree" + }, + { + "download_count": 247097, + "project": "bcolz" + }, + { + "download_count": 247095, + "project": "pydomo" + }, + { + "download_count": 247093, + "project": "pyviz-comms" + }, + { + "download_count": 246905, + "project": "pyes" + }, + { + "download_count": 246637, + "project": "patool" + }, + { + "download_count": 246609, + "project": "django-saml2-auth" + }, + { + "download_count": 246442, + "project": "lorem" + }, + { + "download_count": 246345, + "project": "kociemba" + }, + { + "download_count": 245924, + "project": "nylas" + }, + { + "download_count": 245599, + "project": "urlparse3" + }, + { + "download_count": 245592, + "project": "pytest-tornado" + }, + { + "download_count": 245425, + "project": "inject" + }, + { + "download_count": 244242, + "project": "tabledata" + }, + { + "download_count": 244197, + "project": "percy" + }, + { + "download_count": 243680, + "project": "snitun" + }, + { + "download_count": 243665, + "project": "django-debug-toolbar-line-profiler" + }, + { + "download_count": 243077, + "project": "bottlenose" + }, + { + "download_count": 242781, + "project": "infi-clickhouse-orm" + }, + { + "download_count": 242659, + "project": "reppy" + }, + { + "download_count": 242378, + "project": "in-toto" + }, + { + "download_count": 242112, + "project": "azureml" + }, + { + "download_count": 242067, + "project": "django-common-helpers" + }, + { + "download_count": 241994, + "project": "django-hijack-admin" + }, + { + "download_count": 241868, + "project": "cmreshandler" + }, + { + "download_count": 241645, + "project": "ruptures" + }, + { + "download_count": 241594, + "project": "goslate" + }, + { + "download_count": 241370, + "project": "aggdraw" + }, + { + "download_count": 241223, + "project": "django-boto" + }, + { + "download_count": 240546, + "project": "svn" + }, + { + "download_count": 240121, + "project": "ssh" + }, + { + "download_count": 240049, + "project": "py3dns" + }, + { + "download_count": 239971, + "project": "pymonkey" + }, + { + "download_count": 239838, + "project": "great-expectations" + }, + { + "download_count": 239830, + "project": "pip-custom-platform" + }, + { + "download_count": 239729, + "project": "django-libsass" + }, + { + "download_count": 239683, + "project": "mirakuru" + }, + { + "download_count": 239680, + "project": "microsoftgraph-python" + }, + { + "download_count": 239524, + "project": "gnocchiclient" + }, + { + "download_count": 239407, + "project": "pyct" + }, + { + "download_count": 239390, + "project": "ansible-runner" + }, + { + "download_count": 239360, + "project": "dbt-core" + }, + { + "download_count": 239183, + "project": "hellosign-python-sdk" + }, + { + "download_count": 239095, + "project": "pyaudioanalysis" + }, + { + "download_count": 239001, + "project": "reportportal-client" + }, + { + "download_count": 238983, + "project": "itunes-iap" + }, + { + "download_count": 238603, + "project": "terminalone" + }, + { + "download_count": 238597, + "project": "snaptime" + }, + { + "download_count": 238394, + "project": "aiormq" + }, + { + "download_count": 238154, + "project": "djangocms-attributes-field" + }, + { + "download_count": 238141, + "project": "django-versatileimagefield" + }, + { + "download_count": 237972, + "project": "django-push-notifications" + }, + { + "download_count": 237750, + "project": "transliterate" + }, + { + "download_count": 237652, + "project": "whaaaaat" + }, + { + "download_count": 237622, + "project": "django-sslify" + }, + { + "download_count": 237558, + "project": "towncrier" + }, + { + "download_count": 237018, + "project": "py-lz4framed" + }, + { + "download_count": 236912, + "project": "uproot-methods" + }, + { + "download_count": 236619, + "project": "django-statici18n" + }, + { + "download_count": 236529, + "project": "pytd" + }, + { + "download_count": 236270, + "project": "pep517" + }, + { + "download_count": 236180, + "project": "py-ecc" + }, + { + "download_count": 236180, + "project": "layered-yaml-attrdict-config" + }, + { + "download_count": 235952, + "project": "varint" + }, + { + "download_count": 235921, + "project": "spotipy" + }, + { + "download_count": 235732, + "project": "django-markdown-deux" + }, + { + "download_count": 235635, + "project": "geventhttpclient-wheels" + }, + { + "download_count": 235481, + "project": "parallel-ssh" + }, + { + "download_count": 235241, + "project": "event-tracking" + }, + { + "download_count": 234835, + "project": "jupyterthemes" + }, + { + "download_count": 234721, + "project": "django-pandas" + }, + { + "download_count": 234582, + "project": "stackprinter" + }, + { + "download_count": 234393, + "project": "probablepeople" + }, + { + "download_count": 234334, + "project": "flake8-eradicate" + }, + { + "download_count": 234277, + "project": "mode" + }, + { + "download_count": 234271, + "project": "asset" + }, + { + "download_count": 234150, + "project": "loggly-python-handler" + }, + { + "download_count": 233705, + "project": "supervisor-wildcards" + }, + { + "download_count": 233601, + "project": "edx-bulk-grades" + }, + { + "download_count": 233407, + "project": "glean-parser" + }, + { + "download_count": 233242, + "project": "morfessor" + }, + { + "download_count": 233191, + "project": "pyzbar" + }, + { + "download_count": 232874, + "project": "nbstripout" + }, + { + "download_count": 232838, + "project": "mnemonic" + }, + { + "download_count": 232704, + "project": "pyeclib" + }, + { + "download_count": 232607, + "project": "flask-sockets" + }, + { + "download_count": 232578, + "project": "esrally" + }, + { + "download_count": 232565, + "project": "django-crontab" + }, + { + "download_count": 232517, + "project": "standardjson" + }, + { + "download_count": 232389, + "project": "sphinxcontrib-svg2pdfconverter" + }, + { + "download_count": 232208, + "project": "jep" + }, + { + "download_count": 231947, + "project": "contractions" + }, + { + "download_count": 231914, + "project": "hashlib" + }, + { + "download_count": 231894, + "project": "hdrhistogram" + }, + { + "download_count": 231873, + "project": "pydoe" + }, + { + "download_count": 231818, + "project": "colorhash" + }, + { + "download_count": 231678, + "project": "venv-update" + }, + { + "download_count": 231678, + "project": "pytidylib" + }, + { + "download_count": 231634, + "project": "sas7bdat" + }, + { + "download_count": 231555, + "project": "pybrain" + }, + { + "download_count": 231491, + "project": "locust" + }, + { + "download_count": 231449, + "project": "easygui" + }, + { + "download_count": 231322, + "project": "pytest-qt" + }, + { + "download_count": 231297, + "project": "prance" + }, + { + "download_count": 231250, + "project": "nose-ignore-docstring" + }, + { + "download_count": 231113, + "project": "snakeviz" + }, + { + "download_count": 231027, + "project": "pygaljs" + }, + { + "download_count": 230954, + "project": "rainbow-saddle" + }, + { + "download_count": 230879, + "project": "wsgiref" + }, + { + "download_count": 230659, + "project": "django-config-models" + }, + { + "download_count": 230631, + "project": "django-partial-index" + }, + { + "download_count": 230614, + "project": "restrictedpython" + }, + { + "download_count": 230470, + "project": "consulate" + }, + { + "download_count": 230441, + "project": "django-s3-storage" + }, + { + "download_count": 230436, + "project": "jenkins" + }, + { + "download_count": 230427, + "project": "mtranslate" + }, + { + "download_count": 230393, + "project": "aiosmtplib" + }, + { + "download_count": 230248, + "project": "django-statsd-mozilla" + }, + { + "download_count": 229850, + "project": "ffmpeg" + }, + { + "download_count": 229620, + "project": "django-ranged-response" + }, + { + "download_count": 229579, + "project": "pytest-cover" + }, + { + "download_count": 229403, + "project": "flexget" + }, + { + "download_count": 229292, + "project": "django-cachalot" + }, + { + "download_count": 229142, + "project": "django-activity-stream" + }, + { + "download_count": 229046, + "project": "daemonocle" + }, + { + "download_count": 228702, + "project": "mimerender" + }, + { + "download_count": 228552, + "project": "mathematics-dataset" + }, + { + "download_count": 228521, + "project": "money" + }, + { + "download_count": 228488, + "project": "flake8-formatter-junit-xml" + }, + { + "download_count": 228281, + "project": "python-vagrant" + }, + { + "download_count": 228240, + "project": "parquet" + }, + { + "download_count": 228235, + "project": "asciimatics" + }, + { + "download_count": 228066, + "project": "singleton-decorator" + }, + { + "download_count": 228004, + "project": "petl" + }, + { + "download_count": 227997, + "project": "dogpile" + }, + { + "download_count": 227746, + "project": "beaver" + }, + { + "download_count": 227738, + "project": "dbt-postgres" + }, + { + "download_count": 227570, + "project": "patch-ng" + }, + { + "download_count": 227212, + "project": "pytest-replay" + }, + { + "download_count": 227202, + "project": "django-settings-export" + }, + { + "download_count": 227048, + "project": "traittypes" + }, + { + "download_count": 227010, + "project": "ipcalc" + }, + { + "download_count": 226931, + "project": "django-elasticache" + }, + { + "download_count": 226656, + "project": "pywsd" + }, + { + "download_count": 226426, + "project": "flask-kvsession" + }, + { + "download_count": 226328, + "project": "pytest-logging" + }, + { + "download_count": 226143, + "project": "java-random" + }, + { + "download_count": 226134, + "project": "flask-seasurf" + }, + { + "download_count": 226129, + "project": "posix-ipc" + }, + { + "download_count": 226063, + "project": "zconfig" + }, + { + "download_count": 225964, + "project": "flask-uuid" + }, + { + "download_count": 225932, + "project": "djangorestframework-oauth" + }, + { + "download_count": 225898, + "project": "nest-asyncio" + }, + { + "download_count": 225852, + "project": "flock" + }, + { + "download_count": 225551, + "project": "taskcluster-urls" + }, + { + "download_count": 225391, + "project": "cntk" + }, + { + "download_count": 224972, + "project": "lolcat" + }, + { + "download_count": 224933, + "project": "pyramid-beaker" + }, + { + "download_count": 224799, + "project": "pytest-allure-adaptor" + }, + { + "download_count": 224606, + "project": "openapi-core" + }, + { + "download_count": 224528, + "project": "jaraco-itertools" + }, + { + "download_count": 224426, + "project": "emcee" + }, + { + "download_count": 224246, + "project": "trio" + }, + { + "download_count": 224218, + "project": "plotly-express" + }, + { + "download_count": 224064, + "project": "hexdump" + }, + { + "download_count": 224043, + "project": "binpacking" + }, + { + "download_count": 224021, + "project": "babelfish" + }, + { + "download_count": 223853, + "project": "bincrafters-package-tools" + }, + { + "download_count": 223736, + "project": "edx-rest-api-client" + }, + { + "download_count": 223721, + "project": "rstcheck" + }, + { + "download_count": 223494, + "project": "pylogo" + }, + { + "download_count": 223248, + "project": "h2o-pysparkling-2-3" + }, + { + "download_count": 223214, + "project": "pybloom" + }, + { + "download_count": 222931, + "project": "python3-memcached" + }, + { + "download_count": 222858, + "project": "conda" + }, + { + "download_count": 222781, + "project": "confusable-homoglyphs" + }, + { + "download_count": 222739, + "project": "loky" + }, + { + "download_count": 222684, + "project": "super-csv" + }, + { + "download_count": 222634, + "project": "jprops" + }, + { + "download_count": 222587, + "project": "keyvaultlib" + }, + { + "download_count": 222554, + "project": "fbmessenger" + }, + { + "download_count": 222508, + "project": "wiremock" + }, + { + "download_count": 222412, + "project": "django-prettyjson" + }, + { + "download_count": 222176, + "project": "hug" + }, + { + "download_count": 222175, + "project": "mws" + }, + { + "download_count": 221970, + "project": "dash-daq" + }, + { + "download_count": 221895, + "project": "slycot" + }, + { + "download_count": 221892, + "project": "flask-uploads" + }, + { + "download_count": 221647, + "project": "alooma" + }, + { + "download_count": 221631, + "project": "muffnn" + }, + { + "download_count": 221604, + "project": "python-gettext" + }, + { + "download_count": 221598, + "project": "civisml-extensions" + }, + { + "download_count": 221440, + "project": "jaydebeapi3" + }, + { + "download_count": 221407, + "project": "scikit-plot" + }, + { + "download_count": 220993, + "project": "twitter-ads" + }, + { + "download_count": 220495, + "project": "pandoc" + }, + { + "download_count": 220301, + "project": "nplusone" + }, + { + "download_count": 220198, + "project": "sudachipy" + }, + { + "download_count": 220107, + "project": "django-render-block" + }, + { + "download_count": 219983, + "project": "pyrebase" + }, + { + "download_count": 219731, + "project": "fabric2" + }, + { + "download_count": 219711, + "project": "cloudfoundry-client" + }, + { + "download_count": 219544, + "project": "edx-completion" + }, + { + "download_count": 219404, + "project": "tabulator" + }, + { + "download_count": 219376, + "project": "django-cron" + }, + { + "download_count": 219261, + "project": "sk-video" + }, + { + "download_count": 219216, + "project": "zope-i18nmessageid" + }, + { + "download_count": 218973, + "project": "colorful" + }, + { + "download_count": 218307, + "project": "s4cmd" + }, + { + "download_count": 218171, + "project": "pychromecast" + }, + { + "download_count": 218073, + "project": "pyvisa" + }, + { + "download_count": 217824, + "project": "bok-choy" + }, + { + "download_count": 217614, + "project": "py-zipkin" + }, + { + "download_count": 217311, + "project": "ansible-modules-hashivault" + }, + { + "download_count": 217201, + "project": "datefinder" + }, + { + "download_count": 217188, + "project": "json-logic-qubit" + }, + { + "download_count": 216980, + "project": "sparse-dot-topn" + }, + { + "download_count": 216825, + "project": "flask-dance" + }, + { + "download_count": 216707, + "project": "aiml" + }, + { + "download_count": 216645, + "project": "certipy" + }, + { + "download_count": 216205, + "project": "area" + }, + { + "download_count": 216115, + "project": "sphinx-click" + }, + { + "download_count": 215902, + "project": "pylint-common" + }, + { + "download_count": 215763, + "project": "stompest" + }, + { + "download_count": 215715, + "project": "questionary" + }, + { + "download_count": 215011, + "project": "lupa" + }, + { + "download_count": 214880, + "project": "usbinfo" + }, + { + "download_count": 214864, + "project": "marshmallow-objects" + }, + { + "download_count": 214855, + "project": "django-encrypted-filefield" + }, + { + "download_count": 214793, + "project": "kerberos" + }, + { + "download_count": 214757, + "project": "isim" + }, + { + "download_count": 214507, + "project": "flask-moment" + }, + { + "download_count": 214468, + "project": "boto3-session-cache" + }, + { + "download_count": 214280, + "project": "yacs" + }, + { + "download_count": 214088, + "project": "bigquery-python" + }, + { + "download_count": 213952, + "project": "mobly" + }, + { + "download_count": 213688, + "project": "pyethash" + }, + { + "download_count": 213494, + "project": "django-colorful" + }, + { + "download_count": 213445, + "project": "ics" + }, + { + "download_count": 213185, + "project": "eyes-selenium" + }, + { + "download_count": 213156, + "project": "zdesk" + }, + { + "download_count": 213151, + "project": "requests-credssp" + }, + { + "download_count": 213071, + "project": "autosemver" + }, + { + "download_count": 212879, + "project": "ffx" + }, + { + "download_count": 212740, + "project": "wn" + }, + { + "download_count": 212739, + "project": "linear-tsv" + }, + { + "download_count": 212738, + "project": "webexteamssdk" + }, + { + "download_count": 212640, + "project": "circus" + }, + { + "download_count": 212529, + "project": "multiaddr" + }, + { + "download_count": 212516, + "project": "zipcode" + }, + { + "download_count": 212435, + "project": "dbt-bigquery" + }, + { + "download_count": 212295, + "project": "androguard" + }, + { + "download_count": 212275, + "project": "gapic-google-cloud-spanner-v1" + }, + { + "download_count": 212211, + "project": "gapic-google-cloud-spanner-admin-database-v1" + }, + { + "download_count": 212204, + "project": "gapic-google-cloud-spanner-admin-instance-v1" + }, + { + "download_count": 212074, + "project": "proto-google-cloud-spanner-v1" + }, + { + "download_count": 211988, + "project": "pip-review" + }, + { + "download_count": 211861, + "project": "passwordmeter" + }, + { + "download_count": 211783, + "project": "dbt-redshift" + }, + { + "download_count": 211766, + "project": "proto-google-cloud-spanner-admin-database-v1" + }, + { + "download_count": 211758, + "project": "proto-google-cloud-spanner-admin-instance-v1" + }, + { + "download_count": 211695, + "project": "python-prctl" + }, + { + "download_count": 211523, + "project": "dbt-snowflake" + }, + { + "download_count": 211483, + "project": "aws-kinesis-agg" + }, + { + "download_count": 211368, + "project": "pwntools" + }, + { + "download_count": 211309, + "project": "fs-s3fs" + }, + { + "download_count": 211286, + "project": "cloudshell-automation-api" + }, + { + "download_count": 211188, + "project": "postgres" + }, + { + "download_count": 211130, + "project": "pymeta3" + }, + { + "download_count": 210970, + "project": "robotframework-jsonlibrary" + }, + { + "download_count": 210929, + "project": "conllu" + }, + { + "download_count": 210633, + "project": "rpi-gpio" + }, + { + "download_count": 210596, + "project": "aresponses" + }, + { + "download_count": 210520, + "project": "textacy" + }, + { + "download_count": 210501, + "project": "djangocms-link" + }, + { + "download_count": 210080, + "project": "uproot" + }, + { + "download_count": 209987, + "project": "django-fsm-admin" + }, + { + "download_count": 209975, + "project": "anybadge" + }, + { + "download_count": 209424, + "project": "clearbit" + }, + { + "download_count": 209150, + "project": "fakenewsredis" + }, + { + "download_count": 209126, + "project": "sdnotify" + }, + { + "download_count": 209028, + "project": "python-baseconv" + }, + { + "download_count": 208950, + "project": "pytest-dotenv" + }, + { + "download_count": 208654, + "project": "pytest-logger" + }, + { + "download_count": 208524, + "project": "c7n" + }, + { + "download_count": 208338, + "project": "webium" + }, + { + "download_count": 208232, + "project": "eliot" + }, + { + "download_count": 208191, + "project": "anaconda" + }, + { + "download_count": 208167, + "project": "zope-configuration" + }, + { + "download_count": 208131, + "project": "talon" + }, + { + "download_count": 208092, + "project": "django-split-settings" + }, + { + "download_count": 207912, + "project": "elasticsearch6" + }, + { + "download_count": 207665, + "project": "cx-freeze" + }, + { + "download_count": 207551, + "project": "pyclipper" + }, + { + "download_count": 207474, + "project": "duo-web" + }, + { + "download_count": 207412, + "project": "django-easy-select2" + }, + { + "download_count": 207319, + "project": "pytricia" + }, + { + "download_count": 207241, + "project": "pyecharts" + }, + { + "download_count": 207068, + "project": "zendesk" + }, + { + "download_count": 206988, + "project": "zodbpickle" + }, + { + "download_count": 206923, + "project": "scout-apm" + }, + { + "download_count": 206832, + "project": "contexttimer" + }, + { + "download_count": 206379, + "project": "ngxtop" + }, + { + "download_count": 206215, + "project": "python-xmp-toolkit" + }, + { + "download_count": 205992, + "project": "redlock" + }, + { + "download_count": 205889, + "project": "smartypants" + }, + { + "download_count": 205562, + "project": "flake8-coding" + }, + { + "download_count": 205284, + "project": "zodb" + }, + { + "download_count": 205270, + "project": "django-reversion-compare" + }, + { + "download_count": 205192, + "project": "html-linter" + }, + { + "download_count": 205141, + "project": "client" + }, + { + "download_count": 205070, + "project": "backports-shutil-which" + }, + { + "download_count": 204937, + "project": "frida" + }, + { + "download_count": 204809, + "project": "dawg-python" + }, + { + "download_count": 204696, + "project": "django-transaction-hooks" + }, + { + "download_count": 204486, + "project": "aiotask-context" + }, + { + "download_count": 204328, + "project": "lazy-property" + }, + { + "download_count": 204268, + "project": "urlparse2" + }, + { + "download_count": 204251, + "project": "template-remover" + }, + { + "download_count": 204130, + "project": "pyttsx3" + }, + { + "download_count": 204053, + "project": "mesh-tensorflow" + }, + { + "download_count": 203892, + "project": "django-crum" + }, + { + "download_count": 203786, + "project": "asciitree" + }, + { + "download_count": 203548, + "project": "flake8-deprecated" + }, + { + "download_count": 203495, + "project": "weberror" + }, + { + "download_count": 203493, + "project": "shudder" + }, + { + "download_count": 203310, + "project": "dash-auth" + }, + { + "download_count": 203161, + "project": "rasa-nlu" + }, + { + "download_count": 203073, + "project": "conf-d" + }, + { + "download_count": 202765, + "project": "django-slack" + }, + { + "download_count": 202648, + "project": "pocketsphinx" + }, + { + "download_count": 202044, + "project": "pydivert" + }, + { + "download_count": 202007, + "project": "blosc" + }, + { + "download_count": 201958, + "project": "zipstream" + }, + { + "download_count": 201831, + "project": "parallel-sync" + }, + { + "download_count": 201651, + "project": "pycuda" + }, + { + "download_count": 201622, + "project": "ta-lib" + }, + { + "download_count": 201459, + "project": "jmxquery" + }, + { + "download_count": 201457, + "project": "tabula-py" + }, + { + "download_count": 201395, + "project": "pytest-flask-sqlalchemy" + }, + { + "download_count": 201101, + "project": "collectd" + }, + { + "download_count": 201096, + "project": "django-rest-multiple-models" + }, + { + "download_count": 201084, + "project": "pyobjc-framework-coretext" + }, + { + "download_count": 200633, + "project": "smart-getenv" + }, + { + "download_count": 200507, + "project": "pyramid-retry" + }, + { + "download_count": 200444, + "project": "codeclimate-test-reporter" + }, + { + "download_count": 200411, + "project": "publicsuffixlist" + }, + { + "download_count": 200394, + "project": "algoliasearch-django" + }, + { + "download_count": 200267, + "project": "pytest-salt" + }, + { + "download_count": 200235, + "project": "pytest-doctestplus" + }, + { + "download_count": 200035, + "project": "zope-lifecycleevent" + }, + { + "download_count": 199808, + "project": "python-zaqarclient" + }, + { + "download_count": 199774, + "project": "iniherit" + }, + { + "download_count": 199753, + "project": "pymorphy2-dicts" + }, + { + "download_count": 199695, + "project": "hanging-threads" + }, + { + "download_count": 199645, + "project": "flask-classful" + }, + { + "download_count": 199602, + "project": "pyrad" + }, + { + "download_count": 199568, + "project": "jsoncompare" + }, + { + "download_count": 199376, + "project": "python-graph-core" + }, + { + "download_count": 199234, + "project": "flask-mysqldb" + }, + { + "download_count": 199123, + "project": "pymorphy2" + }, + { + "download_count": 199116, + "project": "uncertainties" + }, + { + "download_count": 198904, + "project": "jdatetime" + }, + { + "download_count": 198768, + "project": "package" + }, + { + "download_count": 198699, + "project": "django-user-sessions" + }, + { + "download_count": 198662, + "project": "jproperties" + }, + { + "download_count": 198655, + "project": "optional-django" + }, + { + "download_count": 198573, + "project": "azure-mgmt-common" + }, + { + "download_count": 198386, + "project": "csscompressor" + }, + { + "download_count": 198360, + "project": "robotframework-lint" + }, + { + "download_count": 198297, + "project": "bintrees" + }, + { + "download_count": 198099, + "project": "esptool" + }, + { + "download_count": 198014, + "project": "sox" + }, + { + "download_count": 197847, + "project": "cotyledon" + }, + { + "download_count": 197484, + "project": "kafka-utils" + }, + { + "download_count": 197448, + "project": "pingparsing" + }, + { + "download_count": 197436, + "project": "semidbm" + }, + { + "download_count": 197405, + "project": "polyaxon-schemas" + }, + { + "download_count": 196830, + "project": "python-mozaggregator" + }, + { + "download_count": 196757, + "project": "pandas-summary" + }, + { + "download_count": 196390, + "project": "nbval" + }, + { + "download_count": 196154, + "project": "python3-xlib" + }, + { + "download_count": 195862, + "project": "pyobjc-framework-coredata" + }, + { + "download_count": 195697, + "project": "django-json-widget" + }, + { + "download_count": 194638, + "project": "trimesh" + }, + { + "download_count": 194604, + "project": "pyobjc-framework-addressbook" + }, + { + "download_count": 194552, + "project": "sq-blocks" + }, + { + "download_count": 194524, + "project": "simple-crypt" + }, + { + "download_count": 194469, + "project": "imgkit" + }, + { + "download_count": 194216, + "project": "pytype" + }, + { + "download_count": 193866, + "project": "aiohttp-session" + }, + { + "download_count": 193810, + "project": "lib" + }, + { + "download_count": 193713, + "project": "pyobjc-framework-screensaver" + }, + { + "download_count": 193702, + "project": "remote-pdb" + }, + { + "download_count": 193646, + "project": "pyobjc-framework-syncservices" + }, + { + "download_count": 193463, + "project": "pyobjc-framework-scriptingbridge" + }, + { + "download_count": 193206, + "project": "glmnet-py" + }, + { + "download_count": 193173, + "project": "edx-django-release-util" + }, + { + "download_count": 193118, + "project": "pyobjc-framework-corelocation" + }, + { + "download_count": 193105, + "project": "pyobjc-framework-inputmethodkit" + }, + { + "download_count": 193099, + "project": "lob" + }, + { + "download_count": 192939, + "project": "deb-pkg-tools" + }, + { + "download_count": 192929, + "project": "traits" + }, + { + "download_count": 192741, + "project": "django-revproxy" + }, + { + "download_count": 192721, + "project": "edx-submissions" + }, + { + "download_count": 192662, + "project": "simpy" + }, + { + "download_count": 192636, + "project": "ebooklib" + }, + { + "download_count": 192632, + "project": "importlab" + }, + { + "download_count": 192581, + "project": "tweet-preprocessor" + }, + { + "download_count": 192462, + "project": "eight" + }, + { + "download_count": 192349, + "project": "edx-when" + }, + { + "download_count": 192282, + "project": "telepot" + }, + { + "download_count": 192227, + "project": "django-recaptcha2" + }, + { + "download_count": 192174, + "project": "fastjsonschema" + }, + { + "download_count": 191971, + "project": "rebulk" + }, + { + "download_count": 191767, + "project": "zope-dottedname" + }, + { + "download_count": 191702, + "project": "cli-proton-python" + }, + { + "download_count": 191581, + "project": "schema-salad" + }, + { + "download_count": 191533, + "project": "progressbar33" + }, + { + "download_count": 191495, + "project": "libnacl" + }, + { + "download_count": 191407, + "project": "mattermostwrapper" + }, + { + "download_count": 191403, + "project": "mox" + }, + { + "download_count": 191379, + "project": "esprima" + }, + { + "download_count": 191100, + "project": "tf-nightly-gpu" + }, + { + "download_count": 191091, + "project": "python-firebase" + }, + { + "download_count": 190890, + "project": "flake8-bandit" + }, + { + "download_count": 190752, + "project": "python3-logstash" + }, + { + "download_count": 190743, + "project": "pyutilib" + }, + { + "download_count": 190491, + "project": "easypost" + }, + { + "download_count": 190474, + "project": "web-fragments" + }, + { + "download_count": 190430, + "project": "pytest-coverage" + }, + { + "download_count": 190275, + "project": "mailjet-rest" + }, + { + "download_count": 190267, + "project": "riemann-client" + }, + { + "download_count": 190168, + "project": "pytest-test-groups" + }, + { + "download_count": 189997, + "project": "dialogflow" + }, + { + "download_count": 189912, + "project": "tableschema" + }, + { + "download_count": 189480, + "project": "segtok" + }, + { + "download_count": 189475, + "project": "contentful" + }, + { + "download_count": 189290, + "project": "ropgadget" + }, + { + "download_count": 189289, + "project": "user-agent" + }, + { + "download_count": 189193, + "project": "django-profiler" + }, + { + "download_count": 189156, + "project": "devstack-tools" + }, + { + "download_count": 188865, + "project": "django-leaflet" + }, + { + "download_count": 188683, + "project": "datetime-truncate" + }, + { + "download_count": 188451, + "project": "pyjslint" + }, + { + "download_count": 188348, + "project": "dvc" + }, + { + "download_count": 188172, + "project": "zope-cachedescriptors" + }, + { + "download_count": 188122, + "project": "onetoken" + }, + { + "download_count": 188063, + "project": "ipfshttpclient" + }, + { + "download_count": 187976, + "project": "azure-functions" + }, + { + "download_count": 187875, + "project": "optimizely-sdk" + }, + { + "download_count": 187858, + "project": "cwltool" + }, + { + "download_count": 187574, + "project": "seqdiag" + }, + { + "download_count": 187547, + "project": "libthumbor" + }, + { + "download_count": 187440, + "project": "atlassian-python-api" + }, + { + "download_count": 187397, + "project": "pyobjc-framework-corewlan" + }, + { + "download_count": 187363, + "project": "azure-cli-natgateway" + }, + { + "download_count": 187117, + "project": "pyobjc-framework-imagecapturecore" + }, + { + "download_count": 186984, + "project": "django-hosts" + }, + { + "download_count": 186865, + "project": "pytest-reportportal" + }, + { + "download_count": 186711, + "project": "pyobjc-framework-avfoundation" + }, + { + "download_count": 186705, + "project": "pyobjc-framework-corebluetooth" + }, + { + "download_count": 186590, + "project": "glog" + }, + { + "download_count": 186547, + "project": "pyobjc-framework-mapkit" + }, + { + "download_count": 186536, + "project": "pyobjc-framework-avkit" + }, + { + "download_count": 186474, + "project": "pyobjc-framework-storekit" + }, + { + "download_count": 186445, + "project": "pypom" + }, + { + "download_count": 186363, + "project": "pyobjc-framework-multipeerconnectivity" + }, + { + "download_count": 186349, + "project": "pyobjc-framework-scenekit" + }, + { + "download_count": 186324, + "project": "richenum" + }, + { + "download_count": 186299, + "project": "pyobjc-framework-imserviceplugin" + }, + { + "download_count": 186260, + "project": "pyobjc-framework-gamecenter" + }, + { + "download_count": 186239, + "project": "boto3-type-annotations-with-docs" + }, + { + "download_count": 186229, + "project": "pyobjc-framework-spritekit" + }, + { + "download_count": 186187, + "project": "pyobjc-framework-notificationcenter" + }, + { + "download_count": 186170, + "project": "salttesting" + }, + { + "download_count": 186131, + "project": "you-get" + }, + { + "download_count": 186067, + "project": "pyobjc-framework-cryptotokenkit" + }, + { + "download_count": 186058, + "project": "pytest-catchlog" + }, + { + "download_count": 185930, + "project": "iptcinfo" + }, + { + "download_count": 185874, + "project": "hashin" + }, + { + "download_count": 185785, + "project": "colormath" + }, + { + "download_count": 185776, + "project": "nanotime" + }, + { + "download_count": 185712, + "project": "python-saharaclient" + }, + { + "download_count": 185687, + "project": "yanc" + }, + { + "download_count": 185684, + "project": "methodtools" + }, + { + "download_count": 185575, + "project": "pytest-openfiles" + }, + { + "download_count": 185568, + "project": "zope-security" + }, + { + "download_count": 185489, + "project": "django-crequest" + }, + { + "download_count": 185383, + "project": "pymemoize" + }, + { + "download_count": 185321, + "project": "django-fsm-log" + }, + { + "download_count": 185307, + "project": "django-warrant" + }, + { + "download_count": 185226, + "project": "acora" + }, + { + "download_count": 184984, + "project": "python-hpilo" + }, + { + "download_count": 184866, + "project": "zope-exceptions" + }, + { + "download_count": 184842, + "project": "ase" + }, + { + "download_count": 184834, + "project": "django-debug-toolbar-request-history" + }, + { + "download_count": 184816, + "project": "clipboard" + }, + { + "download_count": 184780, + "project": "manifest-tool" + }, + { + "download_count": 184769, + "project": "pdftotext" + }, + { + "download_count": 184767, + "project": "events" + }, + { + "download_count": 184609, + "project": "zope-contenttype" + }, + { + "download_count": 184473, + "project": "django-discover-runner" + }, + { + "download_count": 184469, + "project": "libtiff" + }, + { + "download_count": 184406, + "project": "sqlacodegen" + }, + { + "download_count": 184172, + "project": "pyomo" + }, + { + "download_count": 184107, + "project": "django-admin-sortable" + }, + { + "download_count": 183722, + "project": "oic" + }, + { + "download_count": 183626, + "project": "django-user-tasks" + }, + { + "download_count": 183425, + "project": "edx-lint" + }, + { + "download_count": 183383, + "project": "netfilterqueue" + }, + { + "download_count": 183355, + "project": "zope-location" + }, + { + "download_count": 183073, + "project": "pyobjc-framework-qtkit" + }, + { + "download_count": 183058, + "project": "apispec-webframeworks" + }, + { + "download_count": 183054, + "project": "django-dbbackup" + }, + { + "download_count": 182995, + "project": "interpret-core" + }, + { + "download_count": 182971, + "project": "docker-compose-wait" + }, + { + "download_count": 182913, + "project": "socketpool" + }, + { + "download_count": 182775, + "project": "qgrid" + }, + { + "download_count": 182678, + "project": "localstack-ext" + }, + { + "download_count": 182643, + "project": "munkres" + }, + { + "download_count": 182633, + "project": "django-admin-list-filter-dropdown" + }, + { + "download_count": 182500, + "project": "edx-ccx-keys" + }, + { + "download_count": 182205, + "project": "jsonrpclib" + }, + { + "download_count": 182178, + "project": "pyinstrument-cext" + }, + { + "download_count": 182161, + "project": "wsgiproxy2" + }, + { + "download_count": 182080, + "project": "msgfy" + }, + { + "download_count": 182061, + "project": "localstack" + }, + { + "download_count": 182033, + "project": "mpl-finance" + }, + { + "download_count": 182028, + "project": "sinon" + }, + { + "download_count": 181902, + "project": "pyobjc-framework-photos" + }, + { + "download_count": 181883, + "project": "pyobjc-framework-contacts" + }, + { + "download_count": 181832, + "project": "pyobjc-framework-safariservices" + }, + { + "download_count": 181822, + "project": "nagiosplugin" + }, + { + "download_count": 181811, + "project": "hbmqtt" + }, + { + "download_count": 181809, + "project": "pyobjc-framework-photosui" + }, + { + "download_count": 181782, + "project": "rfc6266" + }, + { + "download_count": 181770, + "project": "wtforms-alchemy" + }, + { + "download_count": 181753, + "project": "pyobjc-framework-modelio" + }, + { + "download_count": 181752, + "project": "gocardless-pro" + }, + { + "download_count": 181742, + "project": "pyobjc-framework-applicationservices" + }, + { + "download_count": 181658, + "project": "datadog-checks-base" + }, + { + "download_count": 181619, + "project": "pyobjc-framework-contactsui" + }, + { + "download_count": 181492, + "project": "zope-publisher" + }, + { + "download_count": 181460, + "project": "pyobjc-framework-applescriptkit" + }, + { + "download_count": 181449, + "project": "pyobjc-framework-networkextension" + }, + { + "download_count": 181408, + "project": "zope-i18n" + }, + { + "download_count": 181315, + "project": "recordio" + }, + { + "download_count": 181306, + "project": "pyobjc-framework-preferencepanes" + }, + { + "download_count": 181204, + "project": "pyobjc-framework-installerplugins" + }, + { + "download_count": 181198, + "project": "pyobjc-framework-automator" + }, + { + "download_count": 181194, + "project": "python-interface" + }, + { + "download_count": 181178, + "project": "dogslow" + }, + { + "download_count": 181007, + "project": "s3pypi" + }, + { + "download_count": 180930, + "project": "arpeggio" + }, + { + "download_count": 180918, + "project": "pyobjc-framework-searchkit" + }, + { + "download_count": 180910, + "project": "pyobjc-framework-latentsemanticmapping" + }, + { + "download_count": 180898, + "project": "imgurpython" + }, + { + "download_count": 180787, + "project": "huey" + }, + { + "download_count": 180646, + "project": "pyobjc-framework-applescriptobjc" + }, + { + "download_count": 180541, + "project": "pyobjc-framework-instantmessage" + }, + { + "download_count": 180484, + "project": "pyclamd" + }, + { + "download_count": 180478, + "project": "pyobjc-framework-accounts" + }, + { + "download_count": 180443, + "project": "pyobjc-framework-servicemanagement" + }, + { + "download_count": 180359, + "project": "sortedcollections" + }, + { + "download_count": 180352, + "project": "pyobjc-framework-dictionaryservices" + }, + { + "download_count": 180326, + "project": "pyobjc-framework-pubsub" + }, + { + "download_count": 180234, + "project": "pyobjc-framework-collaboration" + }, + { + "download_count": 180184, + "project": "cqlsh" + }, + { + "download_count": 180108, + "project": "hacs-frontend" + }, + { + "download_count": 179819, + "project": "pyobjc-framework-social" + }, + { + "download_count": 179803, + "project": "pybars3" + }, + { + "download_count": 179768, + "project": "pyobjc-framework-eventkit" + }, + { + "download_count": 179757, + "project": "pyobjc-framework-opendirectory" + }, + { + "download_count": 179716, + "project": "chatterbot" + }, + { + "download_count": 179610, + "project": "neovim" + }, + { + "download_count": 179540, + "project": "json-logging" + }, + { + "download_count": 179401, + "project": "pytest-splinter" + }, + { + "download_count": 179317, + "project": "fig" + }, + { + "download_count": 179255, + "project": "pyte" + }, + { + "download_count": 179193, + "project": "bagit" + }, + { + "download_count": 179031, + "project": "aiohttp-swagger" + }, + { + "download_count": 178930, + "project": "django-cronman" + }, + { + "download_count": 178836, + "project": "robotframework-pageobjectlibrary" + }, + { + "download_count": 178805, + "project": "django-tenant-schemas" + }, + { + "download_count": 178606, + "project": "pypcd" + }, + { + "download_count": 178579, + "project": "s3contents" + }, + { + "download_count": 178532, + "project": "pytube" + }, + { + "download_count": 178420, + "project": "srvlookup" + }, + { + "download_count": 178249, + "project": "django-cache-url" + }, + { + "download_count": 178237, + "project": "pytest-sanic" + }, + { + "download_count": 178164, + "project": "pybase62" + }, + { + "download_count": 178040, + "project": "modulegraph" + }, + { + "download_count": 177513, + "project": "flufl-lock" + }, + { + "download_count": 177343, + "project": "pyobjc-framework-intents" + }, + { + "download_count": 177128, + "project": "playsound" + }, + { + "download_count": 177060, + "project": "django-sql-explorer" + }, + { + "download_count": 177040, + "project": "pymavlink" + }, + { + "download_count": 176939, + "project": "snowflake" + }, + { + "download_count": 176684, + "project": "drfdocs" + }, + { + "download_count": 176663, + "project": "django-sendfile" + }, + { + "download_count": 176504, + "project": "zope-testing" + }, + { + "download_count": 176439, + "project": "autocorrect" + }, + { + "download_count": 176429, + "project": "django-filters" + }, + { + "download_count": 176316, + "project": "delighted" + }, + { + "download_count": 176189, + "project": "pick" + }, + { + "download_count": 176166, + "project": "restricted-pkg" + }, + { + "download_count": 176069, + "project": "tlslite-ng" + }, + { + "download_count": 175910, + "project": "click-datetime" + }, + { + "download_count": 175901, + "project": "mapbox" + }, + { + "download_count": 175833, + "project": "zope-traversing" + }, + { + "download_count": 175827, + "project": "yagmail" + }, + { + "download_count": 175386, + "project": "os-diskconfig-python-novaclient-ext" + }, + { + "download_count": 175252, + "project": "env-utils" + }, + { + "download_count": 175153, + "project": "pyramid-chameleon" + }, + { + "download_count": 175039, + "project": "pysphere" + }, + { + "download_count": 174995, + "project": "pyobjc-framework-calendarstore" + }, + { + "download_count": 174675, + "project": "tfrecord-lite" + }, + { + "download_count": 174598, + "project": "zope-container" + }, + { + "download_count": 174537, + "project": "pyobjc-framework-iosurface" + }, + { + "download_count": 174516, + "project": "pyobjc-framework-netfs" + }, + { + "download_count": 174283, + "project": "zope-browser" + }, + { + "download_count": 174221, + "project": "cymysql" + }, + { + "download_count": 174210, + "project": "scrapy-fake-useragent" + }, + { + "download_count": 174182, + "project": "pysnooper" + }, + { + "download_count": 174143, + "project": "allennlp" + }, + { + "download_count": 174141, + "project": "itchat" + }, + { + "download_count": 174002, + "project": "pytest-arraydiff" + }, + { + "download_count": 174001, + "project": "multimethods" + }, + { + "download_count": 173985, + "project": "concurrencytest" + }, + { + "download_count": 173985, + "project": "pyxattr" + }, + { + "download_count": 173977, + "project": "pyobjc-framework-medialibrary" + }, + { + "download_count": 173974, + "project": "python-vlc" + }, + { + "download_count": 173922, + "project": "django-summernote" + }, + { + "download_count": 173897, + "project": "msal-extensions" + }, + { + "download_count": 173878, + "project": "pyobjc-framework-gamecontroller" + }, + { + "download_count": 173812, + "project": "pyobjc-framework-findersync" + }, + { + "download_count": 173771, + "project": "pyobjc-framework-cloudkit" + }, + { + "download_count": 173753, + "project": "pyobjc-framework-localauthentication" + }, + { + "download_count": 173686, + "project": "pyobjc-framework-mediaaccessibility" + }, + { + "download_count": 173647, + "project": "vega" + }, + { + "download_count": 173582, + "project": "textstat" + }, + { + "download_count": 173469, + "project": "neomodel" + }, + { + "download_count": 173417, + "project": "pyobjc" + }, + { + "download_count": 173414, + "project": "check-puppet-agent" + }, + { + "download_count": 173066, + "project": "os-networksv2-python-novaclient-ext" + }, + { + "download_count": 173034, + "project": "vcd-cli" + }, + { + "download_count": 172953, + "project": "numdifftools" + }, + { + "download_count": 172704, + "project": "tensorflow-graphics" + }, + { + "download_count": 172697, + "project": "pysqslistener" + }, + { + "download_count": 172681, + "project": "kazurator" + }, + { + "download_count": 172661, + "project": "xstatic-roboto-fontface" + }, + { + "download_count": 172595, + "project": "asyncio-nats-streaming" + }, + { + "download_count": 172285, + "project": "slugify" + }, + { + "download_count": 172276, + "project": "jupyter-notebook-gist" + }, + { + "download_count": 172213, + "project": "awsretry" + }, + { + "download_count": 172075, + "project": "flup" + }, + { + "download_count": 172011, + "project": "tornado-aws" + }, + { + "download_count": 171812, + "project": "rackspace-novaclient" + }, + { + "download_count": 171679, + "project": "django-q" + }, + { + "download_count": 171593, + "project": "rax-default-network-flags-python-novaclient-ext" + }, + { + "download_count": 171548, + "project": "object-pool" + }, + { + "download_count": 171504, + "project": "xstatic-font-awesome" + }, + { + "download_count": 171492, + "project": "rackspace-auth-openstack" + }, + { + "download_count": 171339, + "project": "qdarkstyle" + }, + { + "download_count": 171275, + "project": "tox-monorepo" + } + ] +} diff --git a/Tools/peg_generator/peg_extension/__init__.py b/Tools/peg_generator/peg_extension/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/Lib/test/test_peg_generator/ast_dump.py b/Tools/peg_generator/pegen/ast_dump.py similarity index 74% rename from Lib/test/test_peg_generator/ast_dump.py rename to Tools/peg_generator/pegen/ast_dump.py index 22d2dde775597..93dfbfd963ca6 100644 --- a/Lib/test/test_peg_generator/ast_dump.py +++ b/Tools/peg_generator/pegen/ast_dump.py @@ -6,16 +6,17 @@ TODO: Remove the above-described hack. """ + def ast_dump(node, annotate_fields=True, include_attributes=False, *, indent=None): def _format(node, level=0): if indent is not None: level += 1 - prefix = '\n' + indent * level - sep = ',\n' + indent * level + prefix = "\n" + indent * level + sep = ",\n" + indent * level else: - prefix = '' - sep = ', ' - if any(cls.__name__ == 'AST' for cls in node.__class__.__mro__): + prefix = "" + sep = ", " + if any(cls.__name__ == "AST" for cls in node.__class__.__mro__): cls = type(node) args = [] allsimple = True @@ -32,7 +33,7 @@ def _format(node, level=0): value, simple = _format(value, level) allsimple = allsimple and simple if keywords: - args.append('%s=%s' % (name, value)) + args.append("%s=%s" % (name, value)) else: args.append(value) if include_attributes and node._attributes: @@ -45,18 +46,18 @@ def _format(node, level=0): continue value, simple = _format(value, level) allsimple = allsimple and simple - args.append('%s=%s' % (name, value)) + args.append("%s=%s" % (name, value)) if allsimple and len(args) <= 3: - return '%s(%s)' % (node.__class__.__name__, ', '.join(args)), not args - return '%s(%s%s)' % (node.__class__.__name__, prefix, sep.join(args)), False + return "%s(%s)" % (node.__class__.__name__, ", ".join(args)), not args + return "%s(%s%s)" % (node.__class__.__name__, prefix, sep.join(args)), False elif isinstance(node, list): if not node: - return '[]', True - return '[%s%s]' % (prefix, sep.join(_format(x, level)[0] for x in node)), False + return "[]", True + return "[%s%s]" % (prefix, sep.join(_format(x, level)[0] for x in node)), False return repr(node), True - if all(cls.__name__ != 'AST' for cls in node.__class__.__mro__): - raise TypeError('expected AST, got %r' % node.__class__.__name__) + if all(cls.__name__ != "AST" for cls in node.__class__.__mro__): + raise TypeError("expected AST, got %r" % node.__class__.__name__) if indent is not None and not isinstance(indent, str): - indent = ' ' * indent + indent = " " * indent return _format(node)[0] diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py index 907feeaf122de..8f9348ddf24ac 100644 --- a/Tools/peg_generator/pegen/build.py +++ b/Tools/peg_generator/pegen/build.py @@ -3,6 +3,7 @@ import tokenize import sys import sysconfig +import tempfile import itertools from typing import Optional, Tuple, List, IO, Iterator, Set, Dict @@ -162,9 +163,13 @@ def build_c_generator( gen.generate(grammar_file) if compile_extension: - compile_c_extension( - output_file, verbose=verbose_c_extension, keep_asserts=keep_asserts_in_extension - ) + with tempfile.TemporaryDirectory() as build_dir: + compile_c_extension( + output_file, + build_dir=build_dir, + verbose=verbose_c_extension, + keep_asserts=keep_asserts_in_extension, + ) return gen diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py index 6b4287cd8cecc..0e9d5bd104813 100644 --- a/Tools/peg_generator/scripts/benchmark.py +++ b/Tools/peg_generator/scripts/benchmark.py @@ -105,10 +105,7 @@ def run_benchmark_stdlib(subcommand, parser): "../../Lib", "../../Grammar/python.gram", verbose=False, - excluded_files=[ - "*/bad*", - "*/lib2to3/tests/data/*", - ], + excluded_files=["*/bad*", "*/lib2to3/tests/data/*",], skip_actions=False, tree_arg=0, short=True, diff --git a/Tools/peg_generator/scripts/show_parse.py b/Tools/peg_generator/scripts/show_parse.py index f5f92fdaf755d..1a0410e1bac8f 100755 --- a/Tools/peg_generator/scripts/show_parse.py +++ b/Tools/peg_generator/scripts/show_parse.py @@ -32,6 +32,9 @@ from typing import List +sys.path.insert(0, os.getcwd()) +from pegen.ast_dump import ast_dump + parser = argparse.ArgumentParser() parser.add_argument( "-d", "--diff", action="store_true", help="show diff between grammar and ast (requires -g)" @@ -49,7 +52,7 @@ def format_tree(tree: ast.AST, verbose: bool = False) -> str: with tempfile.NamedTemporaryFile("w+") as tf: - tf.write(ast.dump(tree, include_attributes=verbose)) + tf.write(ast_dump(tree, include_attributes=verbose)) tf.write("\n") tf.flush() cmd = f"black -q {tf.name}" diff --git a/Tools/peg_generator/scripts/test_parse_directory.py b/Tools/peg_generator/scripts/test_parse_directory.py index 6511a2d932f74..a6078ef564061 100755 --- a/Tools/peg_generator/scripts/test_parse_directory.py +++ b/Tools/peg_generator/scripts/test_parse_directory.py @@ -14,6 +14,7 @@ sys.path.insert(0, os.getcwd()) from pegen.build import build_c_parser_and_generator +from pegen.ast_dump import ast_dump from pegen.testutil import print_memstats from scripts import show_parse @@ -85,8 +86,8 @@ def compare_trees( with open(file) as f: expected_tree = ast.parse(f.read()) - expected_text = ast.dump(expected_tree, include_attributes=include_attributes) - actual_text = ast.dump(actual_tree, include_attributes=include_attributes) + expected_text = ast_dump(expected_tree, include_attributes=include_attributes) + actual_text = ast_dump(actual_tree, include_attributes=include_attributes) if actual_text == expected_text: if verbose: print("Tree for {file}:") @@ -164,7 +165,7 @@ def parse_directory( if parser == "pegen": try: from peg_extension import parse # type: ignore - except: + except Exception as e: print( "An existing parser was not found. Please run `make` or specify a grammar file with the `-g` flag.", file=sys.stderr, diff --git a/Tools/peg_generator/scripts/test_pypi_packages.py b/Tools/peg_generator/scripts/test_pypi_packages.py index 90490330fef1d..7586b1a21fa6d 100755 --- a/Tools/peg_generator/scripts/test_pypi_packages.py +++ b/Tools/peg_generator/scripts/test_pypi_packages.py @@ -6,14 +6,18 @@ import tarfile import zipfile import shutil +import pathlib import sys from typing import Generator, Any sys.path.insert(0, ".") + from pegen import build from scripts import test_parse_directory +HERE = pathlib.Path(__file__).resolve().parent + argparser = argparse.ArgumentParser( prog="test_pypi_packages", description="Helper program to test parsing PyPI packages", ) @@ -53,7 +57,8 @@ def find_dirname(package_name: str) -> str: def run_tests(dirname: str, tree: int, extension: Any) -> int: return test_parse_directory.parse_directory( dirname, - "data/python.gram", + HERE / ".." / ".." / ".." / "Grammar" / "python.gram", + HERE / ".." / ".." / ".." / "Grammar" / "Tokens", verbose=False, excluded_files=[ "*/failset/*", @@ -68,6 +73,8 @@ def run_tests(dirname: str, tree: int, extension: Any) -> int: tree_arg=tree, short=True, extension=extension, + mode=1, + parser="pegen", ) @@ -75,9 +82,13 @@ def main() -> None: args = argparser.parse_args() tree = args.tree - extension = build.build_parser_and_generator( - "data/python.gram", "peg_parser/parse.c", compile_extension=True + extension = build.build_c_parser_and_generator( + HERE / ".." / ".." / ".." / "Grammar" / "python.gram", + HERE / ".." / ".." / ".." / "Grammar" / "Tokens", + "peg_extension/parse.c", + compile_extension=True, ) + for package in get_packages(): print(f"Extracting files from {package}... ", end="") try: @@ -91,7 +102,6 @@ def main() -> None: dirname = find_dirname(package) status = run_tests(dirname, tree, extension) if status == 0: - print("Done") shutil.rmtree(dirname) else: print(f"Failed to parse {dirname}") From webhook-mailer at python.org Sat May 2 00:23:47 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 02 May 2020 04:23:47 -0000 Subject: [Python-checkins] bpo-40334: regenerate metaparser as part of regen-all (GH-19854) Message-ID: https://github.com/python/cpython/commit/d2baff4301387e232495491f7291903cc1217d21 commit: d2baff4301387e232495491f7291903cc1217d21 branch: master author: Pablo Galindo committer: GitHub date: 2020-05-02T05:23:39+01:00 summary: bpo-40334: regenerate metaparser as part of regen-all (GH-19854) files: M Makefile.pre.in M Tools/peg_generator/pegen/grammar_parser.py diff --git a/Makefile.pre.in b/Makefile.pre.in index fa7fb1fcc167f..2b0b1b205a940 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -745,8 +745,9 @@ regen-importlib: Programs/_freeze_importlib ############################################################################ # Regenerate all generated files -regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-pegen \ - regen-token regen-keyword regen-symbol regen-ast regen-importlib clinic +regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar \ + regen-token regen-keyword regen-symbol regen-ast regen-importlib clinic \ + regen-pegen-metaparser regen-pegen ############################################################################ # Special rules for object files @@ -820,6 +821,14 @@ regen-grammar: regen-token $(UPDATE_FILE) $(srcdir)/Include/graminit.h $(srcdir)/Include/graminit.h.new $(UPDATE_FILE) $(srcdir)/Python/graminit.c $(srcdir)/Python/graminit.c.new +.PHONY: regen-pegen-metaparser +regen-pegen-metaparser: + PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q python \ + $(srcdir)/Tools/peg_generator/pegen/metagrammar.gram \ + -o $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new + $(UPDATE_FILE) $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py \ + $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new + .PHONY: regen-pegen regen-pegen: @$(MKDIR_P) $(srcdir)/Parser/pegen diff --git a/Tools/peg_generator/pegen/grammar_parser.py b/Tools/peg_generator/pegen/grammar_parser.py index 0e206ee9cd5e4..c784cfdf3b266 100644 --- a/Tools/peg_generator/pegen/grammar_parser.py +++ b/Tools/peg_generator/pegen/grammar_parser.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3.8 -# @generated by pegen from pegen/metagrammar.gram +# @generated by pegen from ./Tools/peg_generator/pegen/metagrammar.gram import ast import sys From webhook-mailer at python.org Sat May 2 02:38:09 2020 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 02 May 2020 06:38:09 -0000 Subject: [Python-checkins] bpo-39435: Make the first argument of pickle.loads() positional-only. (GH-19846) Message-ID: https://github.com/python/cpython/commit/531d1e541284bfd7944f8c66a5e8c3c3234afaff commit: 531d1e541284bfd7944f8c66a5e8c3c3234afaff branch: master author: Serhiy Storchaka committer: GitHub date: 2020-05-02T09:38:01+03:00 summary: bpo-39435: Make the first argument of pickle.loads() positional-only. (GH-19846) It was positional-only de facto: documentation and two implementations used three different name. files: A Misc/NEWS.d/next/Library/2020-05-01-23-24-25.bpo-39435.mgb6ib.rst M Doc/library/pickle.rst M Lib/pickle.py M Modules/_pickle.c M Modules/clinic/_pickle.c.h diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index d92e947a76403..b7c3452771948 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -252,7 +252,7 @@ process more convenient: .. versionchanged:: 3.8 The *buffers* argument was added. -.. function:: loads(data, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) +.. function:: loads(data, /, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) Return the reconstituted object hierarchy of the pickled representation *data* of an object. *data* must be a :term:`bytes-like object`. diff --git a/Lib/pickle.py b/Lib/pickle.py index 1fc8b0d26c6c4..cbac5f168b45e 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -13,7 +13,7 @@ dump(object, file) dumps(object) -> string load(file) -> object - loads(string) -> object + loads(bytes) -> object Misc variables: @@ -1761,7 +1761,7 @@ def _load(file, *, fix_imports=True, encoding="ASCII", errors="strict", return _Unpickler(file, fix_imports=fix_imports, buffers=buffers, encoding=encoding, errors=errors).load() -def _loads(s, *, fix_imports=True, encoding="ASCII", errors="strict", +def _loads(s, /, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None): if isinstance(s, str): raise TypeError("Can't load pickle from unicode string") diff --git a/Misc/NEWS.d/next/Library/2020-05-01-23-24-25.bpo-39435.mgb6ib.rst b/Misc/NEWS.d/next/Library/2020-05-01-23-24-25.bpo-39435.mgb6ib.rst new file mode 100644 index 0000000000000..2a516a53ed9e2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-01-23-24-25.bpo-39435.mgb6ib.rst @@ -0,0 +1 @@ +The first argument of :func:`pickle.loads` is now positional-only. diff --git a/Modules/_pickle.c b/Modules/_pickle.c index d07fa53a1235e..5539e64025a39 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -7873,6 +7873,7 @@ _pickle_load_impl(PyObject *module, PyObject *file, int fix_imports, _pickle.loads data: object + / * fix_imports: bool = True encoding: str = 'ASCII' @@ -7899,7 +7900,7 @@ static PyObject * _pickle_loads_impl(PyObject *module, PyObject *data, int fix_imports, const char *encoding, const char *errors, PyObject *buffers) -/*[clinic end generated code: output=82ac1e6b588e6d02 input=9c2ab6a0960185ea]*/ +/*[clinic end generated code: output=82ac1e6b588e6d02 input=b3615540d0535087]*/ { PyObject *result; UnpicklerObject *unpickler = _Unpickler_New(); diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h index 0457a433e79fb..136524b6a7134 100644 --- a/Modules/clinic/_pickle.c.h +++ b/Modules/clinic/_pickle.c.h @@ -735,7 +735,7 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject } PyDoc_STRVAR(_pickle_loads__doc__, -"loads($module, /, data, *, fix_imports=True, encoding=\'ASCII\',\n" +"loads($module, data, /, *, fix_imports=True, encoding=\'ASCII\',\n" " errors=\'strict\', buffers=())\n" "--\n" "\n" @@ -766,7 +766,7 @@ static PyObject * _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"data", "fix_imports", "encoding", "errors", "buffers", NULL}; + static const char * const _keywords[] = {"", "fix_imports", "encoding", "errors", "buffers", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "loads", 0}; PyObject *argsbuf[5]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; @@ -836,4 +836,4 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec exit: return return_value; } -/*[clinic end generated code: output=e2506823be1960c5 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=324aad69644beda2 input=a9049054013a1b77]*/ From webhook-mailer at python.org Sat May 2 04:08:05 2020 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 02 May 2020 08:08:05 -0000 Subject: [Python-checkins] [3.8] bpo-40398: Fix typing.get_args() for special generic aliases. (GH-19720) (GH-19857) Message-ID: https://github.com/python/cpython/commit/a629d4c63c55ba36be36ff105dfc103b710c9a2d commit: a629d4c63c55ba36be36ff105dfc103b710c9a2d branch: 3.8 author: Serhiy Storchaka committer: GitHub date: 2020-05-02T11:08:00+03:00 summary: [3.8] bpo-40398: Fix typing.get_args() for special generic aliases. (GH-19720) (GH-19857) (cherry picked from commit 6292be7adf247589bbf03524f8883cb4cb61f3e9) files: A Misc/NEWS.d/next/Library/2020-04-26-22-25-36.bpo-40398.OdXnR3.rst M Lib/test/test_typing.py M Lib/typing.py diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index bdd7acd85914c..83bfef14dfb96 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -2913,6 +2913,9 @@ class C(Generic[T]): pass self.assertIs(get_origin(Generic), Generic) self.assertIs(get_origin(Generic[T]), Generic) self.assertIs(get_origin(List[Tuple[T, T]][int]), list) + self.assertIs(get_origin(List), list) + self.assertIs(get_origin(Tuple), tuple) + self.assertIs(get_origin(Callable), collections.abc.Callable) def test_get_args(self): T = TypeVar('T') @@ -2928,11 +2931,15 @@ class C(Generic[T]): pass (int, Tuple[str, int])) self.assertEqual(get_args(typing.Dict[int, Tuple[T, T]][Optional[int]]), (int, Tuple[Optional[int], Optional[int]])) - self.assertEqual(get_args(Callable[[], T][int]), ([], int,)) + self.assertEqual(get_args(Callable[[], T][int]), ([], int)) + self.assertEqual(get_args(Callable[..., int]), (..., int)) self.assertEqual(get_args(Union[int, Callable[[Tuple[T, ...]], str]]), (int, Callable[[Tuple[T, ...]], str])) self.assertEqual(get_args(Tuple[int, ...]), (int, ...)) self.assertEqual(get_args(Tuple[()]), ((),)) + self.assertEqual(get_args(List), ()) + self.assertEqual(get_args(Tuple), ()) + self.assertEqual(get_args(Callable), ()) class CollectionsAbcTests(BaseTestCase): diff --git a/Lib/typing.py b/Lib/typing.py index f4fb08f4500de..589eea98ad31c 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1300,7 +1300,7 @@ def get_args(tp): get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int]) get_args(Callable[[], T][int]) == ([], int) """ - if isinstance(tp, _GenericAlias): + if isinstance(tp, _GenericAlias) and not tp._special: res = tp.__args__ if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis: res = (list(res[:-1]), res[-1]) diff --git a/Misc/NEWS.d/next/Library/2020-04-26-22-25-36.bpo-40398.OdXnR3.rst b/Misc/NEWS.d/next/Library/2020-04-26-22-25-36.bpo-40398.OdXnR3.rst new file mode 100644 index 0000000000000..a56da0c109592 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-04-26-22-25-36.bpo-40398.OdXnR3.rst @@ -0,0 +1,2 @@ +:func:`typing.get_args` now always returns an empty tuple for special +generic aliases. From webhook-mailer at python.org Sat May 2 11:15:35 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 02 May 2020 15:15:35 -0000 Subject: [Python-checkins] Call $(MKDIR_P) before regenerating the PEG meta-parser (GH-19861) Message-ID: https://github.com/python/cpython/commit/b7226eb0b76dd867917c6f66fd68fe6f8da01d9c commit: b7226eb0b76dd867917c6f66fd68fe6f8da01d9c branch: master author: Pablo Galindo committer: GitHub date: 2020-05-02T16:15:27+01:00 summary: Call $(MKDIR_P) before regenerating the PEG meta-parser (GH-19861) files: M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index 2b0b1b205a940..3cb8b84157f0e 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -823,6 +823,7 @@ regen-grammar: regen-token .PHONY: regen-pegen-metaparser regen-pegen-metaparser: + @$(MKDIR_P) $(srcdir)/Tools/peg_generator/pegen PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q python \ $(srcdir)/Tools/peg_generator/pegen/metagrammar.gram \ -o $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new From webhook-mailer at python.org Sat May 2 12:12:11 2020 From: webhook-mailer at python.org (Sander) Date: Sat, 02 May 2020 16:12:11 -0000 Subject: [Python-checkins] bpo-40419: timeit CLI docs now mention 1, 2, 5, 10, ... trials instead of powers of 10 (GH-19752) Message-ID: https://github.com/python/cpython/commit/766352320fd736e2c8ed545b4cc57563f61a0b9d commit: 766352320fd736e2c8ed545b4cc57563f61a0b9d branch: master author: Sander committer: GitHub date: 2020-05-02T19:12:05+03:00 summary: bpo-40419: timeit CLI docs now mention 1,2,5,10,... trials instead of powers of 10 (GH-19752) files: M Doc/library/timeit.rst M Lib/timeit.py diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index ef7a4e40be659..46fa62c15fc2e 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -251,7 +251,8 @@ quotes and using leading spaces. Multiple :option:`-s` options are treated similarly. If :option:`-n` is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total +time is at least 0.2 seconds. :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is diff --git a/Lib/timeit.py b/Lib/timeit.py index c0362bcc5f3e2..6c3ec01067f2d 100755 --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -29,7 +29,8 @@ treated similarly. If -n is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the +total time is at least 0.2 seconds. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. The code here doesn't try From webhook-mailer at python.org Sat May 2 12:29:57 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 02 May 2020 16:29:57 -0000 Subject: [Python-checkins] bpo-40419: timeit CLI docs now mention 1, 2, 5, 10, ... trials instead of powers of 10 (GH-19752) Message-ID: https://github.com/python/cpython/commit/399b9a4a620f544c1afa3b8c7fd82d093b5cc76d commit: 399b9a4a620f544c1afa3b8c7fd82d093b5cc76d branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-02T09:29:51-07:00 summary: bpo-40419: timeit CLI docs now mention 1,2,5,10,... trials instead of powers of 10 (GH-19752) (cherry picked from commit 766352320fd736e2c8ed545b4cc57563f61a0b9d) Co-authored-by: Sander files: M Doc/library/timeit.rst M Lib/timeit.py diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index ef7a4e40be659..46fa62c15fc2e 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -251,7 +251,8 @@ quotes and using leading spaces. Multiple :option:`-s` options are treated similarly. If :option:`-n` is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total +time is at least 0.2 seconds. :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is diff --git a/Lib/timeit.py b/Lib/timeit.py index c0362bcc5f3e2..6c3ec01067f2d 100755 --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -29,7 +29,8 @@ treated similarly. If -n is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the +total time is at least 0.2 seconds. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. The code here doesn't try From webhook-mailer at python.org Sat May 2 12:29:57 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 02 May 2020 16:29:57 -0000 Subject: [Python-checkins] bpo-40419: timeit CLI docs now mention 1, 2, 5, 10, ... trials instead of powers of 10 (GH-19752) Message-ID: https://github.com/python/cpython/commit/4eec39a98c57bc374888b54c34ca11fdffcffc07 commit: 4eec39a98c57bc374888b54c34ca11fdffcffc07 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-02T09:29:49-07:00 summary: bpo-40419: timeit CLI docs now mention 1,2,5,10,... trials instead of powers of 10 (GH-19752) (cherry picked from commit 766352320fd736e2c8ed545b4cc57563f61a0b9d) Co-authored-by: Sander files: M Doc/library/timeit.rst M Lib/timeit.py diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index ef7a4e40be659..46fa62c15fc2e 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -251,7 +251,8 @@ quotes and using leading spaces. Multiple :option:`-s` options are treated similarly. If :option:`-n` is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total +time is at least 0.2 seconds. :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is diff --git a/Lib/timeit.py b/Lib/timeit.py index c0362bcc5f3e2..6c3ec01067f2d 100755 --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -29,7 +29,8 @@ treated similarly. If -n is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the +total time is at least 0.2 seconds. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. The code here doesn't try From webhook-mailer at python.org Sat May 2 19:45:36 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sat, 02 May 2020 23:45:36 -0000 Subject: [Python-checkins] bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867) Message-ID: https://github.com/python/cpython/commit/190fac99c58232f3e0b34891872b91e50ea2f057 commit: 190fac99c58232f3e0b34891872b91e50ea2f057 branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-02T16:45:32-07:00 summary: bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867) files: A Misc/NEWS.d/next/Library/2020-05-02-12-00-28.bpo-40465.qfCjOD.rst M Doc/library/random.rst M Lib/random.py M Lib/test/test_random.py diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 291eca3a3f16a..43a9902f6c11f 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -208,6 +208,9 @@ Functions for sequences generated. For example, a sequence of length 2080 is the largest that can fit within the period of the Mersenne Twister random number generator. + .. deprecated-removed:: 3.9 3.11 + The optional parameter *random*. + .. function:: sample(population, k) diff --git a/Lib/random.py b/Lib/random.py index 8f840e1abb908..f2c4f39fb6079 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -321,6 +321,10 @@ def shuffle(self, x, random=None): j = randbelow(i+1) x[i], x[j] = x[j], x[i] else: + _warn('The *random* parameter to shuffle() has been deprecated\n' + 'since Python 3.9 and will be removed in a subsequent ' + 'version.', + DeprecationWarning, 2) _int = int for i in reversed(range(1, len(x))): # pick an element in x[:i+1] with which to exchange x[i] diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 6d87d21cf22c6..bb95ca0884a51 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -103,7 +103,8 @@ def test_shuffle_random_argument(self): shuffle = self.gen.shuffle mock_random = unittest.mock.Mock(return_value=0.5) seq = bytearray(b'abcdefghijk') - shuffle(seq, mock_random) + with self.assertWarns(DeprecationWarning): + shuffle(seq, mock_random) mock_random.assert_called_with() def test_choice(self): diff --git a/Misc/NEWS.d/next/Library/2020-05-02-12-00-28.bpo-40465.qfCjOD.rst b/Misc/NEWS.d/next/Library/2020-05-02-12-00-28.bpo-40465.qfCjOD.rst new file mode 100644 index 0000000000000..7ce9a44c712e7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-02-12-00-28.bpo-40465.qfCjOD.rst @@ -0,0 +1 @@ +Deprecated the optional *random* argument to *random.shuffle()*. From webhook-mailer at python.org Sat May 2 19:50:52 2020 From: webhook-mailer at python.org (Mathieu Dupuy) Date: Sat, 02 May 2020 23:50:52 -0000 Subject: [Python-checkins] Fix missing space in docs(GH-19866) Message-ID: https://github.com/python/cpython/commit/8aab84312e6062cda44cc67c2b7c0c0f70119c67 commit: 8aab84312e6062cda44cc67c2b7c0c0f70119c67 branch: master author: Mathieu Dupuy committer: GitHub date: 2020-05-02T16:50:47-07:00 summary: Fix missing space in docs(GH-19866) files: M Doc/library/random.rst diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 43a9902f6c11f..ab4ca4b3f8532 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -107,7 +107,7 @@ Bookkeeping functions .. function:: getrandbits(k) Returns a Python integer with *k* random bits. This method is supplied with - the MersenneTwister generator and some other generators may also provide it + the Mersenne Twister generator and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ranges. From webhook-mailer at python.org Sat May 2 20:05:56 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 03 May 2020 00:05:56 -0000 Subject: [Python-checkins] Fix missing space in docs(GH-19866) (GH-19872) Message-ID: https://github.com/python/cpython/commit/108e45524d5b2d8aa0d7feb1e593ea061fb36ba4 commit: 108e45524d5b2d8aa0d7feb1e593ea061fb36ba4 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-02T17:05:49-07:00 summary: Fix missing space in docs(GH-19866) (GH-19872) files: M Doc/library/random.rst diff --git a/Doc/library/random.rst b/Doc/library/random.rst index c01b2294b0436..2149e800e1657 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -102,7 +102,7 @@ Bookkeeping functions .. function:: getrandbits(k) Returns a Python integer with *k* random bits. This method is supplied with - the MersenneTwister generator and some other generators may also provide it + the Mersenne Twister generator and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ranges. From webhook-mailer at python.org Sat May 2 22:30:34 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sun, 03 May 2020 02:30:34 -0000 Subject: [Python-checkins] Minor code cleanups for statistics (GH-19873) Message-ID: https://github.com/python/cpython/commit/0400a7f2f8abec8d441990e951cc25f69a2a4036 commit: 0400a7f2f8abec8d441990e951cc25f69a2a4036 branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-02T19:30:24-07:00 summary: Minor code cleanups for statistics (GH-19873) * Minor cleanups: Removed unused code. Move C import near its Python version. * Clean-up whitespace files: M Lib/statistics.py diff --git a/Lib/statistics.py b/Lib/statistics.py index 9beafb341b3ad..c76a6ca519e40 100644 --- a/Lib/statistics.py +++ b/Lib/statistics.py @@ -894,6 +894,13 @@ def _normal_dist_inv_cdf(p, mu, sigma): return mu + (x * sigma) +# If available, use C implementation +try: + from _statistics import _normal_dist_inv_cdf +except ImportError: + pass + + class NormalDist: "Normal distribution of a random variable" # https://en.wikipedia.org/wiki/Normal_distribution @@ -1111,79 +1118,3 @@ def __hash__(self): def __repr__(self): return f'{type(self).__name__}(mu={self._mu!r}, sigma={self._sigma!r})' - -# If available, use C implementation -try: - from _statistics import _normal_dist_inv_cdf -except ImportError: - pass - - -if __name__ == '__main__': - - # Show math operations computed analytically in comparsion - # to a monte carlo simulation of the same operations - - from math import isclose - from operator import add, sub, mul, truediv - from itertools import repeat - import doctest - - g1 = NormalDist(10, 20) - g2 = NormalDist(-5, 25) - - # Test scaling by a constant - assert (g1 * 5 / 5).mean == g1.mean - assert (g1 * 5 / 5).stdev == g1.stdev - - n = 100_000 - G1 = g1.samples(n) - G2 = g2.samples(n) - - for func in (add, sub): - print(f'\nTest {func.__name__} with another NormalDist:') - print(func(g1, g2)) - print(NormalDist.from_samples(map(func, G1, G2))) - - const = 11 - for func in (add, sub, mul, truediv): - print(f'\nTest {func.__name__} with a constant:') - print(func(g1, const)) - print(NormalDist.from_samples(map(func, G1, repeat(const)))) - - const = 19 - for func in (add, sub, mul): - print(f'\nTest constant with {func.__name__}:') - print(func(const, g1)) - print(NormalDist.from_samples(map(func, repeat(const), G1))) - - def assert_close(G1, G2): - assert isclose(G1.mean, G1.mean, rel_tol=0.01), (G1, G2) - assert isclose(G1.stdev, G2.stdev, rel_tol=0.01), (G1, G2) - - X = NormalDist(-105, 73) - Y = NormalDist(31, 47) - s = 32.75 - n = 100_000 - - S = NormalDist.from_samples([x + s for x in X.samples(n)]) - assert_close(X + s, S) - - S = NormalDist.from_samples([x - s for x in X.samples(n)]) - assert_close(X - s, S) - - S = NormalDist.from_samples([x * s for x in X.samples(n)]) - assert_close(X * s, S) - - S = NormalDist.from_samples([x / s for x in X.samples(n)]) - assert_close(X / s, S) - - S = NormalDist.from_samples([x + y for x, y in zip(X.samples(n), - Y.samples(n))]) - assert_close(X + Y, S) - - S = NormalDist.from_samples([x - y for x, y in zip(X.samples(n), - Y.samples(n))]) - assert_close(X - Y, S) - - print(doctest.testmod()) From webhook-mailer at python.org Sun May 3 03:08:11 2020 From: webhook-mailer at python.org (Chris Jerdonek) Date: Sun, 03 May 2020 07:08:11 -0000 Subject: [Python-checkins] bpo-29587: allow chaining NULL exceptions in _gen_throw() (GH-19877) Message-ID: https://github.com/python/cpython/commit/21893fbb74e8fde2931fbed9b511e2a41362b1ab commit: 21893fbb74e8fde2931fbed9b511e2a41362b1ab branch: master author: Chris Jerdonek committer: GitHub date: 2020-05-03T00:07:57-07:00 summary: bpo-29587: allow chaining NULL exceptions in _gen_throw() (GH-19877) This is a follow-up to GH-19823 that removes the check that the exception value isn't NULL, prior to calling _PyErr_ChainExceptions(). This enables implicit exception chaining for gen.throw() in more circumstances. The commit also adds a test that a particular code snippet involving gen.throw() doesn't crash. The test shows why the new `gi_exc_state.exc_type != Py_None` check that was added is necessary. Without the new check, the code snippet (as well as a number of other tests) crashes on certain platforms (e.g. Fedora but not Mac). files: M Lib/test/test_generators.py M Objects/genobject.c diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 4d96f44b15062..5824ecd7c37e8 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -332,6 +332,26 @@ def f(): context = cm.exception.__context__ self.assertEqual((type(context), context.args), (KeyError, ('a',))) + def test_throw_after_none_exc_type(self): + def g(): + try: + raise KeyError + except KeyError: + pass + + try: + yield + except Exception: + # Without the `gi_exc_state.exc_type != Py_None` in + # _gen_throw(), this line was causing a crash ("Segmentation + # fault (core dumped)") on e.g. Fedora 32. + raise RuntimeError + + gen = g() + gen.send(None) + with self.assertRaises(RuntimeError) as cm: + gen.throw(ValueError) + class YieldFromTests(unittest.TestCase): def test_generator_gi_yieldfrom(self): diff --git a/Objects/genobject.c b/Objects/genobject.c index 41a63ae2e666a..b27fa929a2625 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -512,11 +512,12 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, } PyErr_Restore(typ, val, tb); - /* XXX Should we also handle the case where exc_type is true and - exc_value is false? */ - if (gen->gi_exc_state.exc_type && gen->gi_exc_state.exc_value) { + /* XXX It seems like we shouldn't have to check not equal to Py_None + here because exc_type should only ever be a class. But not including + this check was causing crashes on certain tests e.g. on Fedora. */ + if (gen->gi_exc_state.exc_type && gen->gi_exc_state.exc_type != Py_None) { Py_INCREF(gen->gi_exc_state.exc_type); - Py_INCREF(gen->gi_exc_state.exc_value); + Py_XINCREF(gen->gi_exc_state.exc_value); Py_XINCREF(gen->gi_exc_state.exc_traceback); _PyErr_ChainExceptions(gen->gi_exc_state.exc_type, gen->gi_exc_state.exc_value, gen->gi_exc_state.exc_traceback); From webhook-mailer at python.org Sun May 3 07:51:28 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sun, 03 May 2020 11:51:28 -0000 Subject: [Python-checkins] Simplify set entry insertion logic. (GH-19881) Message-ID: https://github.com/python/cpython/commit/3dd2157febae5087ca3333d24f69b6de9cbd13cd commit: 3dd2157febae5087ca3333d24f69b6de9cbd13cd branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-03T04:51:05-07:00 summary: Simplify set entry insertion logic. (GH-19881) files: M Objects/setobject.c diff --git a/Objects/setobject.c b/Objects/setobject.c index bbe013bcfac74..df4a0e1e9420e 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -137,7 +137,6 @@ static int set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) { setentry *table; - setentry *freeslot; setentry *entry; size_t perturb; size_t mask; @@ -158,7 +157,6 @@ set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) if (entry->key == NULL) goto found_unused; - freeslot = NULL; perturb = hash; while (1) { @@ -187,14 +185,12 @@ set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) goto restart; mask = so->mask; /* help avoid a register spill */ } - else if (entry->hash == -1) - freeslot = entry; if (i + LINEAR_PROBES <= mask) { for (j = 0 ; j < LINEAR_PROBES ; j++) { entry++; if (entry->hash == 0 && entry->key == NULL) - goto found_unused_or_dummy; + goto found_unused; if (entry->hash == hash) { PyObject *startkey = entry->key; assert(startkey != dummy); @@ -216,8 +212,6 @@ set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) goto restart; mask = so->mask; } - else if (entry->hash == -1) - freeslot = entry; } } @@ -226,17 +220,9 @@ set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) entry = &so->table[i]; if (entry->key == NULL) - goto found_unused_or_dummy; + goto found_unused; } - found_unused_or_dummy: - if (freeslot == NULL) - goto found_unused; - so->used++; - freeslot->key = key; - freeslot->hash = hash; - return 0; - found_unused: so->fill++; so->used++; From webhook-mailer at python.org Sun May 3 13:12:00 2020 From: webhook-mailer at python.org (Batuhan Taskaya) Date: Sun, 03 May 2020 17:12:00 -0000 Subject: [Python-checkins] bpo-38870: Don't start generated output with newlines in ast.unparse (GH-19636) Message-ID: https://github.com/python/cpython/commit/493bf1cc316b0b5bd90779ecd1132878c881669e commit: 493bf1cc316b0b5bd90779ecd1132878c881669e branch: master author: Batuhan Taskaya committer: GitHub date: 2020-05-03T18:11:51+01:00 summary: bpo-38870: Don't start generated output with newlines in ast.unparse (GH-19636) files: M Lib/ast.py M Lib/test/test_unparse.py diff --git a/Lib/ast.py b/Lib/ast.py index 401af5647a240..5c68c4a66e1dd 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -669,10 +669,16 @@ def items_view(self, traverser, items): else: self.interleave(lambda: self.write(", "), traverser, items) + def maybe_newline(self): + """Adds a newline if it isn't the start of generated source""" + if self._source: + self.write("\n") + def fill(self, text=""): """Indent a piece of text and append it, according to the current indentation level""" - self.write("\n" + " " * self._indent + text) + self.maybe_newline() + self.write(" " * self._indent + text) def write(self, text): """Append a piece of text""" @@ -916,7 +922,7 @@ def visit_ExceptHandler(self, node): self.traverse(node.body) def visit_ClassDef(self, node): - self.write("\n") + self.maybe_newline() for deco in node.decorator_list: self.fill("@") self.traverse(deco) @@ -946,7 +952,7 @@ def visit_AsyncFunctionDef(self, node): self._function_helper(node, "async def") def _function_helper(self, node, fill_suffix): - self.write("\n") + self.maybe_newline() for deco in node.decorator_list: self.fill("@") self.traverse(deco) @@ -1043,7 +1049,7 @@ def _fstring_FormattedValue(self, node, write): write("{") unparser = type(self)() unparser.set_precedence(_Precedence.TEST.next(), node.value) - expr = unparser.visit(node.value).rstrip("\n") + expr = unparser.visit(node.value) if expr.startswith("{"): write(" ") # Separate pair of opening brackets as "{ {" write(expr) diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index d4089a3fc1cdf..2be44b246aa69 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -128,19 +128,17 @@ def check_ast_roundtrip(self, code1, **kwargs): def check_invalid(self, node, raises=ValueError): self.assertRaises(raises, ast.unparse, node) - def get_source(self, code1, code2=None, strip=True): + def get_source(self, code1, code2=None): code2 = code2 or code1 code1 = ast.unparse(ast.parse(code1)) - if strip: - code1 = code1.strip() return code1, code2 - def check_src_roundtrip(self, code1, code2=None, strip=True): - code1, code2 = self.get_source(code1, code2, strip) + def check_src_roundtrip(self, code1, code2=None): + code1, code2 = self.get_source(code1, code2) self.assertEqual(code2, code1) - def check_src_dont_roundtrip(self, code1, code2=None, strip=True): - code1, code2 = self.get_source(code1, code2, strip) + def check_src_dont_roundtrip(self, code1, code2=None): + code1, code2 = self.get_source(code1, code2) self.assertNotEqual(code2, code1) class UnparseTestCase(ASTTestCase): From webhook-mailer at python.org Sun May 3 14:25:54 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sun, 03 May 2020 18:25:54 -0000 Subject: [Python-checkins] Remove out-of-date comment (GH-19886) Message-ID: https://github.com/python/cpython/commit/d699d5e6178adca785a8701c32daf5e18fad0bf1 commit: d699d5e6178adca785a8701c32daf5e18fad0bf1 branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-03T11:25:46-07:00 summary: Remove out-of-date comment (GH-19886) files: M Objects/setobject.c diff --git a/Objects/setobject.c b/Objects/setobject.c index df4a0e1e9420e..0e4e45f60a9cc 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -243,8 +243,7 @@ set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) /* Internal routine used by set_table_resize() to insert an item which is -known to be absent from the set. This routine also assumes that -the set contains no deleted entries. Besides the performance benefit, +known to be absent from the set. Besides the performance benefit, there is also safety benefit since using set_add_entry() risks making a callback in the middle of a set_table_resize(), see issue 1456209. The caller is responsible for updating the key's reference count and From webhook-mailer at python.org Sun May 3 19:45:17 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sun, 03 May 2020 23:45:17 -0000 Subject: [Python-checkins] Remove outdated and confusing advice about setting maxsize (GH-19889) Message-ID: https://github.com/python/cpython/commit/ad9eaeab74b680830dbefc18e8fe3dec4677a21b commit: ad9eaeab74b680830dbefc18e8fe3dec4677a21b branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-03T16:45:13-07:00 summary: Remove outdated and confusing advice about setting maxsize (GH-19889) files: M Doc/library/functools.rst diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index e708a0d99cd00..856c1c790ae36 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -107,8 +107,7 @@ The :mod:`functools` module defines the following functions: return sum(sentence.count(vowel) for vowel in 'aeiou') If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can - grow without bound. The LRU feature performs best when *maxsize* is a - power-of-two. + grow without bound. If *typed* is set to true, function arguments of different types will be cached separately. For example, ``f(3)`` and ``f(3.0)`` will be treated From webhook-mailer at python.org Sun May 3 20:16:42 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 04 May 2020 00:16:42 -0000 Subject: [Python-checkins] Remove outdated and confusing advice about setting maxsize (GH-19889) (GH-19890) Message-ID: https://github.com/python/cpython/commit/9609460ce0b71215eff2d057b6780950e00be013 commit: 9609460ce0b71215eff2d057b6780950e00be013 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-03T17:16:36-07:00 summary: Remove outdated and confusing advice about setting maxsize (GH-19889) (GH-19890) files: M Doc/library/functools.rst diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 3a0b554e923c7..0fb8d900c7362 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -101,8 +101,7 @@ The :mod:`functools` module defines the following functions: return sum(sentence.count(vowel) for vowel in 'aeiou') If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can - grow without bound. The LRU feature performs best when *maxsize* is a - power-of-two. + grow without bound. If *typed* is set to true, function arguments of different types will be cached separately. For example, ``f(3)`` and ``f(3.0)`` will be treated From webhook-mailer at python.org Sun May 3 20:20:13 2020 From: webhook-mailer at python.org (Lysandros Nikolaou) Date: Mon, 04 May 2020 00:20:13 -0000 Subject: [Python-checkins] bpo-40334: Set error_indicator in _PyPegen_raise_error (GH-19887) Message-ID: https://github.com/python/cpython/commit/7f06af684a1882fdb19d20650825948b1d7996e5 commit: 7f06af684a1882fdb19d20650825948b1d7996e5 branch: master author: Lysandros Nikolaou committer: GitHub date: 2020-05-04T01:20:09+01:00 summary: bpo-40334: Set error_indicator in _PyPegen_raise_error (GH-19887) Due to PyErr_Occurred not being called at the beginning of each rule, we need to set the error indicator, so that rules do not get expanded after an exception has been thrown files: M Parser/pegen/pegen.c diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index 6ff09b3b31f78..9858f71c83c79 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -389,6 +389,7 @@ _PyPegen_raise_error(Parser *p, PyObject *errtype, int with_col_number, const ch Token *t = p->tokens[p->fill - 1]; Py_ssize_t col_number = !with_col_number; va_list va; + p->error_indicator = 1; va_start(va, errmsg); errstr = PyUnicode_FromFormatV(errmsg, va); From webhook-mailer at python.org Sun May 3 22:03:13 2020 From: webhook-mailer at python.org (Anthony Shaw) Date: Mon, 04 May 2020 02:03:13 -0000 Subject: [Python-checkins] Clean up unused imports for the peg generator module (GH-19891) Message-ID: https://github.com/python/cpython/commit/c95e691c904bb5ebd91825efa81b93cb9e354a85 commit: c95e691c904bb5ebd91825efa81b93cb9e354a85 branch: master author: Anthony Shaw committer: GitHub date: 2020-05-04T03:03:05+01:00 summary: Clean up unused imports for the peg generator module (GH-19891) files: M Tools/peg_generator/pegen/build.py M Tools/peg_generator/pegen/c_generator.py M Tools/peg_generator/pegen/first_sets.py M Tools/peg_generator/pegen/grammar.py M Tools/peg_generator/pegen/grammar_visualizer.py M Tools/peg_generator/scripts/ast_timings.py M Tools/peg_generator/scripts/benchmark.py M Tools/peg_generator/scripts/find_max_nesting.py M Tools/peg_generator/scripts/test_parse_directory.py diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py index 8f9348ddf24ac..931ffc787523b 100644 --- a/Tools/peg_generator/pegen/build.py +++ b/Tools/peg_generator/pegen/build.py @@ -1,12 +1,11 @@ import pathlib import shutil import tokenize -import sys import sysconfig import tempfile import itertools -from typing import Optional, Tuple, List, IO, Iterator, Set, Dict +from typing import Optional, Tuple, List, IO, Set, Dict from pegen.c_generator import CParserGenerator from pegen.grammar import Grammar diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index c9c67067d4677..40004e7875278 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -1,7 +1,7 @@ import ast from dataclasses import dataclass, field import re -from typing import IO, Any, Dict, List, Optional, Set, Text, Tuple +from typing import Any, Dict, IO, Optional, List, Text, Tuple, Set from enum import Enum from pegen import grammar diff --git a/Tools/peg_generator/pegen/first_sets.py b/Tools/peg_generator/pegen/first_sets.py index da30eba99ce5a..71be5a2e7cbf4 100755 --- a/Tools/peg_generator/pegen/first_sets.py +++ b/Tools/peg_generator/pegen/first_sets.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3.8 import argparse -import collections import pprint import sys -from typing import Optional, Set, Dict +from typing import Set, Dict from pegen.build import build_parser from pegen.grammar import ( diff --git a/Tools/peg_generator/pegen/grammar.py b/Tools/peg_generator/pegen/grammar.py index 67039d5a032ab..78edf412ea6e4 100644 --- a/Tools/peg_generator/pegen/grammar.py +++ b/Tools/peg_generator/pegen/grammar.py @@ -4,7 +4,6 @@ from typing import ( AbstractSet, Any, - Callable, Dict, Iterable, Iterator, @@ -13,11 +12,9 @@ Set, Tuple, TYPE_CHECKING, - TypeVar, Union, ) -from pegen.parser import memoize, Parser if TYPE_CHECKING: from pegen.parser_generator import ParserGenerator diff --git a/Tools/peg_generator/pegen/grammar_visualizer.py b/Tools/peg_generator/pegen/grammar_visualizer.py index b1d51d2cdb250..7362ec5fa0f4d 100644 --- a/Tools/peg_generator/pegen/grammar_visualizer.py +++ b/Tools/peg_generator/pegen/grammar_visualizer.py @@ -1,7 +1,7 @@ import argparse import sys -from typing import Any, Iterator, Iterable, Callable +from typing import Any, Iterator, Callable from pegen.build import build_parser from pegen.grammar import Grammar, Rule diff --git a/Tools/peg_generator/scripts/ast_timings.py b/Tools/peg_generator/scripts/ast_timings.py index 7ebd46fdac685..ca252208f283e 100644 --- a/Tools/peg_generator/scripts/ast_timings.py +++ b/Tools/peg_generator/scripts/ast_timings.py @@ -1,8 +1,6 @@ import ast import sys import time -import token -import tokenize from pegen.testutil import print_memstats diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py index 0e9d5bd104813..d39ac3dca79e7 100644 --- a/Tools/peg_generator/scripts/benchmark.py +++ b/Tools/peg_generator/scripts/benchmark.py @@ -4,7 +4,6 @@ import ast import sys import os -import resource from time import time import memory_profiler diff --git a/Tools/peg_generator/scripts/find_max_nesting.py b/Tools/peg_generator/scripts/find_max_nesting.py index a2c41a821342a..f2fdd00bfb7cd 100755 --- a/Tools/peg_generator/scripts/find_max_nesting.py +++ b/Tools/peg_generator/scripts/find_max_nesting.py @@ -13,11 +13,7 @@ Usage: python -m scripts.find_max_nesting """ -import os import sys -from tempfile import TemporaryDirectory -from pathlib import Path -from typing import Any from _peg_parser import parse_string diff --git a/Tools/peg_generator/scripts/test_parse_directory.py b/Tools/peg_generator/scripts/test_parse_directory.py index a6078ef564061..aef9c74b52881 100755 --- a/Tools/peg_generator/scripts/test_parse_directory.py +++ b/Tools/peg_generator/scripts/test_parse_directory.py @@ -4,7 +4,6 @@ import ast import os import sys -import tempfile import time import traceback from glob import glob From webhook-mailer at python.org Mon May 4 01:08:22 2020 From: webhook-mailer at python.org (Shantanu) Date: Mon, 04 May 2020 05:08:22 -0000 Subject: [Python-checkins] bpo-40493: fix function type comment parsing (GH-19894) Message-ID: https://github.com/python/cpython/commit/603d3546264149f323edb7952b60075fb6bc4dc2 commit: 603d3546264149f323edb7952b60075fb6bc4dc2 branch: master author: Shantanu committer: GitHub date: 2020-05-03T22:08:14-07:00 summary: bpo-40493: fix function type comment parsing (GH-19894) The grammar for func_type_input rejected things like `(*t1) ->t2`. This fixes that. Automerge-Triggered-By: @gvanrossum files: M Grammar/python.gram M Lib/test/test_type_comments.py M Parser/pegen/parse.c diff --git a/Grammar/python.gram b/Grammar/python.gram index cbd4bc010dc1e..8e494905cea32 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -40,6 +40,10 @@ type_expressions[asdl_seq*]: _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_seq_append_to_end(p, a, b)), c) } | a=','.expression+ ',' '*' b=expression { _PyPegen_seq_append_to_end(p, a, b) } | a=','.expression+ ',' '**' b=expression { _PyPegen_seq_append_to_end(p, a, b) } + | '*' a=expression ',' '**' b=expression { + _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_singleton_seq(p, a)), b) } + | '*' a=expression { _PyPegen_singleton_seq(p, a) } + | '**' a=expression { _PyPegen_singleton_seq(p, a) } | ','.expression+ statements[asdl_seq*]: a=statement+ { _PyPegen_seq_flatten(p, a) } diff --git a/Lib/test/test_type_comments.py b/Lib/test/test_type_comments.py index 6027b3b56f76f..71d1430dbc939 100644 --- a/Lib/test/test_type_comments.py +++ b/Lib/test/test_type_comments.py @@ -399,6 +399,14 @@ def parse_func_type_input(source): self.assertEqual(tree.argtypes[2].id, "Any") self.assertEqual(tree.returns.id, "float") + tree = parse_func_type_input("(*int) -> None") + self.assertEqual(tree.argtypes[0].id, "int") + tree = parse_func_type_input("(**int) -> None") + self.assertEqual(tree.argtypes[0].id, "int") + tree = parse_func_type_input("(*int, **str) -> None") + self.assertEqual(tree.argtypes[0].id, "int") + self.assertEqual(tree.argtypes[1].id, "str") + with self.assertRaises(SyntaxError): tree = parse_func_type_input("(int, *str, *Any) -> float") diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index b4745ba4d4f26..492b5e6f9e2b7 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -825,6 +825,9 @@ fstring_rule(Parser *p) // | ','.expression+ ',' '*' expression ',' '**' expression // | ','.expression+ ',' '*' expression // | ','.expression+ ',' '**' expression +// | '*' expression ',' '**' expression +// | '*' expression +// | '**' expression // | ','.expression+ static asdl_seq* type_expressions_rule(Parser *p) @@ -915,6 +918,69 @@ type_expressions_rule(Parser *p) } p->mark = mark; } + { // '*' expression ',' '**' expression + expr_ty a; + expr_ty b; + Token * literal; + Token * literal_1; + Token * literal_2; + if ( + (literal = _PyPegen_expect_token(p, 16)) + && + (a = expression_rule(p)) + && + (literal_1 = _PyPegen_expect_token(p, 12)) + && + (literal_2 = _PyPegen_expect_token(p, 35)) + && + (b = expression_rule(p)) + ) + { + res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // '*' expression + expr_ty a; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 16)) + && + (a = expression_rule(p)) + ) + { + res = _PyPegen_singleton_seq ( p , a ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // '**' expression + expr_ty a; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 35)) + && + (a = expression_rule(p)) + ) + { + res = _PyPegen_singleton_seq ( p , a ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } { // ','.expression+ asdl_seq * _gather_9_var; if ( From webhook-mailer at python.org Mon May 4 03:56:13 2020 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 04 May 2020 07:56:13 -0000 Subject: [Python-checkins] bpo-40408: Fix support of nested type variables in GenericAlias. (GH-19836) Message-ID: https://github.com/python/cpython/commit/41a64587a0fd68bcd21ba42999cd3940801dff7c commit: 41a64587a0fd68bcd21ba42999cd3940801dff7c branch: master author: Serhiy Storchaka committer: GitHub date: 2020-05-04T10:56:05+03:00 summary: bpo-40408: Fix support of nested type variables in GenericAlias. (GH-19836) files: A Misc/NEWS.d/next/Core and Builtins/2020-05-01-15-36-14.bpo-40408.XzQI59.rst M Lib/test/test_genericalias.py M Objects/genericaliasobject.c diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py index 37cbf92ed1161..024b2f6ed6636 100644 --- a/Lib/test/test_genericalias.py +++ b/Lib/test/test_genericalias.py @@ -41,6 +41,8 @@ from typing import TypeVar T = TypeVar('T') +K = TypeVar('K') +V = TypeVar('V') class BaseTest(unittest.TestCase): """Test basics.""" @@ -170,10 +172,7 @@ def test_exposed_type(self): self.assertEqual(a.__parameters__, ()) def test_parameters(self): - from typing import TypeVar - T = TypeVar('T') - K = TypeVar('K') - V = TypeVar('V') + from typing import List, Dict, Callable D0 = dict[str, int] self.assertEqual(D0.__args__, (str, int)) self.assertEqual(D0.__parameters__, ()) @@ -195,14 +194,43 @@ def test_parameters(self): L1 = list[T] self.assertEqual(L1.__args__, (T,)) self.assertEqual(L1.__parameters__, (T,)) + L2 = list[list[T]] + self.assertEqual(L2.__args__, (list[T],)) + self.assertEqual(L2.__parameters__, (T,)) + L3 = list[List[T]] + self.assertEqual(L3.__args__, (List[T],)) + self.assertEqual(L3.__parameters__, (T,)) + L4a = list[Dict[K, V]] + self.assertEqual(L4a.__args__, (Dict[K, V],)) + self.assertEqual(L4a.__parameters__, (K, V)) + L4b = list[Dict[T, int]] + self.assertEqual(L4b.__args__, (Dict[T, int],)) + self.assertEqual(L4b.__parameters__, (T,)) + L5 = list[Callable[[K, V], K]] + self.assertEqual(L5.__args__, (Callable[[K, V], K],)) + self.assertEqual(L5.__parameters__, (K, V)) def test_parameter_chaining(self): - from typing import TypeVar - T = TypeVar('T') + from typing import List, Dict, Union, Callable self.assertEqual(list[T][int], list[int]) self.assertEqual(dict[str, T][int], dict[str, int]) self.assertEqual(dict[T, int][str], dict[str, int]) + self.assertEqual(dict[K, V][str, int], dict[str, int]) self.assertEqual(dict[T, T][int], dict[int, int]) + + self.assertEqual(list[list[T]][int], list[list[int]]) + self.assertEqual(list[dict[T, int]][str], list[dict[str, int]]) + self.assertEqual(list[dict[str, T]][int], list[dict[str, int]]) + self.assertEqual(list[dict[K, V]][str, int], list[dict[str, int]]) + self.assertEqual(dict[T, list[int]][str], dict[str, list[int]]) + + self.assertEqual(list[List[T]][int], list[List[int]]) + self.assertEqual(list[Dict[K, V]][str, int], list[Dict[str, int]]) + self.assertEqual(list[Union[K, V]][str, int], list[Union[str, int]]) + self.assertEqual(list[Callable[[K, V], K]][str, int], + list[Callable[[str, int], str]]) + self.assertEqual(dict[T, List[int]][str], dict[str, List[int]]) + with self.assertRaises(TypeError): list[int][int] dict[T, int][str, int] @@ -255,7 +283,6 @@ def test_union(self): self.assertEqual(a.__parameters__, ()) def test_union_generic(self): - T = typing.TypeVar('T') a = typing.Union[list[T], tuple[T, ...]] self.assertEqual(a.__args__, (list[T], tuple[T, ...])) self.assertEqual(a.__parameters__, (T,)) diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-01-15-36-14.bpo-40408.XzQI59.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-15-36-14.bpo-40408.XzQI59.rst new file mode 100644 index 0000000000000..e6822f9c24044 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-15-36-14.bpo-40408.XzQI59.rst @@ -0,0 +1,2 @@ +Fixed support of nested type variables in GenericAlias (e.g. +``list[list[T]]``). diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index a56bdda38177f..c06d79c556190 100644 --- a/Objects/genericaliasobject.c +++ b/Objects/genericaliasobject.c @@ -182,28 +182,60 @@ tuple_index(PyObject *self, Py_ssize_t len, PyObject *item) return -1; } -// tuple(t for t in args if isinstance(t, TypeVar)) +static int +tuple_add(PyObject *self, Py_ssize_t len, PyObject *item) +{ + if (tuple_index(self, len, item) < 0) { + Py_INCREF(item); + PyTuple_SET_ITEM(self, len, item); + return 1; + } + return 0; +} + static PyObject * make_parameters(PyObject *args) { - Py_ssize_t len = PyTuple_GET_SIZE(args); + Py_ssize_t nargs = PyTuple_GET_SIZE(args); + Py_ssize_t len = nargs; PyObject *parameters = PyTuple_New(len); if (parameters == NULL) return NULL; Py_ssize_t iparam = 0; - for (Py_ssize_t iarg = 0; iarg < len; iarg++) { + for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) { PyObject *t = PyTuple_GET_ITEM(args, iarg); int typevar = is_typevar(t); if (typevar < 0) { - Py_XDECREF(parameters); + Py_DECREF(parameters); return NULL; } if (typevar) { - if (tuple_index(parameters, iparam, t) < 0) { - Py_INCREF(t); - PyTuple_SET_ITEM(parameters, iparam, t); - iparam++; + iparam += tuple_add(parameters, iparam, t); + } + else { + _Py_IDENTIFIER(__parameters__); + PyObject *subparams; + if (_PyObject_LookupAttrId(t, &PyId___parameters__, &subparams) < 0) { + Py_DECREF(parameters); + return NULL; + } + if (subparams && PyTuple_Check(subparams)) { + Py_ssize_t len2 = PyTuple_GET_SIZE(subparams); + Py_ssize_t needed = len2 - 1 - (iarg - iparam); + if (needed > 0) { + len += needed; + if (_PyTuple_Resize(¶meters, len) < 0) { + Py_DECREF(subparams); + Py_DECREF(parameters); + return NULL; + } + } + for (Py_ssize_t j = 0; j < len2; j++) { + PyObject *t2 = PyTuple_GET_ITEM(subparams, j); + iparam += tuple_add(parameters, iparam, t2); + } } + Py_XDECREF(subparams); } } if (iparam < len) { @@ -215,6 +247,48 @@ make_parameters(PyObject *args) return parameters; } +/* If obj is a generic alias, substitute type variables params + with substitutions argitems. For example, if obj is list[T], + params is (T, S), and argitems is (str, int), return list[str]. + If obj doesn't have a __parameters__ attribute or that's not + a non-empty tuple, return a new reference to obj. */ +static PyObject * +subs_tvars(PyObject *obj, PyObject *params, PyObject **argitems) +{ + _Py_IDENTIFIER(__parameters__); + PyObject *subparams; + if (_PyObject_LookupAttrId(obj, &PyId___parameters__, &subparams) < 0) { + return NULL; + } + if (subparams && PyTuple_Check(subparams) && PyTuple_GET_SIZE(subparams)) { + Py_ssize_t nparams = PyTuple_GET_SIZE(params); + Py_ssize_t nsubargs = PyTuple_GET_SIZE(subparams); + PyObject *subargs = PyTuple_New(nsubargs); + if (subargs == NULL) { + Py_DECREF(subparams); + return NULL; + } + for (Py_ssize_t i = 0; i < nsubargs; ++i) { + PyObject *arg = PyTuple_GET_ITEM(subparams, i); + Py_ssize_t iparam = tuple_index(params, nparams, arg); + if (iparam >= 0) { + arg = argitems[iparam]; + } + Py_INCREF(arg); + PyTuple_SET_ITEM(subargs, i, arg); + } + + obj = PyObject_GetItem(obj, subargs); + + Py_DECREF(subargs); + } + else { + Py_INCREF(obj); + } + Py_XDECREF(subparams); + return obj; +} + static PyObject * ga_getitem(PyObject *self, PyObject *item) { @@ -233,17 +307,25 @@ ga_getitem(PyObject *self, PyObject *item) self); } int is_tuple = PyTuple_Check(item); - Py_ssize_t nitem = is_tuple ? PyTuple_GET_SIZE(item) : 1; - if (nitem != nparams) { + Py_ssize_t nitems = is_tuple ? PyTuple_GET_SIZE(item) : 1; + PyObject **argitems = is_tuple ? &PyTuple_GET_ITEM(item, 0) : &item; + if (nitems != nparams) { return PyErr_Format(PyExc_TypeError, "Too %s arguments for %R", - nitem > nparams ? "many" : "few", + nitems > nparams ? "many" : "few", self); } + /* Replace all type variables (specified by alias->parameters) + with corresponding values specified by argitems. + t = list[T]; t[int] -> newargs = [int] + t = dict[str, T]; t[int] -> newargs = [str, int] + t = dict[T, list[S]]; t[str, int] -> newargs = [str, list[int]] + */ Py_ssize_t nargs = PyTuple_GET_SIZE(alias->args); PyObject *newargs = PyTuple_New(nargs); - if (newargs == NULL) + if (newargs == NULL) { return NULL; + } for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) { PyObject *arg = PyTuple_GET_ITEM(alias->args, iarg); int typevar = is_typevar(arg); @@ -254,18 +336,21 @@ ga_getitem(PyObject *self, PyObject *item) if (typevar) { Py_ssize_t iparam = tuple_index(alias->parameters, nparams, arg); assert(iparam >= 0); - if (is_tuple) { - arg = PyTuple_GET_ITEM(item, iparam); - } - else { - assert(iparam == 0); - arg = item; + arg = argitems[iparam]; + Py_INCREF(arg); + } + else { + arg = subs_tvars(arg, alias->parameters, argitems); + if (arg == NULL) { + Py_DECREF(newargs); + return NULL; } } - Py_INCREF(arg); PyTuple_SET_ITEM(newargs, iarg, arg); } + PyObject *res = Py_GenericAlias(alias->origin, newargs); + Py_DECREF(newargs); return res; } From webhook-mailer at python.org Mon May 4 04:13:34 2020 From: webhook-mailer at python.org (Shantanu) Date: Mon, 04 May 2020 08:13:34 -0000 Subject: [Python-checkins] bpo-40491: Fix typo in syntax error for numeric literals (GH-19893) Message-ID: https://github.com/python/cpython/commit/c3f001461d5794c81cf5f70e08ae5435fe935ceb commit: c3f001461d5794c81cf5f70e08ae5435fe935ceb branch: master author: Shantanu committer: GitHub date: 2020-05-04T11:13:30+03:00 summary: bpo-40491: Fix typo in syntax error for numeric literals (GH-19893) files: M Parser/pegen/pegen.c diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index 9858f71c83c79..391f9b91eab90 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -907,7 +907,7 @@ _PyPegen_number_token(Parser *p) if (p->feature_version < 6 && strchr(num_raw, '_') != NULL) { p->error_indicator = 1; - return RAISE_SYNTAX_ERROR("Underscores in numeric literals are only supported" + return RAISE_SYNTAX_ERROR("Underscores in numeric literals are only supported " "in Python 3.6 and greater"); } From webhook-mailer at python.org Mon May 4 06:58:43 2020 From: webhook-mailer at python.org (Lysandros Nikolaou) Date: Mon, 04 May 2020 10:58:43 -0000 Subject: [Python-checkins] bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865) Message-ID: https://github.com/python/cpython/commit/e10e7c771bf06112c4a311e0ef6b8af6423b0cca commit: e10e7c771bf06112c4a311e0ef6b8af6423b0cca branch: master author: Lysandros Nikolaou committer: GitHub date: 2020-05-04T11:58:31+01:00 summary: bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865) When parsing things like `def f(*): pass` the old parser used to output `SyntaxError: named arguments must follow bare *`, which the new parser wasn't able to do. files: M Grammar/python.gram M Lib/test/test_exceptions.py M Lib/test/test_peg_parser.py M Lib/test/test_syntax.py M Parser/pegen/parse.c diff --git a/Grammar/python.gram b/Grammar/python.gram index 8e494905cea32..0ce6ab4b4ba90 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -249,6 +249,7 @@ star_etc[StarEtc*]: | '*' ',' b=param_maybe_default+ c=[kwds] { _PyPegen_star_etc(p, NULL, b, c) } | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) } + | invalid_star_etc kwds[arg_ty]: '**' a=param_no_default { a } @@ -356,6 +357,7 @@ lambda_star_etc[StarEtc*]: | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] { _PyPegen_star_etc(p, NULL, b, c) } | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) } + | invalid_lambda_star_etc lambda_kwds[arg_ty]: '**' a=lambda_param_no_default { a } @@ -636,6 +638,10 @@ invalid_comprehension: invalid_parameters: | param_no_default* (slash_with_default | param_with_default+) param_no_default { RAISE_SYNTAX_ERROR("non-default argument follows default argument") } +invalid_star_etc: + | '*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") } +invalid_lambda_star_etc: + | '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") } invalid_double_type_comments: | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT { RAISE_SYNTAX_ERROR("Cannot have two type comments on def") } diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 354b3f4843718..d83b73ab340c3 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -242,11 +242,11 @@ def baz(): check('from __future__ import doesnt_exist', 1, 1) check('from __future__ import braces', 1, 1) check('x=1\nfrom __future__ import division', 2, 1) + check('def f(*):\n pass', 1, 7 if support.use_old_parser() else 8) @support.skip_if_new_parser("Pegen column offsets might be different") def testSyntaxErrorOffsetCustom(self): self.check('for 1 in []: pass', 1, 5) - self.check('def f(*):\n pass', 1, 7) self.check('[*x for x in xs]', 1, 2) self.check('def f():\n x, y: int', 2, 3) self.check('(yield i) = 2', 1, 1) diff --git a/Lib/test/test_peg_parser.py b/Lib/test/test_peg_parser.py index 191494481eb0a..d6939fdbf618a 100644 --- a/Lib/test/test_peg_parser.py +++ b/Lib/test/test_peg_parser.py @@ -603,6 +603,12 @@ def f(): ("1 += 1", "cannot assign to literal"), ("pass\n pass", "unexpected indent"), ("def f():\npass", "expected an indented block"), + ("def f(*): pass", "named arguments must follow bare *"), + ("def f(*,): pass", "named arguments must follow bare *"), + ("def f(*, **a): pass", "named arguments must follow bare *"), + ("lambda *: pass", "named arguments must follow bare *"), + ("lambda *,: pass", "named arguments must follow bare *"), + ("lambda *, **a: pass", "named arguments must follow bare *"), ] GOOD_BUT_FAIL_TEST_CASES = [ diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index e7468cae7b132..0c0fc48e0d3de 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -627,9 +627,9 @@ Traceback (most recent call last): SyntaxError: cannot assign to __debug__ - # >>> with (lambda *:0): pass - # Traceback (most recent call last): - # SyntaxError: named arguments must follow bare * + >>> with (lambda *:0): pass + Traceback (most recent call last): + SyntaxError: named arguments must follow bare * Corner-cases that used to crash: diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 492b5e6f9e2b7..55605d5770f1e 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -215,150 +215,156 @@ static KeywordToken *reserved_keywords[] = { #define invalid_block_type 1144 #define invalid_comprehension_type 1145 #define invalid_parameters_type 1146 -#define invalid_double_type_comments_type 1147 -#define _loop0_1_type 1148 -#define _loop0_2_type 1149 -#define _loop0_4_type 1150 -#define _gather_3_type 1151 -#define _loop0_6_type 1152 -#define _gather_5_type 1153 -#define _loop0_8_type 1154 -#define _gather_7_type 1155 -#define _loop0_10_type 1156 -#define _gather_9_type 1157 -#define _loop1_11_type 1158 -#define _loop0_13_type 1159 -#define _gather_12_type 1160 -#define _tmp_14_type 1161 -#define _tmp_15_type 1162 -#define _tmp_16_type 1163 -#define _tmp_17_type 1164 -#define _tmp_18_type 1165 -#define _tmp_19_type 1166 -#define _tmp_20_type 1167 -#define _tmp_21_type 1168 -#define _loop1_22_type 1169 -#define _tmp_23_type 1170 -#define _tmp_24_type 1171 -#define _loop0_26_type 1172 -#define _gather_25_type 1173 -#define _loop0_28_type 1174 -#define _gather_27_type 1175 -#define _tmp_29_type 1176 -#define _loop0_30_type 1177 -#define _loop1_31_type 1178 -#define _loop0_33_type 1179 -#define _gather_32_type 1180 -#define _tmp_34_type 1181 -#define _loop0_36_type 1182 -#define _gather_35_type 1183 -#define _tmp_37_type 1184 -#define _loop0_39_type 1185 -#define _gather_38_type 1186 -#define _loop0_41_type 1187 -#define _gather_40_type 1188 -#define _loop0_43_type 1189 -#define _gather_42_type 1190 -#define _loop0_45_type 1191 -#define _gather_44_type 1192 -#define _tmp_46_type 1193 -#define _loop1_47_type 1194 -#define _tmp_48_type 1195 -#define _tmp_49_type 1196 -#define _tmp_50_type 1197 -#define _tmp_51_type 1198 -#define _tmp_52_type 1199 -#define _loop0_53_type 1200 -#define _loop0_54_type 1201 -#define _loop0_55_type 1202 -#define _loop1_56_type 1203 -#define _loop0_57_type 1204 -#define _loop1_58_type 1205 -#define _loop1_59_type 1206 -#define _loop1_60_type 1207 -#define _loop0_61_type 1208 -#define _loop1_62_type 1209 -#define _loop0_63_type 1210 -#define _loop1_64_type 1211 -#define _loop0_65_type 1212 -#define _loop1_66_type 1213 -#define _loop1_67_type 1214 -#define _tmp_68_type 1215 -#define _loop0_70_type 1216 -#define _gather_69_type 1217 -#define _loop1_71_type 1218 -#define _loop0_73_type 1219 -#define _gather_72_type 1220 -#define _loop1_74_type 1221 -#define _loop0_75_type 1222 -#define _loop0_76_type 1223 -#define _loop0_77_type 1224 -#define _loop1_78_type 1225 -#define _loop0_79_type 1226 -#define _loop1_80_type 1227 -#define _loop1_81_type 1228 -#define _loop1_82_type 1229 -#define _loop0_83_type 1230 -#define _loop1_84_type 1231 -#define _loop0_85_type 1232 -#define _loop1_86_type 1233 -#define _loop0_87_type 1234 -#define _loop1_88_type 1235 -#define _loop1_89_type 1236 -#define _loop1_90_type 1237 -#define _loop1_91_type 1238 -#define _tmp_92_type 1239 -#define _loop0_94_type 1240 -#define _gather_93_type 1241 -#define _tmp_95_type 1242 -#define _tmp_96_type 1243 -#define _tmp_97_type 1244 -#define _tmp_98_type 1245 -#define _loop1_99_type 1246 -#define _tmp_100_type 1247 -#define _tmp_101_type 1248 -#define _loop0_103_type 1249 -#define _gather_102_type 1250 -#define _loop1_104_type 1251 -#define _loop0_105_type 1252 -#define _loop0_106_type 1253 -#define _tmp_107_type 1254 -#define _tmp_108_type 1255 -#define _loop0_110_type 1256 -#define _gather_109_type 1257 -#define _loop0_112_type 1258 -#define _gather_111_type 1259 -#define _loop0_114_type 1260 -#define _gather_113_type 1261 -#define _loop0_116_type 1262 -#define _gather_115_type 1263 -#define _loop0_117_type 1264 -#define _loop0_119_type 1265 -#define _gather_118_type 1266 -#define _tmp_120_type 1267 -#define _loop0_122_type 1268 -#define _gather_121_type 1269 -#define _loop0_124_type 1270 -#define _gather_123_type 1271 -#define _tmp_125_type 1272 -#define _tmp_126_type 1273 -#define _tmp_127_type 1274 -#define _tmp_128_type 1275 -#define _tmp_129_type 1276 -#define _loop0_130_type 1277 -#define _tmp_131_type 1278 -#define _tmp_132_type 1279 -#define _tmp_133_type 1280 -#define _tmp_134_type 1281 -#define _tmp_135_type 1282 -#define _tmp_136_type 1283 -#define _tmp_137_type 1284 -#define _tmp_138_type 1285 -#define _tmp_139_type 1286 -#define _tmp_140_type 1287 -#define _tmp_141_type 1288 -#define _tmp_142_type 1289 -#define _loop1_143_type 1290 +#define invalid_star_etc_type 1147 +#define invalid_lambda_star_etc_type 1148 +#define invalid_double_type_comments_type 1149 +#define _loop0_1_type 1150 +#define _loop0_2_type 1151 +#define _loop0_4_type 1152 +#define _gather_3_type 1153 +#define _loop0_6_type 1154 +#define _gather_5_type 1155 +#define _loop0_8_type 1156 +#define _gather_7_type 1157 +#define _loop0_10_type 1158 +#define _gather_9_type 1159 +#define _loop1_11_type 1160 +#define _loop0_13_type 1161 +#define _gather_12_type 1162 +#define _tmp_14_type 1163 +#define _tmp_15_type 1164 +#define _tmp_16_type 1165 +#define _tmp_17_type 1166 +#define _tmp_18_type 1167 +#define _tmp_19_type 1168 +#define _tmp_20_type 1169 +#define _tmp_21_type 1170 +#define _loop1_22_type 1171 +#define _tmp_23_type 1172 +#define _tmp_24_type 1173 +#define _loop0_26_type 1174 +#define _gather_25_type 1175 +#define _loop0_28_type 1176 +#define _gather_27_type 1177 +#define _tmp_29_type 1178 +#define _loop0_30_type 1179 +#define _loop1_31_type 1180 +#define _loop0_33_type 1181 +#define _gather_32_type 1182 +#define _tmp_34_type 1183 +#define _loop0_36_type 1184 +#define _gather_35_type 1185 +#define _tmp_37_type 1186 +#define _loop0_39_type 1187 +#define _gather_38_type 1188 +#define _loop0_41_type 1189 +#define _gather_40_type 1190 +#define _loop0_43_type 1191 +#define _gather_42_type 1192 +#define _loop0_45_type 1193 +#define _gather_44_type 1194 +#define _tmp_46_type 1195 +#define _loop1_47_type 1196 +#define _tmp_48_type 1197 +#define _tmp_49_type 1198 +#define _tmp_50_type 1199 +#define _tmp_51_type 1200 +#define _tmp_52_type 1201 +#define _loop0_53_type 1202 +#define _loop0_54_type 1203 +#define _loop0_55_type 1204 +#define _loop1_56_type 1205 +#define _loop0_57_type 1206 +#define _loop1_58_type 1207 +#define _loop1_59_type 1208 +#define _loop1_60_type 1209 +#define _loop0_61_type 1210 +#define _loop1_62_type 1211 +#define _loop0_63_type 1212 +#define _loop1_64_type 1213 +#define _loop0_65_type 1214 +#define _loop1_66_type 1215 +#define _loop1_67_type 1216 +#define _tmp_68_type 1217 +#define _loop0_70_type 1218 +#define _gather_69_type 1219 +#define _loop1_71_type 1220 +#define _loop0_73_type 1221 +#define _gather_72_type 1222 +#define _loop1_74_type 1223 +#define _loop0_75_type 1224 +#define _loop0_76_type 1225 +#define _loop0_77_type 1226 +#define _loop1_78_type 1227 +#define _loop0_79_type 1228 +#define _loop1_80_type 1229 +#define _loop1_81_type 1230 +#define _loop1_82_type 1231 +#define _loop0_83_type 1232 +#define _loop1_84_type 1233 +#define _loop0_85_type 1234 +#define _loop1_86_type 1235 +#define _loop0_87_type 1236 +#define _loop1_88_type 1237 +#define _loop1_89_type 1238 +#define _loop1_90_type 1239 +#define _loop1_91_type 1240 +#define _tmp_92_type 1241 +#define _loop0_94_type 1242 +#define _gather_93_type 1243 +#define _tmp_95_type 1244 +#define _tmp_96_type 1245 +#define _tmp_97_type 1246 +#define _tmp_98_type 1247 +#define _loop1_99_type 1248 +#define _tmp_100_type 1249 +#define _tmp_101_type 1250 +#define _loop0_103_type 1251 +#define _gather_102_type 1252 +#define _loop1_104_type 1253 +#define _loop0_105_type 1254 +#define _loop0_106_type 1255 +#define _tmp_107_type 1256 +#define _tmp_108_type 1257 +#define _loop0_110_type 1258 +#define _gather_109_type 1259 +#define _loop0_112_type 1260 +#define _gather_111_type 1261 +#define _loop0_114_type 1262 +#define _gather_113_type 1263 +#define _loop0_116_type 1264 +#define _gather_115_type 1265 +#define _loop0_117_type 1266 +#define _loop0_119_type 1267 +#define _gather_118_type 1268 +#define _tmp_120_type 1269 +#define _loop0_122_type 1270 +#define _gather_121_type 1271 +#define _loop0_124_type 1272 +#define _gather_123_type 1273 +#define _tmp_125_type 1274 +#define _tmp_126_type 1275 +#define _tmp_127_type 1276 +#define _tmp_128_type 1277 +#define _tmp_129_type 1278 +#define _loop0_130_type 1279 +#define _tmp_131_type 1280 +#define _tmp_132_type 1281 +#define _tmp_133_type 1282 +#define _tmp_134_type 1283 +#define _tmp_135_type 1284 +#define _tmp_136_type 1285 +#define _tmp_137_type 1286 +#define _tmp_138_type 1287 +#define _tmp_139_type 1288 +#define _tmp_140_type 1289 +#define _tmp_141_type 1290 +#define _tmp_142_type 1291 +#define _tmp_143_type 1292 +#define _tmp_144_type 1293 +#define _loop1_145_type 1294 +#define _tmp_146_type 1295 +#define _tmp_147_type 1296 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -507,6 +513,8 @@ static void *invalid_assignment_rule(Parser *p); static void *invalid_block_rule(Parser *p); static void *invalid_comprehension_rule(Parser *p); static void *invalid_parameters_rule(Parser *p); +static void *invalid_star_etc_rule(Parser *p); +static void *invalid_lambda_star_etc_rule(Parser *p); static void *invalid_double_type_comments_rule(Parser *p); static asdl_seq *_loop0_1_rule(Parser *p); static asdl_seq *_loop0_2_rule(Parser *p); @@ -650,7 +658,11 @@ static void *_tmp_139_rule(Parser *p); static void *_tmp_140_rule(Parser *p); static void *_tmp_141_rule(Parser *p); static void *_tmp_142_rule(Parser *p); -static asdl_seq *_loop1_143_rule(Parser *p); +static void *_tmp_143_rule(Parser *p); +static void *_tmp_144_rule(Parser *p); +static asdl_seq *_loop1_145_rule(Parser *p); +static void *_tmp_146_rule(Parser *p); +static void *_tmp_147_rule(Parser *p); // file: statements? $ @@ -4064,6 +4076,7 @@ slash_with_default_rule(Parser *p) // | '*' param_no_default param_maybe_default* kwds? // | '*' ',' param_maybe_default+ kwds? // | kwds +// | invalid_star_etc static StarEtc* star_etc_rule(Parser *p) { @@ -4135,6 +4148,17 @@ star_etc_rule(Parser *p) } p->mark = mark; } + { // invalid_star_etc + void *invalid_star_etc_var; + if ( + (invalid_star_etc_var = invalid_star_etc_rule(p)) + ) + { + res = invalid_star_etc_var; + goto done; + } + p->mark = mark; + } res = NULL; done: return res; @@ -5512,6 +5536,7 @@ lambda_slash_with_default_rule(Parser *p) // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? // | '*' ',' lambda_param_maybe_default+ lambda_kwds? // | lambda_kwds +// | invalid_lambda_star_etc static StarEtc* lambda_star_etc_rule(Parser *p) { @@ -5583,6 +5608,17 @@ lambda_star_etc_rule(Parser *p) } p->mark = mark; } + { // invalid_lambda_star_etc + void *invalid_lambda_star_etc_var; + if ( + (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) + ) + { + res = invalid_lambda_star_etc_var; + goto done; + } + p->mark = mark; + } res = NULL; done: return res; @@ -10757,6 +10793,70 @@ invalid_parameters_rule(Parser *p) return res; } +// invalid_star_etc: '*' (')' | ',' (')' | '**')) +static void * +invalid_star_etc_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void * res = NULL; + int mark = p->mark; + { // '*' (')' | ',' (')' | '**')) + void *_tmp_132_var; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 16)) + && + (_tmp_132_var = _tmp_132_rule(p)) + ) + { + res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) +static void * +invalid_lambda_star_etc_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void * res = NULL; + int mark = p->mark; + { // '*' (':' | ',' (':' | '**')) + void *_tmp_133_var; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 16)) + && + (_tmp_133_var = _tmp_133_rule(p)) + ) + { + res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT static void * invalid_double_type_comments_rule(Parser *p) @@ -11693,12 +11793,12 @@ _loop1_22_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (star_targets '=') - void *_tmp_132_var; + void *_tmp_134_var; while ( - (_tmp_132_var = _tmp_132_rule(p)) + (_tmp_134_var = _tmp_134_rule(p)) ) { - res = _tmp_132_var; + res = _tmp_134_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -12020,12 +12120,12 @@ _loop0_30_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('.' | '...') - void *_tmp_133_var; + void *_tmp_135_var; while ( - (_tmp_133_var = _tmp_133_rule(p)) + (_tmp_135_var = _tmp_135_rule(p)) ) { - res = _tmp_133_var; + res = _tmp_135_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -12069,12 +12169,12 @@ _loop1_31_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('.' | '...') - void *_tmp_134_var; + void *_tmp_136_var; while ( - (_tmp_134_var = _tmp_134_rule(p)) + (_tmp_136_var = _tmp_136_rule(p)) ) { - res = _tmp_134_var; + res = _tmp_136_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13651,12 +13751,12 @@ _loop1_67_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('@' named_expression NEWLINE) - void *_tmp_135_var; + void *_tmp_137_var; while ( - (_tmp_135_var = _tmp_135_rule(p)) + (_tmp_137_var = _tmp_137_rule(p)) ) { - res = _tmp_135_var; + res = _tmp_137_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13824,12 +13924,12 @@ _loop1_71_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' star_expression) - void *_tmp_136_var; + void *_tmp_138_var; while ( - (_tmp_136_var = _tmp_136_rule(p)) + (_tmp_138_var = _tmp_138_rule(p)) ) { - res = _tmp_136_var; + res = _tmp_138_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13962,12 +14062,12 @@ _loop1_74_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' expression) - void *_tmp_137_var; + void *_tmp_139_var; while ( - (_tmp_137_var = _tmp_137_rule(p)) + (_tmp_139_var = _tmp_139_rule(p)) ) { - res = _tmp_137_var; + res = _tmp_139_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14729,12 +14829,12 @@ _loop1_89_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('or' conjunction) - void *_tmp_138_var; + void *_tmp_140_var; while ( - (_tmp_138_var = _tmp_138_rule(p)) + (_tmp_140_var = _tmp_140_rule(p)) ) { - res = _tmp_138_var; + res = _tmp_140_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14782,12 +14882,12 @@ _loop1_90_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('and' inversion) - void *_tmp_139_var; + void *_tmp_141_var; while ( - (_tmp_139_var = _tmp_139_rule(p)) + (_tmp_141_var = _tmp_141_rule(p)) ) { - res = _tmp_139_var; + res = _tmp_141_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15437,12 +15537,12 @@ _loop0_105_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('if' disjunction) - void *_tmp_140_var; + void *_tmp_142_var; while ( - (_tmp_140_var = _tmp_140_rule(p)) + (_tmp_142_var = _tmp_142_rule(p)) ) { - res = _tmp_140_var; + res = _tmp_142_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15486,12 +15586,12 @@ _loop0_106_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('if' disjunction) - void *_tmp_141_var; + void *_tmp_143_var; while ( - (_tmp_141_var = _tmp_141_rule(p)) + (_tmp_143_var = _tmp_143_rule(p)) ) { - res = _tmp_141_var; + res = _tmp_143_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15939,12 +16039,12 @@ _loop0_117_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' star_target) - void *_tmp_142_var; + void *_tmp_144_var; while ( - (_tmp_142_var = _tmp_142_rule(p)) + (_tmp_144_var = _tmp_144_rule(p)) ) { - res = _tmp_142_var; + res = _tmp_144_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -16508,12 +16608,12 @@ _tmp_131_rule(Parser *p) p->mark = mark; } { // param_with_default+ - asdl_seq * _loop1_143_var; + asdl_seq * _loop1_145_var; if ( - (_loop1_143_var = _loop1_143_rule(p)) + (_loop1_145_var = _loop1_145_rule(p)) ) { - res = _loop1_143_var; + res = _loop1_145_var; goto done; } p->mark = mark; @@ -16523,9 +16623,87 @@ _tmp_131_rule(Parser *p) return res; } -// _tmp_132: star_targets '=' +// _tmp_132: ')' | ',' (')' | '**') static void * _tmp_132_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void * res = NULL; + int mark = p->mark; + { // ')' + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 8)) + ) + { + res = literal; + goto done; + } + p->mark = mark; + } + { // ',' (')' | '**') + void *_tmp_146_var; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 12)) + && + (_tmp_146_var = _tmp_146_rule(p)) + ) + { + res = _PyPegen_dummy_name(p, literal, _tmp_146_var); + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// _tmp_133: ':' | ',' (':' | '**') +static void * +_tmp_133_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void * res = NULL; + int mark = p->mark; + { // ':' + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 11)) + ) + { + res = literal; + goto done; + } + p->mark = mark; + } + { // ',' (':' | '**') + void *_tmp_147_var; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 12)) + && + (_tmp_147_var = _tmp_147_rule(p)) + ) + { + res = _PyPegen_dummy_name(p, literal, _tmp_147_var); + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// _tmp_134: star_targets '=' +static void * +_tmp_134_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16555,9 +16733,9 @@ _tmp_132_rule(Parser *p) return res; } -// _tmp_133: '.' | '...' +// _tmp_135: '.' | '...' static void * -_tmp_133_rule(Parser *p) +_tmp_135_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16591,9 +16769,9 @@ _tmp_133_rule(Parser *p) return res; } -// _tmp_134: '.' | '...' +// _tmp_136: '.' | '...' static void * -_tmp_134_rule(Parser *p) +_tmp_136_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16627,9 +16805,9 @@ _tmp_134_rule(Parser *p) return res; } -// _tmp_135: '@' named_expression NEWLINE +// _tmp_137: '@' named_expression NEWLINE static void * -_tmp_135_rule(Parser *p) +_tmp_137_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16662,9 +16840,9 @@ _tmp_135_rule(Parser *p) return res; } -// _tmp_136: ',' star_expression +// _tmp_138: ',' star_expression static void * -_tmp_136_rule(Parser *p) +_tmp_138_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16694,9 +16872,9 @@ _tmp_136_rule(Parser *p) return res; } -// _tmp_137: ',' expression +// _tmp_139: ',' expression static void * -_tmp_137_rule(Parser *p) +_tmp_139_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16726,9 +16904,9 @@ _tmp_137_rule(Parser *p) return res; } -// _tmp_138: 'or' conjunction +// _tmp_140: 'or' conjunction static void * -_tmp_138_rule(Parser *p) +_tmp_140_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16758,9 +16936,9 @@ _tmp_138_rule(Parser *p) return res; } -// _tmp_139: 'and' inversion +// _tmp_141: 'and' inversion static void * -_tmp_139_rule(Parser *p) +_tmp_141_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16790,9 +16968,9 @@ _tmp_139_rule(Parser *p) return res; } -// _tmp_140: 'if' disjunction +// _tmp_142: 'if' disjunction static void * -_tmp_140_rule(Parser *p) +_tmp_142_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16822,9 +17000,9 @@ _tmp_140_rule(Parser *p) return res; } -// _tmp_141: 'if' disjunction +// _tmp_143: 'if' disjunction static void * -_tmp_141_rule(Parser *p) +_tmp_143_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16854,9 +17032,9 @@ _tmp_141_rule(Parser *p) return res; } -// _tmp_142: ',' star_target +// _tmp_144: ',' star_target static void * -_tmp_142_rule(Parser *p) +_tmp_144_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16886,9 +17064,9 @@ _tmp_142_rule(Parser *p) return res; } -// _loop1_143: param_with_default +// _loop1_145: param_with_default static asdl_seq * -_loop1_143_rule(Parser *p) +_loop1_145_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16929,16 +17107,88 @@ _loop1_143_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_143"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_145"); PyMem_Free(children); return NULL; } for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]); PyMem_Free(children); - _PyPegen_insert_memo(p, start_mark, _loop1_143_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_145_type, seq); return seq; } +// _tmp_146: ')' | '**' +static void * +_tmp_146_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void * res = NULL; + int mark = p->mark; + { // ')' + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 8)) + ) + { + res = literal; + goto done; + } + p->mark = mark; + } + { // '**' + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 35)) + ) + { + res = literal; + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// _tmp_147: ':' | '**' +static void * +_tmp_147_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void * res = NULL; + int mark = p->mark; + { // ':' + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 11)) + ) + { + res = literal; + goto done; + } + p->mark = mark; + } + { // '**' + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 35)) + ) + { + res = literal; + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + void * _PyPegen_parse(Parser *p) { From webhook-mailer at python.org Mon May 4 07:32:41 2020 From: webhook-mailer at python.org (Lysandros Nikolaou) Date: Mon, 04 May 2020 11:32:41 -0000 Subject: [Python-checkins] bpo-40246: Revert reporting of invalid string prefixes (GH-19888) Message-ID: https://github.com/python/cpython/commit/846d8b28ab9bb6197ee81372820311c0abe509c0 commit: 846d8b28ab9bb6197ee81372820311c0abe509c0 branch: master author: Lysandros Nikolaou committer: GitHub date: 2020-05-04T12:32:18+01:00 summary: bpo-40246: Revert reporting of invalid string prefixes (GH-19888) Due to backwards compatibility concerns regarding keywords immediately followed by a string without whitespace between them (like in `bg="#d00" if clear else"#fca"`) will fail to parse, commit 41d5b94af44e34ac05d4cd57460ed104ccf96628 has to be reverted. files: A Misc/NEWS.d/next/Core and Builtins/2020-05-03-23-28-11.bpo-40246.c1D7x8.rst M Include/errcode.h M Lib/test/test_fstring.py M Parser/pegen/pegen.c M Parser/tokenizer.c M Python/pythonrun.c diff --git a/Include/errcode.h b/Include/errcode.h index 9af8d5c03d59b..b37cd261d5ec4 100644 --- a/Include/errcode.h +++ b/Include/errcode.h @@ -31,7 +31,6 @@ extern "C" { #define E_LINECONT 25 /* Unexpected characters after a line continuation */ #define E_IDENTIFIER 26 /* Invalid characters in identifier */ #define E_BADSINGLE 27 /* Ill-formed single statement input */ -#define E_BADPREFIX 28 /* Bad string prefixes */ #ifdef __cplusplus } diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py index fe465b7e1d43d..ac5aa9a76efe7 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -864,7 +864,7 @@ def test_invalid_string_prefixes(self): "Bf''", "BF''",] double_quote_cases = [case.replace("'", '"') for case in single_quote_cases] - self.assertAllRaise(SyntaxError, 'invalid string prefix', + self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing', single_quote_cases + double_quote_cases) def test_leading_trailing_spaces(self): diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-03-23-28-11.bpo-40246.c1D7x8.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-03-23-28-11.bpo-40246.c1D7x8.rst new file mode 100644 index 0000000000000..62cd632ffd070 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-03-23-28-11.bpo-40246.c1D7x8.rst @@ -0,0 +1 @@ +Reporting a specialised error message for invalid string prefixes, which was introduced in :issue:`40246`, is being reverted due to backwards compatibility concerns for strings that immediately follow a reserved keyword without whitespace between them. Constructs like `bg="#d00" if clear else"#fca"` were failing to parse, which is not an acceptable breakage on such short notice. diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index 391f9b91eab90..c311593af70f5 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -334,9 +334,6 @@ tokenizer_error(Parser *p) case E_IDENTIFIER: msg = "invalid character in identifier"; break; - case E_BADPREFIX: - RAISE_SYNTAX_ERROR("invalid string prefix"); - return -1; case E_EOFS: RAISE_SYNTAX_ERROR("EOF while scanning triple-quoted string literal"); return -1; diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 95dfc5388037d..0f2b6af5e50ad 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1396,10 +1396,6 @@ tok_get(struct tok_state *tok, const char **p_start, const char **p_end) *p_start = tok->start; *p_end = tok->cur; - if (c == '"' || c == '\'') { - tok->done = E_BADPREFIX; - return ERRORTOKEN; - } /* async/await parsing block. */ if (tok->cur - tok->start == 5 && tok->start[0] == 'a') { /* May be an 'async' or 'await' token. For Python 3.7 or diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 79147e430a1ad..1b79a33c814da 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1609,9 +1609,6 @@ err_input(perrdetail *err) case E_BADSINGLE: msg = "multiple statements found while compiling a single statement"; break; - case E_BADPREFIX: - msg = "invalid string prefix"; - break; default: fprintf(stderr, "error=%d\n", err->error); msg = "unknown parsing error"; From webhook-mailer at python.org Mon May 4 09:32:02 2020 From: webhook-mailer at python.org (Hai Shi) Date: Mon, 04 May 2020 13:32:02 -0000 Subject: [Python-checkins] bpo-39573: Use Py_IS_TYPE to check for types (GH-19882) Message-ID: https://github.com/python/cpython/commit/5e8ffe147710e449c2e935a4e2ff5cbd19828a8a commit: 5e8ffe147710e449c2e935a4e2ff5cbd19828a8a branch: master author: Hai Shi committer: GitHub date: 2020-05-04T22:31:38+09:00 summary: bpo-39573: Use Py_IS_TYPE to check for types (GH-19882) files: M Objects/genericaliasobject.c M Objects/typeobject.c diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index c06d79c556190..4d511a239063c 100644 --- a/Objects/genericaliasobject.c +++ b/Objects/genericaliasobject.c @@ -424,8 +424,8 @@ ga_getattro(PyObject *self, PyObject *name) static PyObject * ga_richcompare(PyObject *a, PyObject *b, int op) { - if (Py_TYPE(a) != &Py_GenericAliasType || - Py_TYPE(b) != &Py_GenericAliasType || + if (!Py_IS_TYPE(a, &Py_GenericAliasType) || + !Py_IS_TYPE(b, &Py_GenericAliasType) || (op != Py_EQ && op != Py_NE)) { Py_RETURN_NOTIMPLEMENTED; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index c2ddc162ac82c..db0ae970090ba 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6306,7 +6306,7 @@ FUNCNAME(PyObject *self, PyObject *other) \ stack[1] = other; \ r = vectorcall_maybe(tstate, &op_id, stack, 2); \ if (r != Py_NotImplemented || \ - Py_TYPE(other) == Py_TYPE(self)) \ + Py_IS_TYPE(other, Py_TYPE(self))) \ return r; \ Py_DECREF(r); \ } \ From webhook-mailer at python.org Mon May 4 09:32:50 2020 From: webhook-mailer at python.org (Dong-hee Na) Date: Mon, 04 May 2020 13:32:50 -0000 Subject: [Python-checkins] bpo-40455: Remove gcc10 warning about x_digits (#19852) Message-ID: https://github.com/python/cpython/commit/b88cd585d36d6285a5aeb0b6fdb70c134062181e commit: b88cd585d36d6285a5aeb0b6fdb70c134062181e branch: master author: Dong-hee Na committer: GitHub date: 2020-05-04T22:32:42+09:00 summary: bpo-40455: Remove gcc10 warning about x_digits (#19852) * bpo-40455: Remove gcc10 warning about x_digits * bpo-40455: nit * bpo-40455: fix logic error files: M Objects/longobject.c diff --git a/Objects/longobject.c b/Objects/longobject.c index a0bb6bc52be02..11fc75b918f77 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -2852,7 +2852,8 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e) { Py_ssize_t a_size, a_bits, shift_digits, shift_bits, x_size; /* See below for why x_digits is always large enough. */ - digit rem, x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT]; + digit rem; + digit x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT] = {0,}; double dx; /* Correction term for round-half-to-even rounding. For a digit x, "x + half_even_correction[x & 7]" gives x rounded to the nearest @@ -2902,9 +2903,7 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e) if (a_bits <= DBL_MANT_DIG + 2) { shift_digits = (DBL_MANT_DIG + 2 - a_bits) / PyLong_SHIFT; shift_bits = (DBL_MANT_DIG + 2 - a_bits) % PyLong_SHIFT; - x_size = 0; - while (x_size < shift_digits) - x_digits[x_size++] = 0; + x_size = shift_digits; rem = v_lshift(x_digits + x_size, a->ob_digit, a_size, (int)shift_bits); x_size += a_size; From webhook-mailer at python.org Mon May 4 11:06:03 2020 From: webhook-mailer at python.org (Hai Shi) Date: Mon, 04 May 2020 15:06:03 -0000 Subject: [Python-checkins] bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892) Message-ID: https://github.com/python/cpython/commit/caa3ef284a2e5e5b9bdd6a9e619804122c842d80 commit: caa3ef284a2e5e5b9bdd6a9e619804122c842d80 branch: master author: Hai Shi committer: GitHub date: 2020-05-04T17:05:54+02:00 summary: bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892) Don't define shared memory block's name in test_shared_memory_across_processes(): use SharedMemory(create=True) instead. files: M Lib/test/_test_multiprocessing.py diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index dd894f21f7afc..dc8164f3288e1 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3860,7 +3860,9 @@ class OptionalAttachSharedMemory(shared_memory.SharedMemory): sms.close() def test_shared_memory_across_processes(self): - sms = shared_memory.SharedMemory('test02_tsmap', True, size=512) + # bpo-40135: don't define shared memory block's name in case of + # the failure when we run multiprocessing tests in parallel. + sms = shared_memory.SharedMemory(create=True, size=512) self.addCleanup(sms.unlink) # Verify remote attachment to existing block by name is working. From webhook-mailer at python.org Mon May 4 11:25:30 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 04 May 2020 15:25:30 -0000 Subject: [Python-checkins] bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892) Message-ID: https://github.com/python/cpython/commit/70fe95cdc9ac1b00d4f86b7525dca80caf7003e1 commit: 70fe95cdc9ac1b00d4f86b7525dca80caf7003e1 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-04T08:25:22-07:00 summary: bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892) Don't define shared memory block's name in test_shared_memory_across_processes(): use SharedMemory(create=True) instead. (cherry picked from commit caa3ef284a2e5e5b9bdd6a9e619804122c842d80) Co-authored-by: Hai Shi files: M Lib/test/_test_multiprocessing.py diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 5943dd83cc143..ff58481f00314 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3828,7 +3828,9 @@ class OptionalAttachSharedMemory(shared_memory.SharedMemory): sms.close() def test_shared_memory_across_processes(self): - sms = shared_memory.SharedMemory('test02_tsmap', True, size=512) + # bpo-40135: don't define shared memory block's name in case of + # the failure when we run multiprocessing tests in parallel. + sms = shared_memory.SharedMemory(create=True, size=512) self.addCleanup(sms.unlink) # Verify remote attachment to existing block by name is working. From webhook-mailer at python.org Mon May 4 13:30:50 2020 From: webhook-mailer at python.org (Dong-hee Na) Date: Mon, 04 May 2020 17:30:50 -0000 Subject: [Python-checkins] bpo-40489: Add test case for dict contain use after free (GH-19906) Message-ID: https://github.com/python/cpython/commit/785f5e6d674306052bf865677d885c30561985ae commit: 785f5e6d674306052bf865677d885c30561985ae branch: master author: Dong-hee Na committer: GitHub date: 2020-05-05T02:30:42+09:00 summary: bpo-40489: Add test case for dict contain use after free (GH-19906) files: M Lib/test/test_dict.py diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index d5a3d9e894574..6b8596fff6a9f 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1324,6 +1324,19 @@ def __eq__(self, other): d = {0: set()} (0, X()) in d.items() + def test_dict_contain_use_after_free(self): + # bpo-40489 + class S(str): + def __eq__(self, other): + d.clear() + return NotImplemented + + def __hash__(self): + return hash('test') + + d = {S(): 'value'} + self.assertFalse('test' in d) + def test_init_use_after_free(self): class X: def __hash__(self): From webhook-mailer at python.org Mon May 4 14:05:10 2020 From: webhook-mailer at python.org (Hai Shi) Date: Mon, 04 May 2020 18:05:10 -0000 Subject: [Python-checkins] bpo-40275: test.support imports lazily locale import (GH-19761) Message-ID: https://github.com/python/cpython/commit/975408c065b645e7d717546b0d744415abb45cd1 commit: 975408c065b645e7d717546b0d744415abb45cd1 branch: master author: Hai Shi committer: GitHub date: 2020-05-04T20:05:02+02:00 summary: bpo-40275: test.support imports lazily locale import (GH-19761) files: M Lib/test/support/__init__.py diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index bd2157496fe00..d2418282afc11 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -13,7 +13,6 @@ import glob import importlib import importlib.util -import locale import os import platform import re @@ -2311,6 +2310,7 @@ def skip_if_buggy_ucrt_strfptime(test): See bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 """ + import locale global _buggy_ucrt if _buggy_ucrt is None: if(sys.platform == 'win32' and From webhook-mailer at python.org Mon May 4 15:47:10 2020 From: webhook-mailer at python.org (Joannah Nanjekye) Date: Mon, 04 May 2020 19:47:10 -0000 Subject: [Python-checkins] bpo-39470: Indicate that ``os.makedirs`` is equivalent to ``Path.mkdir`` (GH-18216) Message-ID: https://github.com/python/cpython/commit/f25fb6ebfec894c01bc927c9aae7924ffc826d11 commit: f25fb6ebfec894c01bc927c9aae7924ffc826d11 branch: master author: Joannah Nanjekye <33177550+nanjekyejoannah at users.noreply.github.com> committer: GitHub date: 2020-05-04T16:47:03-03:00 summary: bpo-39470: Indicate that ``os.makedirs`` is equivalent to ``Path.mkdir`` (GH-18216) * Indicate os.makedirs is equivalent to Path.mkdir * ?? Added by blurb_it. * ignore news feed Co-authored-by: nanjekyejoannah Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> files: M Doc/library/pathlib.rst diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index dead49b630dcd..83f7c836f0e71 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1185,6 +1185,7 @@ os and os.path pathlib :func:`os.path.abspath` :meth:`Path.resolve` :func:`os.chmod` :meth:`Path.chmod` :func:`os.mkdir` :meth:`Path.mkdir` +:func:`os.makedirs` :meth:`Path.mkdir` :func:`os.rename` :meth:`Path.rename` :func:`os.replace` :meth:`Path.replace` :func:`os.rmdir` :meth:`Path.rmdir` From webhook-mailer at python.org Mon May 4 17:56:08 2020 From: webhook-mailer at python.org (Joel Rosdahl) Date: Mon, 04 May 2020 21:56:08 -0000 Subject: [Python-checkins] bpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900) Message-ID: https://github.com/python/cpython/commit/9d74658f0a6e8a9b8d6dcf199dda886f35c6ad68 commit: 9d74658f0a6e8a9b8d6dcf199dda886f35c6ad68 branch: master author: Joel Rosdahl committer: GitHub date: 2020-05-04T14:56:00-07:00 summary: bpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900) A similar formulation was added in bpo-21596 (db74d982d43d98040e38665d843cbc8de4a082b1) but was lost in bpo-33649 (3faaa8857a42a36383bb18425444e597fc876797). files: A Misc/NEWS.d/next/Documentation/2020-05-04-14-20-02.bpo-40499.tjLSo8.rst M Doc/library/asyncio-task.rst M Misc/ACKS diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index d992b0011dc66..6627bec79823a 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -498,6 +498,8 @@ Waiting Primitives set concurrently and block until the condition specified by *return_when*. + The *aws* set must not be empty. + Returns two sets of Tasks/Futures: ``(done, pending)``. Usage:: diff --git a/Misc/ACKS b/Misc/ACKS index 9221f6aae439e..f744de6b1f66d 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1443,6 +1443,7 @@ Mike Romberg Armin Ronacher Case Roole Timothy Roscoe +Joel Rosdahl Erik Rose Mark Roseman Josh Rosenberg diff --git a/Misc/NEWS.d/next/Documentation/2020-05-04-14-20-02.bpo-40499.tjLSo8.rst b/Misc/NEWS.d/next/Documentation/2020-05-04-14-20-02.bpo-40499.tjLSo8.rst new file mode 100644 index 0000000000000..2b7eccbf0efaf --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-05-04-14-20-02.bpo-40499.tjLSo8.rst @@ -0,0 +1 @@ +Mention that :func:`asyncio.wait` requires a non-empty set of awaitables. From webhook-mailer at python.org Mon May 4 21:49:53 2020 From: webhook-mailer at python.org (Dong-hee Na) Date: Tue, 05 May 2020 01:49:53 -0000 Subject: [Python-checkins] bpo-1635741: Port syslog module to multiphase initialization (GH-19907) Message-ID: https://github.com/python/cpython/commit/92a98ed97513c6e365ce8765550ea65d0ddc8cd7 commit: 92a98ed97513c6e365ce8765550ea65d0ddc8cd7 branch: master author: Dong-hee Na committer: GitHub date: 2020-05-05T10:49:46+09:00 summary: bpo-1635741: Port syslog module to multiphase initialization (GH-19907) files: A Misc/NEWS.d/next/Core and Builtins/2020-05-05-03-36-27.bpo-1635741.ARv1YV.rst M Modules/syslogmodule.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-05-03-36-27.bpo-1635741.ARv1YV.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-05-03-36-27.bpo-1635741.ARv1YV.rst new file mode 100644 index 0000000000000..f484992c487bd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-05-03-36-27.bpo-1635741.ARv1YV.rst @@ -0,0 +1 @@ +Port :mod:`syslog` to multiphase initialization (:pep:`489`). diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 11718e277432f..cdc94a60a373d 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -261,72 +261,55 @@ static PyMethodDef syslog_methods[] = { {NULL, NULL, 0} }; -/* Initialization function for the module */ - - -static struct PyModuleDef syslogmodule = { - PyModuleDef_HEAD_INIT, - "syslog", - NULL, - -1, - syslog_methods, - NULL, - NULL, - NULL, - NULL -}; -PyMODINIT_FUNC -PyInit_syslog(void) +static int +syslog_exec(PyObject *module) { - PyObject *m; - - /* Create the module and add the functions */ - m = PyModule_Create(&syslogmodule); - if (m == NULL) - return NULL; - - /* Add some symbolic constants to the module */ - +#define ADD_INT_MACRO(module, macro) \ + do { \ + if (PyModule_AddIntConstant(module, #macro, macro) < 0) { \ + return -1; \ + } \ + } while (0) /* Priorities */ - PyModule_AddIntMacro(m, LOG_EMERG); - PyModule_AddIntMacro(m, LOG_ALERT); - PyModule_AddIntMacro(m, LOG_CRIT); - PyModule_AddIntMacro(m, LOG_ERR); - PyModule_AddIntMacro(m, LOG_WARNING); - PyModule_AddIntMacro(m, LOG_NOTICE); - PyModule_AddIntMacro(m, LOG_INFO); - PyModule_AddIntMacro(m, LOG_DEBUG); + ADD_INT_MACRO(module, LOG_EMERG); + ADD_INT_MACRO(module, LOG_ALERT); + ADD_INT_MACRO(module, LOG_CRIT); + ADD_INT_MACRO(module, LOG_ERR); + ADD_INT_MACRO(module, LOG_WARNING); + ADD_INT_MACRO(module, LOG_NOTICE); + ADD_INT_MACRO(module, LOG_INFO); + ADD_INT_MACRO(module, LOG_DEBUG); /* openlog() option flags */ - PyModule_AddIntMacro(m, LOG_PID); - PyModule_AddIntMacro(m, LOG_CONS); - PyModule_AddIntMacro(m, LOG_NDELAY); + ADD_INT_MACRO(module, LOG_PID); + ADD_INT_MACRO(module, LOG_CONS); + ADD_INT_MACRO(module, LOG_NDELAY); #ifdef LOG_ODELAY - PyModule_AddIntMacro(m, LOG_ODELAY); + ADD_INT_MACRO(module, LOG_ODELAY); #endif #ifdef LOG_NOWAIT - PyModule_AddIntMacro(m, LOG_NOWAIT); + ADD_INT_MACRO(module, LOG_NOWAIT); #endif #ifdef LOG_PERROR - PyModule_AddIntMacro(m, LOG_PERROR); + ADD_INT_MACRO(module, LOG_PERROR); #endif /* Facilities */ - PyModule_AddIntMacro(m, LOG_KERN); - PyModule_AddIntMacro(m, LOG_USER); - PyModule_AddIntMacro(m, LOG_MAIL); - PyModule_AddIntMacro(m, LOG_DAEMON); - PyModule_AddIntMacro(m, LOG_AUTH); - PyModule_AddIntMacro(m, LOG_LPR); - PyModule_AddIntMacro(m, LOG_LOCAL0); - PyModule_AddIntMacro(m, LOG_LOCAL1); - PyModule_AddIntMacro(m, LOG_LOCAL2); - PyModule_AddIntMacro(m, LOG_LOCAL3); - PyModule_AddIntMacro(m, LOG_LOCAL4); - PyModule_AddIntMacro(m, LOG_LOCAL5); - PyModule_AddIntMacro(m, LOG_LOCAL6); - PyModule_AddIntMacro(m, LOG_LOCAL7); + ADD_INT_MACRO(module, LOG_KERN); + ADD_INT_MACRO(module, LOG_USER); + ADD_INT_MACRO(module, LOG_MAIL); + ADD_INT_MACRO(module, LOG_DAEMON); + ADD_INT_MACRO(module, LOG_AUTH); + ADD_INT_MACRO(module, LOG_LPR); + ADD_INT_MACRO(module, LOG_LOCAL0); + ADD_INT_MACRO(module, LOG_LOCAL1); + ADD_INT_MACRO(module, LOG_LOCAL2); + ADD_INT_MACRO(module, LOG_LOCAL3); + ADD_INT_MACRO(module, LOG_LOCAL4); + ADD_INT_MACRO(module, LOG_LOCAL5); + ADD_INT_MACRO(module, LOG_LOCAL6); + ADD_INT_MACRO(module, LOG_LOCAL7); #ifndef LOG_SYSLOG #define LOG_SYSLOG LOG_DAEMON @@ -341,14 +324,35 @@ PyInit_syslog(void) #define LOG_CRON LOG_DAEMON #endif - PyModule_AddIntMacro(m, LOG_SYSLOG); - PyModule_AddIntMacro(m, LOG_CRON); - PyModule_AddIntMacro(m, LOG_UUCP); - PyModule_AddIntMacro(m, LOG_NEWS); + ADD_INT_MACRO(module, LOG_SYSLOG); + ADD_INT_MACRO(module, LOG_CRON); + ADD_INT_MACRO(module, LOG_UUCP); + ADD_INT_MACRO(module, LOG_NEWS); #ifdef LOG_AUTHPRIV - PyModule_AddIntMacro(m, LOG_AUTHPRIV); + ADD_INT_MACRO(module, LOG_AUTHPRIV); #endif - return m; + return 0; } + +static PyModuleDef_Slot syslog_slots[] = { + {Py_mod_exec, syslog_exec}, + {0, NULL} +}; + +/* Initialization function for the module */ + +static struct PyModuleDef syslogmodule = { + PyModuleDef_HEAD_INIT, + .m_name = "syslog", + .m_size = 0, + .m_methods = syslog_methods, + .m_slots = syslog_slots, +}; + +PyMODINIT_FUNC +PyInit_syslog(void) +{ + return PyModuleDef_Init(&syslogmodule); +} \ No newline at end of file From webhook-mailer at python.org Mon May 4 22:33:24 2020 From: webhook-mailer at python.org (Dennis Sweeney) Date: Tue, 05 May 2020 02:33:24 -0000 Subject: [Python-checkins] bpo-40459: Fix NameError in platform.py (GH-19855) Message-ID: https://github.com/python/cpython/commit/1e7e4519a8ddc2239101a0146d788c9161143a77 commit: 1e7e4519a8ddc2239101a0146d788c9161143a77 branch: master author: Dennis Sweeney <36520290+sweeneyde at users.noreply.github.com> committer: GitHub date: 2020-05-05T11:33:17+09:00 summary: bpo-40459: Fix NameError in platform.py (GH-19855) files: A Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst M Lib/platform.py diff --git a/Lib/platform.py b/Lib/platform.py index 3f442ef0fbb65..049c2c6ef25a1 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -398,9 +398,9 @@ def win32_ver(release='', version='', csd='', ptype=''): else: try: cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' - with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key: - ptype = QueryValueEx(key, 'CurrentType')[0] - except: + with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key: + ptype = winreg.QueryValueEx(key, 'CurrentType')[0] + except OSError: pass return release, version, csd, ptype diff --git a/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst new file mode 100644 index 0000000000000..d4bf6987fa260 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst @@ -0,0 +1 @@ +:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings. From webhook-mailer at python.org Mon May 4 22:51:41 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 05 May 2020 02:51:41 -0000 Subject: [Python-checkins] bpo-40459: Fix NameError in platform.py (GH-19855) Message-ID: https://github.com/python/cpython/commit/8ddf91543890e38c76aa0029482c6f5f5c444837 commit: 8ddf91543890e38c76aa0029482c6f5f5c444837 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-04T19:51:33-07:00 summary: bpo-40459: Fix NameError in platform.py (GH-19855) (cherry picked from commit 1e7e4519a8ddc2239101a0146d788c9161143a77) Co-authored-by: Dennis Sweeney <36520290+sweeneyde at users.noreply.github.com> files: A Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst M Lib/platform.py diff --git a/Lib/platform.py b/Lib/platform.py index 6ab06b58321e0..7af46ffd17728 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -570,9 +570,9 @@ def win32_ver(release='', version='', csd='', ptype=''): else: try: cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' - with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key: - ptype = QueryValueEx(key, 'CurrentType')[0] - except: + with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key: + ptype = winreg.QueryValueEx(key, 'CurrentType')[0] + except OSError: pass return release, version, csd, ptype diff --git a/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst new file mode 100644 index 0000000000000..d4bf6987fa260 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst @@ -0,0 +1 @@ +:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings. From webhook-mailer at python.org Mon May 4 22:51:53 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 05 May 2020 02:51:53 -0000 Subject: [Python-checkins] bpo-40459: Fix NameError in platform.py (GH-19855) Message-ID: https://github.com/python/cpython/commit/efc782d29e229924076ffb6645a72f26242fb3ef commit: efc782d29e229924076ffb6645a72f26242fb3ef branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-04T19:51:48-07:00 summary: bpo-40459: Fix NameError in platform.py (GH-19855) (cherry picked from commit 1e7e4519a8ddc2239101a0146d788c9161143a77) Co-authored-by: Dennis Sweeney <36520290+sweeneyde at users.noreply.github.com> files: A Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst M Lib/platform.py diff --git a/Lib/platform.py b/Lib/platform.py index 6fbb7b08c598e..994d892c5e616 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -395,9 +395,9 @@ def win32_ver(release='', version='', csd='', ptype=''): else: try: cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' - with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key: - ptype = QueryValueEx(key, 'CurrentType')[0] - except: + with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key: + ptype = winreg.QueryValueEx(key, 'CurrentType')[0] + except OSError: pass return release, version, csd, ptype diff --git a/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst new file mode 100644 index 0000000000000..d4bf6987fa260 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst @@ -0,0 +1 @@ +:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings. From webhook-mailer at python.org Tue May 5 01:52:18 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Tue, 05 May 2020 05:52:18 -0000 Subject: [Python-checkins] bpo-40286: Put methods in correct sections. Add security notice to use secrets for session tokens. (GH-19870) Message-ID: https://github.com/python/cpython/commit/f01d1be97d740ea0369379ca305646a26694236e commit: f01d1be97d740ea0369379ca305646a26694236e branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-04T22:52:13-07:00 summary: bpo-40286: Put methods in correct sections. Add security notice to use secrets for session tokens. (GH-19870) files: M Doc/library/random.rst diff --git a/Doc/library/random.rst b/Doc/library/random.rst index ab4ca4b3f8532..f37bc2a111d95 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -104,21 +104,16 @@ Bookkeeping functions the time :func:`getstate` was called. -.. function:: getrandbits(k) - - Returns a Python integer with *k* random bits. This method is supplied with - the Mersenne Twister generator and some other generators may also provide it - as an optional part of the API. When available, :meth:`getrandbits` enables - :meth:`randrange` to handle arbitrarily large ranges. - - .. versionchanged:: 3.9 - This method now accepts zero for *k*. - +Functions for bytes +------------------- .. function:: randbytes(n) Generate *n* random bytes. + This method should not be used for generating security tokens. + Use :func:`secrets.token_bytes` instead. + .. versionadded:: 3.9 @@ -145,6 +140,16 @@ Functions for integers Return a random integer *N* such that ``a <= N <= b``. Alias for ``randrange(a, b+1)``. +.. function:: getrandbits(k) + + Returns a Python integer with *k* random bits. This method is supplied with + the MersenneTwister generator and some other generators may also provide it + as an optional part of the API. When available, :meth:`getrandbits` enables + :meth:`randrange` to handle arbitrarily large ranges. + + .. versionchanged:: 3.9 + This method now accepts zero for *k*. + Functions for sequences ----------------------- From webhook-mailer at python.org Tue May 5 09:43:45 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 13:43:45 -0000 Subject: [Python-checkins] bpo-40513: Per-interpreter signals pending (GH-19924) Message-ID: https://github.com/python/cpython/commit/4e01946cafca0cf49f796c3118e0d65237bcad69 commit: 4e01946cafca0cf49f796c3118e0d65237bcad69 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T15:43:37+02:00 summary: bpo-40513: Per-interpreter signals pending (GH-19924) Move signals_pending from _PyRuntime.ceval to PyInterpreterState.ceval. files: M Include/internal/pycore_interp.h M Include/internal/pycore_runtime.h M Python/ceval.c diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 6e9937caa9dbf..251ee06ed4b00 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -43,6 +43,8 @@ struct _ceval_state { the fast path in the eval loop. */ _Py_atomic_int eval_breaker; struct _pending_calls pending; + /* Request for checking signals. */ + _Py_atomic_int signals_pending; }; diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index 995fe231c3214..d432c6cc5112a 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -17,8 +17,6 @@ struct _ceval_runtime_state { int recursion_limit; /* Request for dropping the GIL */ _Py_atomic_int gil_drop_request; - /* Request for checking signals. */ - _Py_atomic_int signals_pending; struct _gil_runtime_state gil; }; diff --git a/Python/ceval.c b/Python/ceval.c index e15d7e0b4603d..addc0264b171a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -148,7 +148,7 @@ COMPUTE_EVAL_BREAKER(PyInterpreterState *interp, { _Py_atomic_store_relaxed(&ceval2->eval_breaker, _Py_atomic_load_relaxed(&ceval->gil_drop_request) - | (_Py_atomic_load_relaxed(&ceval->signals_pending) + | (_Py_atomic_load_relaxed(&ceval2->signals_pending) && _Py_ThreadCanHandleSignals(interp)) | (_Py_atomic_load_relaxed(&ceval2->pending.calls_to_do) && _Py_ThreadCanHandlePendingCalls()) @@ -201,7 +201,7 @@ SIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) { struct _ceval_runtime_state *ceval = &interp->runtime->ceval; struct _ceval_state *ceval2 = &interp->ceval; - _Py_atomic_store_relaxed(&ceval->signals_pending, 1); + _Py_atomic_store_relaxed(&ceval2->signals_pending, 1); /* eval_breaker is not set to 1 if thread_can_handle_signals() is false */ COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } @@ -212,7 +212,7 @@ UNSIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) { struct _ceval_runtime_state *ceval = &interp->runtime->ceval; struct _ceval_state *ceval2 = &interp->ceval; - _Py_atomic_store_relaxed(&ceval->signals_pending, 0); + _Py_atomic_store_relaxed(&ceval2->signals_pending, 0); COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } @@ -830,16 +830,16 @@ eval_frame_handle_pending(PyThreadState *tstate) { _PyRuntimeState * const runtime = &_PyRuntime; struct _ceval_runtime_state *ceval = &runtime->ceval; + struct _ceval_state *ceval2 = &tstate->interp->ceval; /* Pending signals */ - if (_Py_atomic_load_relaxed(&ceval->signals_pending)) { + if (_Py_atomic_load_relaxed(&ceval2->signals_pending)) { if (handle_signals(tstate) != 0) { return -1; } } /* Pending calls */ - struct _ceval_state *ceval2 = &tstate->interp->ceval; if (_Py_atomic_load_relaxed(&ceval2->pending.calls_to_do)) { if (make_pending_calls(tstate) != 0) { return -1; From webhook-mailer at python.org Tue May 5 10:14:40 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 14:14:40 -0000 Subject: [Python-checkins] bpo-40513: Per-interpreter gil_drop_request (GH-19927) Message-ID: https://github.com/python/cpython/commit/0b1e3307e24b0af45787ab6456535b8346e0239a commit: 0b1e3307e24b0af45787ab6456535b8346e0239a branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T16:14:31+02:00 summary: bpo-40513: Per-interpreter gil_drop_request (GH-19927) Move gil_drop_request member from _PyRuntimeState.ceval to PyInterpreterState.ceval. files: M Include/internal/pycore_interp.h M Include/internal/pycore_runtime.h M Python/ceval.c M Python/ceval_gil.h diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 251ee06ed4b00..fafc72eb97a00 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -42,6 +42,8 @@ struct _ceval_state { /* This single variable consolidates all requests to break out of the fast path in the eval loop. */ _Py_atomic_int eval_breaker; + /* Request for dropping the GIL */ + _Py_atomic_int gil_drop_request; struct _pending_calls pending; /* Request for checking signals. */ _Py_atomic_int signals_pending; diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index d432c6cc5112a..c59733559167a 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -15,8 +15,6 @@ extern "C" { struct _ceval_runtime_state { int recursion_limit; - /* Request for dropping the GIL */ - _Py_atomic_int gil_drop_request; struct _gil_runtime_state gil; }; diff --git a/Python/ceval.c b/Python/ceval.c index addc0264b171a..6b002730c8d78 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -143,77 +143,70 @@ is_tstate_valid(PyThreadState *tstate) the GIL eventually anyway. */ static inline void COMPUTE_EVAL_BREAKER(PyInterpreterState *interp, - struct _ceval_runtime_state *ceval, - struct _ceval_state *ceval2) + struct _ceval_state *ceval) { - _Py_atomic_store_relaxed(&ceval2->eval_breaker, + _Py_atomic_store_relaxed(&ceval->eval_breaker, _Py_atomic_load_relaxed(&ceval->gil_drop_request) - | (_Py_atomic_load_relaxed(&ceval2->signals_pending) + | (_Py_atomic_load_relaxed(&ceval->signals_pending) && _Py_ThreadCanHandleSignals(interp)) - | (_Py_atomic_load_relaxed(&ceval2->pending.calls_to_do) + | (_Py_atomic_load_relaxed(&ceval->pending.calls_to_do) && _Py_ThreadCanHandlePendingCalls()) - | ceval2->pending.async_exc); + | ceval->pending.async_exc); } static inline void SET_GIL_DROP_REQUEST(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; + struct _ceval_state *ceval = &interp->ceval; _Py_atomic_store_relaxed(&ceval->gil_drop_request, 1); - _Py_atomic_store_relaxed(&ceval2->eval_breaker, 1); + _Py_atomic_store_relaxed(&ceval->eval_breaker, 1); } static inline void RESET_GIL_DROP_REQUEST(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; + struct _ceval_state *ceval = &interp->ceval; _Py_atomic_store_relaxed(&ceval->gil_drop_request, 0); - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + COMPUTE_EVAL_BREAKER(interp, ceval); } static inline void SIGNAL_PENDING_CALLS(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; - _Py_atomic_store_relaxed(&ceval2->pending.calls_to_do, 1); - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + struct _ceval_state *ceval = &interp->ceval; + _Py_atomic_store_relaxed(&ceval->pending.calls_to_do, 1); + COMPUTE_EVAL_BREAKER(interp, ceval); } static inline void UNSIGNAL_PENDING_CALLS(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; - _Py_atomic_store_relaxed(&ceval2->pending.calls_to_do, 0); - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + struct _ceval_state *ceval = &interp->ceval; + _Py_atomic_store_relaxed(&ceval->pending.calls_to_do, 0); + COMPUTE_EVAL_BREAKER(interp, ceval); } static inline void SIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; - _Py_atomic_store_relaxed(&ceval2->signals_pending, 1); + struct _ceval_state *ceval = &interp->ceval; + _Py_atomic_store_relaxed(&ceval->signals_pending, 1); /* eval_breaker is not set to 1 if thread_can_handle_signals() is false */ - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + COMPUTE_EVAL_BREAKER(interp, ceval); } static inline void UNSIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; - _Py_atomic_store_relaxed(&ceval2->signals_pending, 0); - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + struct _ceval_state *ceval = &interp->ceval; + _Py_atomic_store_relaxed(&ceval->signals_pending, 0); + COMPUTE_EVAL_BREAKER(interp, ceval); } @@ -229,10 +222,9 @@ SIGNAL_ASYNC_EXC(PyInterpreterState *interp) static inline void UNSIGNAL_ASYNC_EXC(PyInterpreterState *interp) { - struct _ceval_runtime_state *ceval = &interp->runtime->ceval; - struct _ceval_state *ceval2 = &interp->ceval; - ceval2->pending.async_exc = 0; - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + struct _ceval_state *ceval = &interp->ceval; + ceval->pending.async_exc = 0; + COMPUTE_EVAL_BREAKER(interp, ceval); } @@ -357,17 +349,19 @@ PyEval_ReleaseLock(void) { _PyRuntimeState *runtime = &_PyRuntime; PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); + struct _ceval_state *ceval2 = &tstate->interp->ceval; /* This function must succeed when the current thread state is NULL. We therefore avoid PyThreadState_Get() which dumps a fatal error in debug mode. */ - drop_gil(&runtime->ceval, tstate); + drop_gil(&runtime->ceval, ceval2, tstate); } void _PyEval_ReleaseLock(PyThreadState *tstate) { struct _ceval_runtime_state *ceval = &tstate->interp->runtime->ceval; - drop_gil(ceval, tstate); + struct _ceval_state *ceval2 = &tstate->interp->ceval; + drop_gil(ceval, ceval2, tstate); } void @@ -393,7 +387,9 @@ PyEval_ReleaseThread(PyThreadState *tstate) if (new_tstate != tstate) { Py_FatalError("wrong thread state"); } - drop_gil(&runtime->ceval, tstate); + struct _ceval_runtime_state *ceval = &runtime->ceval; + struct _ceval_state *ceval2 = &tstate->interp->ceval; + drop_gil(ceval, ceval2, tstate); } #ifdef HAVE_FORK @@ -439,13 +435,14 @@ PyThreadState * PyEval_SaveThread(void) { _PyRuntimeState *runtime = &_PyRuntime; - struct _ceval_runtime_state *ceval = &runtime->ceval; PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, NULL); ensure_tstate_not_null(__func__, tstate); + struct _ceval_runtime_state *ceval = &runtime->ceval; + struct _ceval_state *ceval2 = &tstate->interp->ceval; assert(gil_created(&ceval->gil)); - drop_gil(ceval, tstate); + drop_gil(ceval, ceval2, tstate); return tstate; } @@ -847,12 +844,12 @@ eval_frame_handle_pending(PyThreadState *tstate) } /* GIL drop request */ - if (_Py_atomic_load_relaxed(&ceval->gil_drop_request)) { + if (_Py_atomic_load_relaxed(&ceval2->gil_drop_request)) { /* Give another thread a chance */ if (_PyThreadState_Swap(&runtime->gilstate, NULL) != tstate) { Py_FatalError("tstate mix-up"); } - drop_gil(ceval, tstate); + drop_gil(ceval, ceval2, tstate); /* Other threads may run now */ diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index a025a9fad1248..db47077d5c1ce 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -141,7 +141,8 @@ static void recreate_gil(struct _gil_runtime_state *gil) } static void -drop_gil(struct _ceval_runtime_state *ceval, PyThreadState *tstate) +drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2, + PyThreadState *tstate) { struct _gil_runtime_state *gil = &ceval->gil; if (!_Py_atomic_load_relaxed(&gil->locked)) { @@ -163,7 +164,7 @@ drop_gil(struct _ceval_runtime_state *ceval, PyThreadState *tstate) MUTEX_UNLOCK(gil->mutex); #ifdef FORCE_SWITCHING - if (_Py_atomic_load_relaxed(&ceval->gil_drop_request) && tstate != NULL) { + if (_Py_atomic_load_relaxed(&ceval2->gil_drop_request) && tstate != NULL) { MUTEX_LOCK(gil->switch_mutex); /* Not switched yet => wait */ if (((PyThreadState*)_Py_atomic_load_relaxed(&gil->last_holder)) == tstate) @@ -226,6 +227,7 @@ take_gil(PyThreadState *tstate) assert(is_tstate_valid(tstate)); PyInterpreterState *interp = tstate->interp; struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; struct _gil_runtime_state *gil = &ceval->gil; /* Check that _PyEval_InitThreads() was called to create the lock */ @@ -289,12 +291,12 @@ take_gil(PyThreadState *tstate) in take_gil() while the main thread called wait_for_thread_shutdown() from Py_Finalize(). */ MUTEX_UNLOCK(gil->mutex); - drop_gil(ceval, tstate); + drop_gil(ceval, ceval2, tstate); PyThread_exit_thread(); } assert(is_tstate_valid(tstate)); - if (_Py_atomic_load_relaxed(&ceval->gil_drop_request)) { + if (_Py_atomic_load_relaxed(&ceval2->gil_drop_request)) { RESET_GIL_DROP_REQUEST(interp); } else { @@ -303,8 +305,7 @@ take_gil(PyThreadState *tstate) handle signals. Note: RESET_GIL_DROP_REQUEST() calls COMPUTE_EVAL_BREAKER(). */ - struct _ceval_state *ceval2 = &interp->ceval; - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + COMPUTE_EVAL_BREAKER(interp, ceval2); } /* Don't access tstate if the thread must exit */ From webhook-mailer at python.org Tue May 5 10:41:19 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 14:41:19 -0000 Subject: [Python-checkins] bpo-40514: Add --with-experimental-isolated-subinterpreters (GH-19926) Message-ID: https://github.com/python/cpython/commit/c5fa364f4ea836f25dd07cfb328152d40a568371 commit: c5fa364f4ea836f25dd07cfb328152d40a568371 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T16:41:11+02:00 summary: bpo-40514: Add --with-experimental-isolated-subinterpreters (GH-19926) Add --with-experimental-isolated-subinterpreters build option to configure: better isolate subinterpreters, experimental build mode. When used, force the usage of the libc malloc() memory allocator, since pymalloc relies on the unique global interpreter lock (GIL). files: A Misc/NEWS.d/next/Build/2020-05-05-15-39-11.bpo-40514.bZZmuS.rst M Python/preconfig.c M configure M configure.ac M pyconfig.h.in diff --git a/Misc/NEWS.d/next/Build/2020-05-05-15-39-11.bpo-40514.bZZmuS.rst b/Misc/NEWS.d/next/Build/2020-05-05-15-39-11.bpo-40514.bZZmuS.rst new file mode 100644 index 0000000000000..ab9062c28f4bb --- /dev/null +++ b/Misc/NEWS.d/next/Build/2020-05-05-15-39-11.bpo-40514.bZZmuS.rst @@ -0,0 +1,2 @@ +Add ``--with-experimental-isolated-subinterpreters`` build option to +``configure``: better isolate subinterpreters, experimental build mode. diff --git a/Python/preconfig.c b/Python/preconfig.c index 262738fa57da5..fd94d7dda1c29 100644 --- a/Python/preconfig.c +++ b/Python/preconfig.c @@ -291,7 +291,17 @@ _PyPreConfig_InitCompatConfig(PyPreConfig *config) config->coerce_c_locale_warn = 0; config->dev_mode = -1; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + /* bpo-40512: pymalloc is not compatible with subinterpreters, + force usage of libc malloc() which is thread-safe. */ +#ifdef Py_DEBUG + config->allocator = PYMEM_ALLOCATOR_MALLOC_DEBUG; +#else + config->allocator = PYMEM_ALLOCATOR_MALLOC; +#endif +#else config->allocator = PYMEM_ALLOCATOR_NOT_SET; +#endif #ifdef MS_WINDOWS config->legacy_windows_fs_encoding = -1; #endif diff --git a/configure b/configure index a8a35d0defc6b..26e9aa9fe454e 100755 --- a/configure +++ b/configure @@ -845,6 +845,7 @@ with_computed_gotos with_ensurepip with_openssl with_ssl_default_suites +with_experimental_isolated_subinterpreters ' ac_precious_vars='build_alias host_alias @@ -1575,6 +1576,9 @@ Optional Packages: leave OpenSSL's defaults untouched, STRING: use a custom string, PROTOCOL_SSLv2 ignores the setting, see Doc/library/ssl.rst + --with-experimental-isolated-subinterpreters + better isolate subinterpreters, experimental build + mode (default is no) Some influential environment variables: MACHDEP name for machine-dependent library files @@ -17489,6 +17493,30 @@ $as_echo "#define PY_SSL_DEFAULT_CIPHERS 1" >>confdefs.h fi +# --with-experimental-isolated-subinterpreters + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-experimental-isolated-subinterpreters" >&5 +$as_echo_n "checking for --with-experimental-isolated-subinterpreters... " >&6; } + +# Check whether --with-experimental-isolated-subinterpreters was given. +if test "${with_experimental_isolated_subinterpreters+set}" = set; then : + withval=$with_experimental_isolated_subinterpreters; +if test "$withval" != no +then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; + $as_echo "#define EXPERIMENTAL_ISOLATED_SUBINTERPRETERS 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # generate output files ac_config_files="$ac_config_files Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh" diff --git a/configure.ac b/configure.ac index f996051efc719..acb6d4bfa8da1 100644 --- a/configure.ac +++ b/configure.ac @@ -5717,6 +5717,23 @@ AC_MSG_RESULT(python) AC_DEFINE(PY_SSL_DEFAULT_CIPHERS, 1) ]) +# --with-experimental-isolated-subinterpreters +AH_TEMPLATE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS, + [Better isolate subinterpreters, experimental build mode.]) +AC_MSG_CHECKING(for --with-experimental-isolated-subinterpreters) +AC_ARG_WITH(experimental-isolated-subinterpreters, + AS_HELP_STRING([--with-experimental-isolated-subinterpreters], + [better isolate subinterpreters, experimental build mode (default is no)]), +[ +if test "$withval" != no +then + AC_MSG_RESULT(yes); + AC_DEFINE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS) +else + AC_MSG_RESULT(no); +fi], +[AC_MSG_RESULT(no)]) + # generate output files AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) diff --git a/pyconfig.h.in b/pyconfig.h.in index 75ac368aadafe..c06c4958726c0 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -38,6 +38,9 @@ /* Define if --enable-ipv6 is specified */ #undef ENABLE_IPV6 +/* Better isolate subinterpreters, experimental build mode. */ +#undef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + /* Define to 1 if your system stores words within floats with the most significant word first */ #undef FLOAT_WORDS_BIGENDIAN From webhook-mailer at python.org Tue May 5 10:50:04 2020 From: webhook-mailer at python.org (Javier Buzzi) Date: Tue, 05 May 2020 14:50:04 -0000 Subject: [Python-checkins] bpo-32117: Updated Simpsons names in docs (GH-19737) Message-ID: https://github.com/python/cpython/commit/627f7012353411590434a7d5777ddcbcc8d97fcd commit: 627f7012353411590434a7d5777ddcbcc8d97fcd branch: master author: Javier Buzzi committer: GitHub date: 2020-05-05T07:49:57-07:00 summary: bpo-32117: Updated Simpsons names in docs (GH-19737) `sally` is not a Simpsons character Automerge-Triggered-By: @gvanrossum files: M Doc/whatsnew/3.8.rst diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 6d2b0d905ff06..fdfc0a8f472cd 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -428,8 +428,8 @@ Other Language Changes lastname, *members = family.split() return lastname.upper(), *members - >>> parse('simpsons homer marge bart lisa sally') - ('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'sally') + >>> parse('simpsons homer marge bart lisa maggie') + ('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie') (Contributed by David Cuthbert and Jordan Chapman in :issue:`32117`.) From webhook-mailer at python.org Tue May 5 10:52:59 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 14:52:59 -0000 Subject: [Python-checkins] bpo-40513: Per-interpreter recursion_limit (GH-19929) Message-ID: https://github.com/python/cpython/commit/4e30ed3af06ae655f4cb8aad8cba21f341384250 commit: 4e30ed3af06ae655f4cb8aad8cba21f341384250 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T16:52:52+02:00 summary: bpo-40513: Per-interpreter recursion_limit (GH-19929) Move recursion_limit member from _PyRuntimeState.ceval to PyInterpreterState.ceval. * Py_SetRecursionLimit() now only sets _Py_CheckRecursionLimit of ceval.c if the current Python thread is part of the main interpreter. * Inline _Py_MakeEndRecCheck() into _Py_LeaveRecursiveCall(). * Convert _Py_RecursionLimitLowerWaterMark() macro into a static inline function. files: M Include/internal/pycore_ceval.h M Include/internal/pycore_interp.h M Include/internal/pycore_runtime.h M Python/ceval.c diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 2df796deade3a..18c8f027af16e 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -65,12 +65,12 @@ PyAPI_DATA(int) _Py_CheckRecursionLimit; /* With USE_STACKCHECK macro defined, trigger stack checks in _Py_CheckRecursiveCall() on every 64th call to Py_EnterRecursiveCall. */ static inline int _Py_MakeRecCheck(PyThreadState *tstate) { - return (++tstate->recursion_depth > _Py_CheckRecursionLimit + return (++tstate->recursion_depth > tstate->interp->ceval.recursion_limit || ++tstate->stackcheck_counter > 64); } #else static inline int _Py_MakeRecCheck(PyThreadState *tstate) { - return (++tstate->recursion_depth > _Py_CheckRecursionLimit); + return (++tstate->recursion_depth > tstate->interp->ceval.recursion_limit); } #endif @@ -90,20 +90,22 @@ static inline int _Py_EnterRecursiveCall_inline(const char *where) { #define Py_EnterRecursiveCall(where) _Py_EnterRecursiveCall_inline(where) - /* Compute the "lower-water mark" for a recursion limit. When * Py_LeaveRecursiveCall() is called with a recursion depth below this mark, * the overflowed flag is reset to 0. */ -#define _Py_RecursionLimitLowerWaterMark(limit) \ - (((limit) > 200) \ - ? ((limit) - 50) \ - : (3 * ((limit) >> 2))) - -#define _Py_MakeEndRecCheck(x) \ - (--(x) < _Py_RecursionLimitLowerWaterMark(_Py_CheckRecursionLimit)) +static inline int _Py_RecursionLimitLowerWaterMark(int limit) { + if (limit > 200) { + return (limit - 50); + } + else { + return (3 * (limit >> 2)); + } +} static inline void _Py_LeaveRecursiveCall(PyThreadState *tstate) { - if (_Py_MakeEndRecCheck(tstate->recursion_depth)) { + tstate->recursion_depth--; + int limit = tstate->interp->ceval.recursion_limit; + if (tstate->recursion_depth < _Py_RecursionLimitLowerWaterMark(limit)) { tstate->overflowed = 0; } } diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index fafc72eb97a00..08291012365ed 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -33,6 +33,7 @@ struct _pending_calls { }; struct _ceval_state { + int recursion_limit; /* Records whether tracing is on for any thread. Counts the number of threads for which tstate->c_tracefunc is non-NULL, so if the value is 0, we know we don't have to check this thread's diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index c59733559167a..8ca1dfbb3f0a6 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -14,7 +14,6 @@ extern "C" { /* ceval state */ struct _ceval_runtime_state { - int recursion_limit; struct _gil_runtime_state gil; }; diff --git a/Python/ceval.c b/Python/ceval.c index 6b002730c8d78..601e21a2fccd2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -699,7 +699,6 @@ int _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; void _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval) { - ceval->recursion_limit = Py_DEFAULT_RECURSION_LIMIT; _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; _gil_initialize(&ceval->gil); } @@ -707,6 +706,8 @@ _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval) int _PyEval_InitState(struct _ceval_state *ceval) { + ceval->recursion_limit = Py_DEFAULT_RECURSION_LIMIT; + struct _pending_calls *pending = &ceval->pending; assert(pending->lock == NULL); @@ -730,16 +731,18 @@ _PyEval_FiniState(struct _ceval_state *ceval) int Py_GetRecursionLimit(void) { - struct _ceval_runtime_state *ceval = &_PyRuntime.ceval; - return ceval->recursion_limit; + PyThreadState *tstate = _PyThreadState_GET(); + return tstate->interp->ceval.recursion_limit; } void Py_SetRecursionLimit(int new_limit) { - struct _ceval_runtime_state *ceval = &_PyRuntime.ceval; - ceval->recursion_limit = new_limit; - _Py_CheckRecursionLimit = new_limit; + PyThreadState *tstate = _PyThreadState_GET(); + tstate->interp->ceval.recursion_limit = new_limit; + if (_Py_IsMainInterpreter(tstate)) { + _Py_CheckRecursionLimit = new_limit; + } } /* The function _Py_EnterRecursiveCall() only calls _Py_CheckRecursiveCall() @@ -750,8 +753,7 @@ Py_SetRecursionLimit(int new_limit) int _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) { - _PyRuntimeState *runtime = tstate->interp->runtime; - int recursion_limit = runtime->ceval.recursion_limit; + int recursion_limit = tstate->interp->ceval.recursion_limit; #ifdef USE_STACKCHECK tstate->stackcheck_counter = 0; @@ -760,8 +762,10 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) _PyErr_SetString(tstate, PyExc_MemoryError, "Stack overflow"); return -1; } - /* Needed for ABI backwards-compatibility (see bpo-31857) */ - _Py_CheckRecursionLimit = recursion_limit; + if (_Py_IsMainInterpreter(tstate)) { + /* Needed for ABI backwards-compatibility (see bpo-31857) */ + _Py_CheckRecursionLimit = recursion_limit; + } #endif if (tstate->recursion_critical) /* Somebody asked that we don't check for recursion. */ From webhook-mailer at python.org Tue May 5 11:07:50 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 15:07:50 -0000 Subject: [Python-checkins] bpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902) Message-ID: https://github.com/python/cpython/commit/b0be6b3b94fbdf31b796adc19dc86a04a52b03e1 commit: b0be6b3b94fbdf31b796adc19dc86a04a52b03e1 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T17:07:41+02:00 summary: bpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902) _PyErr_ChainExceptions() now ensures that the first parameter is an exception type, as done by _PyErr_SetObject(). * The following function now check PyExceptionInstance_Check() in an assertion using a new _PyBaseExceptionObject_cast() helper function: * PyException_GetTraceback(), PyException_SetTraceback() * PyException_GetCause(), PyException_SetCause() * PyException_GetContext(), PyException_SetContext() * PyExceptionClass_Name() now checks PyExceptionClass_Check() with an assertion. * Remove XXX comment and add gi_exc_state variable to _gen_throw(). * Remove comment from test_generators files: M Lib/test/test_generators.py M Objects/exceptions.c M Objects/genobject.c M Python/errors.c diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 5824ecd7c37e8..e047801199680 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -342,9 +342,6 @@ def g(): try: yield except Exception: - # Without the `gi_exc_state.exc_type != Py_None` in - # _gen_throw(), this line was causing a crash ("Segmentation - # fault (core dumped)") on e.g. Fedora 32. raise RuntimeError gen = g() diff --git a/Objects/exceptions.c b/Objects/exceptions.c index ca917b436c4bb..db5e3da12b00f 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -304,22 +304,33 @@ static PyGetSetDef BaseException_getset[] = { }; +static inline PyBaseExceptionObject* +_PyBaseExceptionObject_cast(PyObject *exc) +{ + assert(PyExceptionInstance_Check(exc)); + return (PyBaseExceptionObject *)exc; +} + + PyObject * -PyException_GetTraceback(PyObject *self) { - PyBaseExceptionObject *base_self = (PyBaseExceptionObject *)self; +PyException_GetTraceback(PyObject *self) +{ + PyBaseExceptionObject *base_self = _PyBaseExceptionObject_cast(self); Py_XINCREF(base_self->traceback); return base_self->traceback; } int -PyException_SetTraceback(PyObject *self, PyObject *tb) { - return BaseException_set_tb((PyBaseExceptionObject *)self, tb, NULL); +PyException_SetTraceback(PyObject *self, PyObject *tb) +{ + return BaseException_set_tb(_PyBaseExceptionObject_cast(self), tb, NULL); } PyObject * -PyException_GetCause(PyObject *self) { - PyObject *cause = ((PyBaseExceptionObject *)self)->cause; +PyException_GetCause(PyObject *self) +{ + PyObject *cause = _PyBaseExceptionObject_cast(self)->cause; Py_XINCREF(cause); return cause; } @@ -328,13 +339,15 @@ PyException_GetCause(PyObject *self) { void PyException_SetCause(PyObject *self, PyObject *cause) { - ((PyBaseExceptionObject *)self)->suppress_context = 1; - Py_XSETREF(((PyBaseExceptionObject *)self)->cause, cause); + PyBaseExceptionObject *base_self = _PyBaseExceptionObject_cast(self); + base_self->suppress_context = 1; + Py_XSETREF(base_self->cause, cause); } PyObject * -PyException_GetContext(PyObject *self) { - PyObject *context = ((PyBaseExceptionObject *)self)->context; +PyException_GetContext(PyObject *self) +{ + PyObject *context = _PyBaseExceptionObject_cast(self)->context; Py_XINCREF(context); return context; } @@ -343,7 +356,7 @@ PyException_GetContext(PyObject *self) { void PyException_SetContext(PyObject *self, PyObject *context) { - Py_XSETREF(((PyBaseExceptionObject *)self)->context, context); + Py_XSETREF(_PyBaseExceptionObject_cast(self)->context, context); } #undef PyExceptionClass_Name @@ -351,6 +364,7 @@ PyException_SetContext(PyObject *self, PyObject *context) const char * PyExceptionClass_Name(PyObject *ob) { + assert(PyExceptionClass_Check(ob)); return ((PyTypeObject*)ob)->tp_name; } diff --git a/Objects/genobject.c b/Objects/genobject.c index b27fa929a2625..5b253edfdcd0f 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -512,15 +512,15 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, } PyErr_Restore(typ, val, tb); - /* XXX It seems like we shouldn't have to check not equal to Py_None - here because exc_type should only ever be a class. But not including - this check was causing crashes on certain tests e.g. on Fedora. */ - if (gen->gi_exc_state.exc_type && gen->gi_exc_state.exc_type != Py_None) { - Py_INCREF(gen->gi_exc_state.exc_type); - Py_XINCREF(gen->gi_exc_state.exc_value); - Py_XINCREF(gen->gi_exc_state.exc_traceback); - _PyErr_ChainExceptions(gen->gi_exc_state.exc_type, - gen->gi_exc_state.exc_value, gen->gi_exc_state.exc_traceback); + + _PyErr_StackItem *gi_exc_state = &gen->gi_exc_state; + if (gi_exc_state->exc_type != NULL && gi_exc_state->exc_type != Py_None) { + Py_INCREF(gi_exc_state->exc_type); + Py_XINCREF(gi_exc_state->exc_value); + Py_XINCREF(gi_exc_state->exc_traceback); + _PyErr_ChainExceptions(gi_exc_state->exc_type, + gi_exc_state->exc_value, + gi_exc_state->exc_traceback); } return gen_send_ex(gen, Py_None, 1, 0); diff --git a/Python/errors.c b/Python/errors.c index 9e53d050416ff..f856a798eed1e 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -107,7 +107,8 @@ _PyErr_SetObject(PyThreadState *tstate, PyObject *exception, PyObject *value) if (exception != NULL && !PyExceptionClass_Check(exception)) { _PyErr_Format(tstate, PyExc_SystemError, - "exception %R not a BaseException subclass", + "_PyErr_SetObject: " + "exception %R is not a BaseException subclass", exception); return; } @@ -484,6 +485,15 @@ _PyErr_ChainExceptions(PyObject *exc, PyObject *val, PyObject *tb) return; PyThreadState *tstate = _PyThreadState_GET(); + + if (!PyExceptionClass_Check(exc)) { + _PyErr_Format(tstate, PyExc_SystemError, + "_PyErr_ChainExceptions: " + "exception %R is not a BaseException subclass", + exc); + return; + } + if (_PyErr_Occurred(tstate)) { PyObject *exc2, *val2, *tb2; _PyErr_Fetch(tstate, &exc2, &val2, &tb2); From webhook-mailer at python.org Tue May 5 11:20:46 2020 From: webhook-mailer at python.org (Hai Shi) Date: Tue, 05 May 2020 15:20:46 -0000 Subject: [Python-checkins] bpo-40520: Remove redundant comment in pydebug.h (GH-19931) Message-ID: https://github.com/python/cpython/commit/6351d9e4400a77fe1fcbe4f03e5fb6620cca236d commit: 6351d9e4400a77fe1fcbe4f03e5fb6620cca236d branch: master author: Hai Shi committer: GitHub date: 2020-05-05T08:20:38-07:00 summary: bpo-40520: Remove redundant comment in pydebug.h (GH-19931) Automerge-Triggered-By: @corona10 files: M Include/pydebug.h diff --git a/Include/pydebug.h b/Include/pydebug.h index bd4aafe3b49f8..78bcb118be465 100644 --- a/Include/pydebug.h +++ b/Include/pydebug.h @@ -5,8 +5,6 @@ extern "C" { #endif -/* These global variable are defined in pylifecycle.c */ -/* XXX (ncoghlan): move these declarations to pylifecycle.h? */ PyAPI_DATA(int) Py_DebugFlag; PyAPI_DATA(int) Py_VerboseFlag; PyAPI_DATA(int) Py_QuietFlag; From webhook-mailer at python.org Tue May 5 11:40:26 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 15:40:26 -0000 Subject: [Python-checkins] Revert "bpo-40513: Per-interpreter signals pending (GH-19924)" (GH-19932) Message-ID: https://github.com/python/cpython/commit/299b8c61e9d1a42b929b8deb1b05067876e191e6 commit: 299b8c61e9d1a42b929b8deb1b05067876e191e6 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T17:40:18+02:00 summary: Revert "bpo-40513: Per-interpreter signals pending (GH-19924)" (GH-19932) This reverts commit 4e01946cafca0cf49f796c3118e0d65237bcad69. files: M Include/internal/pycore_interp.h M Include/internal/pycore_runtime.h M Python/ceval.c M Python/ceval_gil.h diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 08291012365ed..5bf8998e67320 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -46,8 +46,6 @@ struct _ceval_state { /* Request for dropping the GIL */ _Py_atomic_int gil_drop_request; struct _pending_calls pending; - /* Request for checking signals. */ - _Py_atomic_int signals_pending; }; diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index 8ca1dfbb3f0a6..34eb492b9f254 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -14,6 +14,11 @@ extern "C" { /* ceval state */ struct _ceval_runtime_state { + /* Request for checking signals. It is shared by all interpreters (see + bpo-40513). Any thread of any interpreter can receive a signal, but only + the main thread of the main interpreter can handle signals: see + _Py_ThreadCanHandleSignals(). */ + _Py_atomic_int signals_pending; struct _gil_runtime_state gil; }; diff --git a/Python/ceval.c b/Python/ceval.c index 601e21a2fccd2..0c08a76f7d113 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -143,70 +143,76 @@ is_tstate_valid(PyThreadState *tstate) the GIL eventually anyway. */ static inline void COMPUTE_EVAL_BREAKER(PyInterpreterState *interp, - struct _ceval_state *ceval) + struct _ceval_runtime_state *ceval, + struct _ceval_state *ceval2) { - _Py_atomic_store_relaxed(&ceval->eval_breaker, - _Py_atomic_load_relaxed(&ceval->gil_drop_request) + _Py_atomic_store_relaxed(&ceval2->eval_breaker, + _Py_atomic_load_relaxed(&ceval2->gil_drop_request) | (_Py_atomic_load_relaxed(&ceval->signals_pending) && _Py_ThreadCanHandleSignals(interp)) - | (_Py_atomic_load_relaxed(&ceval->pending.calls_to_do) + | (_Py_atomic_load_relaxed(&ceval2->pending.calls_to_do) && _Py_ThreadCanHandlePendingCalls()) - | ceval->pending.async_exc); + | ceval2->pending.async_exc); } static inline void SET_GIL_DROP_REQUEST(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; - _Py_atomic_store_relaxed(&ceval->gil_drop_request, 1); - _Py_atomic_store_relaxed(&ceval->eval_breaker, 1); + struct _ceval_state *ceval2 = &interp->ceval; + _Py_atomic_store_relaxed(&ceval2->gil_drop_request, 1); + _Py_atomic_store_relaxed(&ceval2->eval_breaker, 1); } static inline void RESET_GIL_DROP_REQUEST(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; - _Py_atomic_store_relaxed(&ceval->gil_drop_request, 0); - COMPUTE_EVAL_BREAKER(interp, ceval); + struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; + _Py_atomic_store_relaxed(&ceval2->gil_drop_request, 0); + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } static inline void SIGNAL_PENDING_CALLS(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; - _Py_atomic_store_relaxed(&ceval->pending.calls_to_do, 1); - COMPUTE_EVAL_BREAKER(interp, ceval); + struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; + _Py_atomic_store_relaxed(&ceval2->pending.calls_to_do, 1); + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } static inline void UNSIGNAL_PENDING_CALLS(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; - _Py_atomic_store_relaxed(&ceval->pending.calls_to_do, 0); - COMPUTE_EVAL_BREAKER(interp, ceval); + struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; + _Py_atomic_store_relaxed(&ceval2->pending.calls_to_do, 0); + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } static inline void SIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; + struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; _Py_atomic_store_relaxed(&ceval->signals_pending, 1); /* eval_breaker is not set to 1 if thread_can_handle_signals() is false */ - COMPUTE_EVAL_BREAKER(interp, ceval); + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } static inline void UNSIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; + struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; _Py_atomic_store_relaxed(&ceval->signals_pending, 0); - COMPUTE_EVAL_BREAKER(interp, ceval); + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } @@ -222,9 +228,10 @@ SIGNAL_ASYNC_EXC(PyInterpreterState *interp) static inline void UNSIGNAL_ASYNC_EXC(PyInterpreterState *interp) { - struct _ceval_state *ceval = &interp->ceval; - ceval->pending.async_exc = 0; - COMPUTE_EVAL_BREAKER(interp, ceval); + struct _ceval_runtime_state *ceval = &interp->runtime->ceval; + struct _ceval_state *ceval2 = &interp->ceval; + ceval2->pending.async_exc = 0; + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } @@ -349,11 +356,12 @@ PyEval_ReleaseLock(void) { _PyRuntimeState *runtime = &_PyRuntime; PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); - struct _ceval_state *ceval2 = &tstate->interp->ceval; /* This function must succeed when the current thread state is NULL. We therefore avoid PyThreadState_Get() which dumps a fatal error in debug mode. */ - drop_gil(&runtime->ceval, ceval2, tstate); + struct _ceval_runtime_state *ceval = &runtime->ceval; + struct _ceval_state *ceval2 = &tstate->interp->ceval; + drop_gil(ceval, ceval2, tstate); } void @@ -435,7 +443,6 @@ PyThreadState * PyEval_SaveThread(void) { _PyRuntimeState *runtime = &_PyRuntime; - PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, NULL); ensure_tstate_not_null(__func__, tstate); @@ -831,16 +838,16 @@ eval_frame_handle_pending(PyThreadState *tstate) { _PyRuntimeState * const runtime = &_PyRuntime; struct _ceval_runtime_state *ceval = &runtime->ceval; - struct _ceval_state *ceval2 = &tstate->interp->ceval; /* Pending signals */ - if (_Py_atomic_load_relaxed(&ceval2->signals_pending)) { + if (_Py_atomic_load_relaxed(&ceval->signals_pending)) { if (handle_signals(tstate) != 0) { return -1; } } /* Pending calls */ + struct _ceval_state *ceval2 = &tstate->interp->ceval; if (_Py_atomic_load_relaxed(&ceval2->pending.calls_to_do)) { if (make_pending_calls(tstate) != 0) { return -1; diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index db47077d5c1ce..f25f810073294 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -305,7 +305,7 @@ take_gil(PyThreadState *tstate) handle signals. Note: RESET_GIL_DROP_REQUEST() calls COMPUTE_EVAL_BREAKER(). */ - COMPUTE_EVAL_BREAKER(interp, ceval2); + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); } /* Don't access tstate if the thread must exit */ From webhook-mailer at python.org Tue May 5 12:50:38 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 16:50:38 -0000 Subject: [Python-checkins] bpo-40521: Disable Unicode caches in isolated subinterpreters (GH-19933) Message-ID: https://github.com/python/cpython/commit/607b1027fec7b4a1602aab7df57795fbcec1c51b commit: 607b1027fec7b4a1602aab7df57795fbcec1c51b branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T18:50:30+02:00 summary: bpo-40521: Disable Unicode caches in isolated subinterpreters (GH-19933) When Python is built in the experimental isolated subinterpreters mode, disable Unicode singletons and Unicode interned strings since they are shared by all interpreters. Temporary workaround until these caches are made per-interpreter. files: M Objects/typeobject.c M Objects/unicodeobject.c diff --git a/Objects/typeobject.c b/Objects/typeobject.c index db0ae970090ba..1565b90898605 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -56,6 +56,11 @@ static size_t method_cache_misses = 0; static size_t method_cache_collisions = 0; #endif +/* bpo-40521: Interned strings are shared by all subinterpreters */ +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# define INTERN_NAME_STRINGS +#endif + /* alphabetical order */ _Py_IDENTIFIER(__abstractmethods__); _Py_IDENTIFIER(__class__); @@ -3418,6 +3423,7 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) if (name == NULL) return -1; } +#ifdef INTERN_NAME_STRINGS if (!PyUnicode_CHECK_INTERNED(name)) { PyUnicode_InternInPlace(&name); if (!PyUnicode_CHECK_INTERNED(name)) { @@ -3427,6 +3433,7 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) return -1; } } +#endif } else { /* Will fail in _PyObject_GenericSetAttrWithDict. */ @@ -7531,10 +7538,17 @@ _PyTypes_InitSlotDefs(void) for (slotdef *p = slotdefs; p->name; p++) { /* Slots must be ordered by their offset in the PyHeapTypeObject. */ assert(!p[1].name || p->offset <= p[1].offset); +#ifdef INTERN_NAME_STRINGS p->name_strobj = PyUnicode_InternFromString(p->name); if (!p->name_strobj || !PyUnicode_CHECK_INTERNED(p->name_strobj)) { return _PyStatus_NO_MEMORY(); } +#else + p->name_strobj = PyUnicode_FromString(p->name); + if (!p->name_strobj) { + return _PyStatus_NO_MEMORY(); + } +#endif } slotdefs_initialized = 1; return _PyStatus_OK(); @@ -7559,7 +7573,9 @@ update_slot(PyTypeObject *type, PyObject *name) int offset; assert(PyUnicode_CheckExact(name)); +#ifdef INTERN_NAME_STRINGS assert(PyUnicode_CHECK_INTERNED(name)); +#endif assert(slotdefs_initialized); pp = ptrs; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index aba7407533c4e..18b9458721de1 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -198,6 +198,11 @@ extern "C" { # define OVERALLOCATE_FACTOR 4 #endif +/* bpo-40521: Interned strings are shared by all interpreters. */ +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# define INTERNED_STRINGS +#endif + /* This dictionary holds all interned unicode strings. Note that references to strings in this dictionary are *not* counted in the string's ob_refcnt. When the interned string reaches a refcnt of 0 the string deallocation @@ -206,7 +211,9 @@ extern "C" { Another way to look at this is that to say that the actual reference count of a string is: s->ob_refcnt + (s->state ? 2 : 0) */ +#ifdef INTERNED_STRINGS static PyObject *interned = NULL; +#endif /* The empty Unicode object is shared to improve performance. */ static PyObject *unicode_empty = NULL; @@ -281,9 +288,16 @@ unicode_decode_utf8(const char *s, Py_ssize_t size, /* List of static strings. */ static _Py_Identifier *static_strings = NULL; +/* bpo-40521: Latin1 singletons are shared by all interpreters. */ +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# define LATIN1_SINGLETONS +#endif + +#ifdef LATIN1_SINGLETONS /* Single character Unicode strings in the Latin-1 range are being shared as well. */ static PyObject *unicode_latin1[256] = {NULL}; +#endif /* Fast detection of the most frequent whitespace characters */ const unsigned char _Py_ascii_whitespace[] = { @@ -662,6 +676,7 @@ unicode_result_ready(PyObject *unicode) return unicode_empty; } +#ifdef LATIN1_SINGLETONS if (length == 1) { const void *data = PyUnicode_DATA(unicode); int kind = PyUnicode_KIND(unicode); @@ -683,6 +698,7 @@ unicode_result_ready(PyObject *unicode) } } } +#endif assert(_PyUnicode_CheckConsistency(unicode, 1)); return unicode; @@ -1913,10 +1929,12 @@ unicode_dealloc(PyObject *unicode) case SSTATE_INTERNED_MORTAL: /* revive dead object temporarily for DelItem */ Py_SET_REFCNT(unicode, 3); +#ifdef INTERNED_STRINGS if (PyDict_DelItem(interned, unicode) != 0) { _PyErr_WriteUnraisableMsg("deletion of interned string failed", NULL); } +#endif break; case SSTATE_INTERNED_IMMORTAL: @@ -1944,15 +1962,18 @@ unicode_dealloc(PyObject *unicode) static int unicode_is_singleton(PyObject *unicode) { - PyASCIIObject *ascii = (PyASCIIObject *)unicode; - if (unicode == unicode_empty) + if (unicode == unicode_empty) { return 1; + } +#ifdef LATIN1_SINGLETONS + PyASCIIObject *ascii = (PyASCIIObject *)unicode; if (ascii->state.kind != PyUnicode_WCHAR_KIND && ascii->length == 1) { Py_UCS4 ch = PyUnicode_READ_CHAR(unicode, 0); if (ch < 256 && unicode_latin1[ch] == unicode) return 1; } +#endif return 0; } #endif @@ -2094,16 +2115,28 @@ unicode_write_cstr(PyObject *unicode, Py_ssize_t index, static PyObject* get_latin1_char(unsigned char ch) { - PyObject *unicode = unicode_latin1[ch]; + PyObject *unicode; + +#ifdef LATIN1_SINGLETONS + unicode = unicode_latin1[ch]; + if (unicode) { + Py_INCREF(unicode); + return unicode; + } +#endif + + unicode = PyUnicode_New(1, ch); if (!unicode) { - unicode = PyUnicode_New(1, ch); - if (!unicode) - return NULL; - PyUnicode_1BYTE_DATA(unicode)[0] = ch; - assert(_PyUnicode_CheckConsistency(unicode, 1)); - unicode_latin1[ch] = unicode; + return NULL; } + + PyUnicode_1BYTE_DATA(unicode)[0] = ch; + assert(_PyUnicode_CheckConsistency(unicode, 1)); + +#ifdef LATIN1_SINGLETONS Py_INCREF(unicode); + unicode_latin1[ch] = unicode; +#endif return unicode; } @@ -11270,7 +11303,6 @@ int _PyUnicode_EqualToASCIIId(PyObject *left, _Py_Identifier *right) { PyObject *right_uni; - Py_hash_t hash; assert(_PyUnicode_CHECK(left)); assert(right->string); @@ -11302,10 +11334,12 @@ _PyUnicode_EqualToASCIIId(PyObject *left, _Py_Identifier *right) if (PyUnicode_CHECK_INTERNED(left)) return 0; +#ifdef INTERNED_STRINGS assert(_PyUnicode_HASH(right_uni) != -1); - hash = _PyUnicode_HASH(left); + Py_hash_t hash = _PyUnicode_HASH(left); if (hash != -1 && hash != _PyUnicode_HASH(right_uni)) return 0; +#endif return unicode_compare_eq(left, right_uni); } @@ -15487,20 +15521,26 @@ void PyUnicode_InternInPlace(PyObject **p) { PyObject *s = *p; - PyObject *t; #ifdef Py_DEBUG assert(s != NULL); assert(_PyUnicode_CHECK(s)); #else - if (s == NULL || !PyUnicode_Check(s)) + if (s == NULL || !PyUnicode_Check(s)) { return; + } #endif + /* If it's a subclass, we don't really know what putting it in the interned dict might do. */ - if (!PyUnicode_CheckExact(s)) + if (!PyUnicode_CheckExact(s)) { return; - if (PyUnicode_CHECK_INTERNED(s)) + } + + if (PyUnicode_CHECK_INTERNED(s)) { return; + } + +#ifdef INTERNED_STRINGS if (interned == NULL) { interned = PyDict_New(); if (interned == NULL) { @@ -15508,22 +15548,28 @@ PyUnicode_InternInPlace(PyObject **p) return; } } + + PyObject *t; Py_ALLOW_RECURSION t = PyDict_SetDefault(interned, s, s); Py_END_ALLOW_RECURSION + if (t == NULL) { PyErr_Clear(); return; } + if (t != s) { Py_INCREF(t); Py_SETREF(*p, t); return; } + /* The two references in interned are not counted by refcnt. The deallocator will take care of this */ Py_SET_REFCNT(s, Py_REFCNT(s) - 2); _PyUnicode_STATE(s).interned = SSTATE_INTERNED_MORTAL; +#endif } void @@ -16109,9 +16155,11 @@ _PyUnicode_Fini(PyThreadState *tstate) Py_CLEAR(unicode_empty); +#ifdef LATIN1_SINGLETONS for (Py_ssize_t i = 0; i < 256; i++) { Py_CLEAR(unicode_latin1[i]); } +#endif _PyUnicode_ClearStaticStrings(); } From webhook-mailer at python.org Tue May 5 13:45:43 2020 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 05 May 2020 17:45:43 -0000 Subject: [Python-checkins] bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845) Message-ID: https://github.com/python/cpython/commit/ac4bf424119d1300f57929120968e216a85d3a25 commit: ac4bf424119d1300f57929120968e216a85d3a25 branch: master author: Steve Dower committer: GitHub date: 2020-05-05T18:45:35+01:00 summary: bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845) files: A Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst M PCbuild/python_uwp.vcxproj M PCbuild/pythonw_uwp.vcxproj diff --git a/Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst b/Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst new file mode 100644 index 0000000000000..4dc1ff480df87 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst @@ -0,0 +1 @@ +Increase reserved stack space to prevent overflow crash on Windows. diff --git a/PCbuild/python_uwp.vcxproj b/PCbuild/python_uwp.vcxproj index 5ff120a0da331..fb27e9e71222e 100644 --- a/PCbuild/python_uwp.vcxproj +++ b/PCbuild/python_uwp.vcxproj @@ -95,6 +95,7 @@ windowsapp.lib;%(AdditionalDependencies) Console + 2000000 diff --git a/PCbuild/pythonw_uwp.vcxproj b/PCbuild/pythonw_uwp.vcxproj index 828d0d1ccac21..e21e46a1b722e 100644 --- a/PCbuild/pythonw_uwp.vcxproj +++ b/PCbuild/pythonw_uwp.vcxproj @@ -95,6 +95,7 @@ windowsapp.lib;%(AdditionalDependencies) Windows + 2000000 From webhook-mailer at python.org Tue May 5 13:55:34 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 17:55:34 -0000 Subject: [Python-checkins] bpo-40521: Disable free lists in subinterpreters (GH-19937) Message-ID: https://github.com/python/cpython/commit/b4b53868d7d6cd13505321d3802fd00865b25e05 commit: b4b53868d7d6cd13505321d3802fd00865b25e05 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T19:55:29+02:00 summary: bpo-40521: Disable free lists in subinterpreters (GH-19937) When Python is built with experimental isolated interpreters, disable tuple, dict and free free lists. Temporary workaround until these caches are made per-interpreter. Add frame_alloc() and frame_get_builtins() subfunctions to simplify _PyFrame_New_NoTrack(). files: M Objects/dictobject.c M Objects/frameobject.c M Objects/tupleobject.c diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 9c35f3c3f14d0..fa35d16478f63 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -250,16 +250,26 @@ static uint64_t pydict_global_version = 0; #ifndef PyDict_MAXFREELIST #define PyDict_MAXFREELIST 80 #endif + +/* bpo-40521: dict free lists are shared by all interpreters. */ +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# undef PyDict_MAXFREELIST +# define PyDict_MAXFREELIST 0 +#endif + +#if PyDict_MAXFREELIST > 0 static PyDictObject *free_list[PyDict_MAXFREELIST]; static int numfree = 0; static PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST]; static int numfreekeys = 0; +#endif #include "clinic/dictobject.c.h" void _PyDict_ClearFreeList(void) { +#if PyDict_MAXFREELIST > 0 while (numfree) { PyDictObject *op = free_list[--numfree]; assert(PyDict_CheckExact(op)); @@ -268,14 +278,17 @@ _PyDict_ClearFreeList(void) while (numfreekeys) { PyObject_FREE(keys_free_list[--numfreekeys]); } +#endif } /* Print summary info about the state of the optimized allocator */ void _PyDict_DebugMallocStats(FILE *out) { +#if PyDict_MAXFREELIST > 0 _PyDebugAllocatorStats(out, "free PyDictObject", numfree, sizeof(PyDictObject)); +#endif } @@ -553,10 +566,13 @@ static PyDictKeysObject *new_keys_object(Py_ssize_t size) es = sizeof(Py_ssize_t); } +#if PyDict_MAXFREELIST > 0 if (size == PyDict_MINSIZE && numfreekeys > 0) { dk = keys_free_list[--numfreekeys]; } - else { + else +#endif + { dk = PyObject_MALLOC(sizeof(PyDictKeysObject) + es * size + sizeof(PyDictKeyEntry) * usable); @@ -587,10 +603,12 @@ free_keys_object(PyDictKeysObject *keys) Py_XDECREF(entries[i].me_key); Py_XDECREF(entries[i].me_value); } +#if PyDict_MAXFREELIST > 0 if (keys->dk_size == PyDict_MINSIZE && numfreekeys < PyDict_MAXFREELIST) { keys_free_list[numfreekeys++] = keys; return; } +#endif PyObject_FREE(keys); } @@ -603,13 +621,16 @@ new_dict(PyDictKeysObject *keys, PyObject **values) { PyDictObject *mp; assert(keys != NULL); +#if PyDict_MAXFREELIST > 0 if (numfree) { mp = free_list[--numfree]; assert (mp != NULL); assert (Py_IS_TYPE(mp, &PyDict_Type)); _Py_NewReference((PyObject *)mp); } - else { + else +#endif + { mp = PyObject_GC_New(PyDictObject, &PyDict_Type); if (mp == NULL) { dictkeys_decref(keys); @@ -1258,12 +1279,15 @@ dictresize(PyDictObject *mp, Py_ssize_t minsize) #ifdef Py_REF_DEBUG _Py_RefTotal--; #endif +#if PyDict_MAXFREELIST > 0 if (oldkeys->dk_size == PyDict_MINSIZE && numfreekeys < PyDict_MAXFREELIST) { keys_free_list[numfreekeys++] = oldkeys; } - else { + else +#endif + { PyObject_FREE(oldkeys); } } @@ -2005,10 +2029,15 @@ dict_dealloc(PyDictObject *mp) assert(keys->dk_refcnt == 1); dictkeys_decref(keys); } - if (numfree < PyDict_MAXFREELIST && Py_IS_TYPE(mp, &PyDict_Type)) +#if PyDict_MAXFREELIST > 0 + if (numfree < PyDict_MAXFREELIST && Py_IS_TYPE(mp, &PyDict_Type)) { free_list[numfree++] = mp; + } else +#endif + { Py_TYPE(mp)->tp_free((PyObject *)mp); + } Py_TRASHCAN_END } diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 4f5054d32bb01..af32276c98b24 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -556,11 +556,19 @@ static PyGetSetDef frame_getsetlist[] = { free_list. Else programs creating lots of cyclic trash involving frames could provoke free_list into growing without bound. */ +/* max value for numfree */ +#define PyFrame_MAXFREELIST 200 + +/* bpo-40521: frame free lists are shared by all interpreters. */ +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# undef PyFrame_MAXFREELIST +# define PyFrame_MAXFREELIST 0 +#endif +#if PyFrame_MAXFREELIST > 0 static PyFrameObject *free_list = NULL; static int numfree = 0; /* number of frames currently in free_list */ -/* max value for numfree */ -#define PyFrame_MAXFREELIST 200 +#endif static void _Py_HOT_FUNCTION frame_dealloc(PyFrameObject *f) @@ -590,15 +598,19 @@ frame_dealloc(PyFrameObject *f) Py_CLEAR(f->f_trace); co = f->f_code; - if (co->co_zombieframe == NULL) + if (co->co_zombieframe == NULL) { co->co_zombieframe = f; + } +#if PyFrame_MAXFREELIST > 0 else if (numfree < PyFrame_MAXFREELIST) { ++numfree; f->f_back = free_list; free_list = f; } - else +#endif + else { PyObject_GC_Del(f); + } Py_DECREF(co); Py_TRASHCAN_SAFE_END(f) @@ -759,98 +771,127 @@ PyTypeObject PyFrame_Type = { _Py_IDENTIFIER(__builtins__); -PyFrameObject* _Py_HOT_FUNCTION -_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code, - PyObject *globals, PyObject *locals) +static inline PyFrameObject* +frame_alloc(PyCodeObject *code) { - PyFrameObject *back = tstate->frame; PyFrameObject *f; - PyObject *builtins; - Py_ssize_t i; -#ifdef Py_DEBUG - if (code == NULL || globals == NULL || !PyDict_Check(globals) || - (locals != NULL && !PyMapping_Check(locals))) { - PyErr_BadInternalCall(); - return NULL; + f = code->co_zombieframe; + if (f != NULL) { + code->co_zombieframe = NULL; + _Py_NewReference((PyObject *)f); + assert(f->f_code == code); + return f; } + + Py_ssize_t ncells = PyTuple_GET_SIZE(code->co_cellvars); + Py_ssize_t nfrees = PyTuple_GET_SIZE(code->co_freevars); + Py_ssize_t extras = code->co_stacksize + code->co_nlocals + ncells + nfrees; +#if PyFrame_MAXFREELIST > 0 + if (free_list == NULL) #endif - if (back == NULL || back->f_globals != globals) { - builtins = _PyDict_GetItemIdWithError(globals, &PyId___builtins__); - if (builtins) { - if (PyModule_Check(builtins)) { - builtins = PyModule_GetDict(builtins); - assert(builtins != NULL); - } + { + f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, extras); + if (f == NULL) { + return NULL; } - if (builtins == NULL) { - if (PyErr_Occurred()) { + } +#if PyFrame_MAXFREELIST > 0 + else { + assert(numfree > 0); + --numfree; + f = free_list; + free_list = free_list->f_back; + if (Py_SIZE(f) < extras) { + PyFrameObject *new_f = PyObject_GC_Resize(PyFrameObject, f, extras); + if (new_f == NULL) { + PyObject_GC_Del(f); return NULL; } - /* No builtins! Make up a minimal one - Give them 'None', at least. */ - builtins = PyDict_New(); - if (builtins == NULL || - PyDict_SetItemString( - builtins, "None", Py_None) < 0) - return NULL; + f = new_f; } - else - Py_INCREF(builtins); + _Py_NewReference((PyObject *)f); + } +#endif + f->f_code = code; + extras = code->co_nlocals + ncells + nfrees; + f->f_valuestack = f->f_localsplus + extras; + for (Py_ssize_t i=0; if_localsplus[i] = NULL; } - else { + f->f_locals = NULL; + f->f_trace = NULL; + return f; +} + + +static inline PyObject * +frame_get_builtins(PyFrameObject *back, PyObject *globals) +{ + PyObject *builtins; + + if (back != NULL && back->f_globals == globals) { /* If we share the globals, we share the builtins. Save a lookup and a call. */ builtins = back->f_builtins; assert(builtins != NULL); Py_INCREF(builtins); + return builtins; } - if (code->co_zombieframe != NULL) { - f = code->co_zombieframe; - code->co_zombieframe = NULL; - _Py_NewReference((PyObject *)f); - assert(f->f_code == code); + + builtins = _PyDict_GetItemIdWithError(globals, &PyId___builtins__); + if (builtins != NULL && PyModule_Check(builtins)) { + builtins = PyModule_GetDict(builtins); + assert(builtins != NULL); } - else { - Py_ssize_t extras, ncells, nfrees; - ncells = PyTuple_GET_SIZE(code->co_cellvars); - nfrees = PyTuple_GET_SIZE(code->co_freevars); - extras = code->co_stacksize + code->co_nlocals + ncells + - nfrees; - if (free_list == NULL) { - f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, - extras); - if (f == NULL) { - Py_DECREF(builtins); - return NULL; - } - } - else { - assert(numfree > 0); - --numfree; - f = free_list; - free_list = free_list->f_back; - if (Py_SIZE(f) < extras) { - PyFrameObject *new_f = PyObject_GC_Resize(PyFrameObject, f, extras); - if (new_f == NULL) { - PyObject_GC_Del(f); - Py_DECREF(builtins); - return NULL; - } - f = new_f; - } - _Py_NewReference((PyObject *)f); - } + if (builtins != NULL) { + Py_INCREF(builtins); + return builtins; + } + + if (PyErr_Occurred()) { + return NULL; + } + + /* No builtins! Make up a minimal one. + Give them 'None', at least. */ + builtins = PyDict_New(); + if (builtins == NULL) { + return NULL; + } + if (PyDict_SetItemString(builtins, "None", Py_None) < 0) { + Py_DECREF(builtins); + return NULL; + } + return builtins; +} - f->f_code = code; - extras = code->co_nlocals + ncells + nfrees; - f->f_valuestack = f->f_localsplus + extras; - for (i=0; if_localsplus[i] = NULL; - f->f_locals = NULL; - f->f_trace = NULL; + +PyFrameObject* _Py_HOT_FUNCTION +_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code, + PyObject *globals, PyObject *locals) +{ +#ifdef Py_DEBUG + if (code == NULL || globals == NULL || !PyDict_Check(globals) || + (locals != NULL && !PyMapping_Check(locals))) { + PyErr_BadInternalCall(); + return NULL; + } +#endif + + PyFrameObject *back = tstate->frame; + PyObject *builtins = frame_get_builtins(back, globals); + if (builtins == NULL) { + return NULL; } + + PyFrameObject *f = frame_alloc(code); + if (f == NULL) { + Py_DECREF(builtins); + return NULL; + } + f->f_stacktop = f->f_valuestack; f->f_builtins = builtins; Py_XINCREF(back); @@ -1142,6 +1183,7 @@ PyFrame_LocalsToFast(PyFrameObject *f, int clear) void _PyFrame_ClearFreeList(void) { +#if PyFrame_MAXFREELIST > 0 while (free_list != NULL) { PyFrameObject *f = free_list; free_list = free_list->f_back; @@ -1149,6 +1191,7 @@ _PyFrame_ClearFreeList(void) --numfree; } assert(numfree == 0); +#endif } void @@ -1161,9 +1204,11 @@ _PyFrame_Fini(void) void _PyFrame_DebugMallocStats(FILE *out) { +#if PyFrame_MAXFREELIST > 0 _PyDebugAllocatorStats(out, "free PyFrameObject", numfree, sizeof(PyFrameObject)); +#endif } diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index f8648d24f1c87..c0b59c009a2e9 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -22,6 +22,12 @@ class tuple "PyTupleObject *" "&PyTuple_Type" #define PyTuple_MAXFREELIST 2000 /* Maximum number of tuples of each size to save */ #endif +/* bpo-40521: tuple free lists are shared by all interpreters. */ +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# undef PyTuple_MAXSAVESIZE +# define PyTuple_MAXSAVESIZE 0 +#endif + #if PyTuple_MAXSAVESIZE > 0 /* Entries 1 up to PyTuple_MAXSAVESIZE are free lists, entry 0 is the empty tuple () of which at most one instance will be allocated. @@ -248,7 +254,9 @@ tupledealloc(PyTupleObject *op) #endif } Py_TYPE(op)->tp_free((PyObject *)op); +#if PyTuple_MAXSAVESIZE > 0 done: +#endif Py_TRASHCAN_END } From webhook-mailer at python.org Tue May 5 13:56:53 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 17:56:53 -0000 Subject: [Python-checkins] bpo-40522: _PyThreadState_Swap() sets autoTSSkey (GH-19939) Message-ID: https://github.com/python/cpython/commit/e838a9324c1719bb917ca81ede8d766b5cb551f4 commit: e838a9324c1719bb917ca81ede8d766b5cb551f4 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T19:56:48+02:00 summary: bpo-40522: _PyThreadState_Swap() sets autoTSSkey (GH-19939) In the experimental isolated subinterpreters build mode, _PyThreadState_GET() gets the autoTSSkey variable and _PyThreadState_Swap() sets the autoTSSkey variable. * Add _PyThreadState_GetTSS() * _PyRuntimeState_GetThreadState() and _PyThreadState_GET() return _PyThreadState_GetTSS() * PyEval_SaveThread() sets the autoTSSkey variable to current Python thread state rather than NULL. * eval_frame_handle_pending() doesn't check that _PyThreadState_Swap() result is NULL. * _PyThreadState_Swap() gets the current Python thread state with _PyThreadState_GetTSS() rather than _PyRuntimeGILState_GetThreadState(). * PyGILState_Ensure() no longer checks _PyEval_ThreadsInitialized() since it cannot access the current interpreter. files: M Include/internal/pycore_pystate.h M Python/ceval.c M Python/pystate.c diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index c82e8db905188..d96ba31207001 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -49,8 +49,18 @@ _Py_ThreadCanHandlePendingCalls(void) /* Variable and macro for in-line access to current thread and interpreter state */ -static inline PyThreadState* _PyRuntimeState_GetThreadState(_PyRuntimeState *runtime) { +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +PyAPI_FUNC(PyThreadState*) _PyThreadState_GetTSS(void); +#endif + +static inline PyThreadState* +_PyRuntimeState_GetThreadState(_PyRuntimeState *runtime) +{ +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + return _PyThreadState_GetTSS(); +#else return (PyThreadState*)_Py_atomic_load_relaxed(&runtime->gilstate.tstate_current); +#endif } /* Get the current Python thread state. @@ -62,8 +72,14 @@ static inline PyThreadState* _PyRuntimeState_GetThreadState(_PyRuntimeState *run The caller must hold the GIL. See also PyThreadState_Get() and PyThreadState_GET(). */ -static inline PyThreadState *_PyThreadState_GET(void) { +static inline PyThreadState* +_PyThreadState_GET(void) +{ +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + return _PyThreadState_GetTSS(); +#else return _PyRuntimeState_GetThreadState(&_PyRuntime); +#endif } /* Redefine PyThreadState_GET() as an alias to _PyThreadState_GET() */ diff --git a/Python/ceval.c b/Python/ceval.c index 0c08a76f7d113..b5854d3446463 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -380,9 +380,13 @@ PyEval_AcquireThread(PyThreadState *tstate) take_gil(tstate); struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + (void)_PyThreadState_Swap(gilstate, tstate); +#else if (_PyThreadState_Swap(gilstate, tstate) != NULL) { Py_FatalError("non-NULL old thread state"); } +#endif } void @@ -443,7 +447,12 @@ PyThreadState * PyEval_SaveThread(void) { _PyRuntimeState *runtime = &_PyRuntime; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + PyThreadState *old_tstate = _PyThreadState_GET(); + PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, old_tstate); +#else PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, NULL); +#endif ensure_tstate_not_null(__func__, tstate); struct _ceval_runtime_state *ceval = &runtime->ceval; @@ -866,9 +875,13 @@ eval_frame_handle_pending(PyThreadState *tstate) take_gil(tstate); +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + (void)_PyThreadState_Swap(&runtime->gilstate, tstate); +#else if (_PyThreadState_Swap(&runtime->gilstate, tstate) != NULL) { Py_FatalError("orphan tstate"); } +#endif } /* Check for asynchronous exception. */ diff --git a/Python/pystate.c b/Python/pystate.c index dd95750027241..119fe31a84ba1 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -956,6 +956,14 @@ _PyThreadState_DeleteExcept(_PyRuntimeState *runtime, PyThreadState *tstate) } +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +PyThreadState* +_PyThreadState_GetTSS(void) { + return PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey); +} +#endif + + PyThreadState * _PyThreadState_UncheckedGet(void) { @@ -975,7 +983,11 @@ PyThreadState_Get(void) PyThreadState * _PyThreadState_Swap(struct _gilstate_runtime_state *gilstate, PyThreadState *newts) { +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + PyThreadState *oldts = _PyThreadState_GetTSS(); +#else PyThreadState *oldts = _PyRuntimeGILState_GetThreadState(gilstate); +#endif _PyRuntimeGILState_SetThreadState(gilstate, newts); /* It should not be possible for more than one thread state @@ -993,6 +1005,9 @@ _PyThreadState_Swap(struct _gilstate_runtime_state *gilstate, PyThreadState *new Py_FatalError("Invalid thread state for this thread"); errno = err; } +#endif +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + PyThread_tss_set(&gilstate->autoTSSkey, newts); #endif return oldts; } @@ -1363,7 +1378,9 @@ PyGILState_Ensure(void) /* Ensure that _PyEval_InitThreads() and _PyGILState_Init() have been called by Py_Initialize() */ +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS assert(_PyEval_ThreadsInitialized(runtime)); +#endif assert(gilstate->autoInterpreterState); PyThreadState *tcur = (PyThreadState *)PyThread_tss_get(&gilstate->autoTSSkey); From webhook-mailer at python.org Tue May 5 14:03:25 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 05 May 2020 18:03:25 -0000 Subject: [Python-checkins] bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845) Message-ID: https://github.com/python/cpython/commit/a6a116c1b964b3d1fdff0f533861ed2a2227de1f commit: a6a116c1b964b3d1fdff0f533861ed2a2227de1f branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-05T11:03:21-07:00 summary: bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845) (cherry picked from commit ac4bf424119d1300f57929120968e216a85d3a25) Co-authored-by: Steve Dower files: A Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst M PCbuild/python_uwp.vcxproj M PCbuild/pythonw_uwp.vcxproj diff --git a/Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst b/Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst new file mode 100644 index 0000000000000..4dc1ff480df87 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2020-05-01-20-57-57.bpo-40458.Eb0ueI.rst @@ -0,0 +1 @@ +Increase reserved stack space to prevent overflow crash on Windows. diff --git a/PCbuild/python_uwp.vcxproj b/PCbuild/python_uwp.vcxproj index 5ff120a0da331..fb27e9e71222e 100644 --- a/PCbuild/python_uwp.vcxproj +++ b/PCbuild/python_uwp.vcxproj @@ -95,6 +95,7 @@ windowsapp.lib;%(AdditionalDependencies) Console + 2000000 diff --git a/PCbuild/pythonw_uwp.vcxproj b/PCbuild/pythonw_uwp.vcxproj index 828d0d1ccac21..e21e46a1b722e 100644 --- a/PCbuild/pythonw_uwp.vcxproj +++ b/PCbuild/pythonw_uwp.vcxproj @@ -95,6 +95,7 @@ windowsapp.lib;%(AdditionalDependencies) Windows + 2000000 From webhook-mailer at python.org Tue May 5 14:16:46 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 18:16:46 -0000 Subject: [Python-checkins] bpo-40513: new_interpreter() init GIL earlier (GH-19942) Message-ID: https://github.com/python/cpython/commit/0dd5e7a718997da2026ed64fe054dc36cae4fee7 commit: 0dd5e7a718997da2026ed64fe054dc36cae4fee7 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T20:16:37+02:00 summary: bpo-40513: new_interpreter() init GIL earlier (GH-19942) Fix also code to handle init_interp_main() failure. files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 5726a559cfcb7..2149d8928d596 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1575,19 +1575,19 @@ new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter) } interp->config._isolated_interpreter = isolated_subinterpreter; - status = pycore_interp_init(tstate); + status = init_interp_create_gil(tstate); if (_PyStatus_EXCEPTION(status)) { goto error; } - status = init_interp_main(tstate); + status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { goto error; } - status = init_interp_create_gil(tstate); + status = init_interp_main(tstate); if (_PyStatus_EXCEPTION(status)) { - return status; + goto error; } *tstate_p = tstate; From webhook-mailer at python.org Tue May 5 14:27:55 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 18:27:55 -0000 Subject: [Python-checkins] bpo-40513: Per-interpreter GIL (GH-19943) Message-ID: https://github.com/python/cpython/commit/7be4e350aadf93c4be5c97b7291d0db2b6bc1dc4 commit: 7be4e350aadf93c4be5c97b7291d0db2b6bc1dc4 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T20:27:47+02:00 summary: bpo-40513: Per-interpreter GIL (GH-19943) In the experimental isolated subinterpreters build mode, the GIL is now per-interpreter. Move gil from _PyRuntimeState.ceval to PyInterpreterState.ceval. new_interpreter() always get the config from the main interpreter. files: M Include/internal/pycore_ceval.h M Include/internal/pycore_interp.h M Include/internal/pycore_runtime.h M Python/ceval.c M Python/ceval_gil.h M Python/pylifecycle.c diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 18c8f027af16e..368990099089f 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -50,7 +50,11 @@ extern PyObject *_PyEval_EvalCode( PyObject *kwdefs, PyObject *closure, PyObject *name, PyObject *qualname); +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +extern int _PyEval_ThreadsInitialized(PyInterpreterState *interp); +#else extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime); +#endif extern PyStatus _PyEval_InitGIL(PyThreadState *tstate); extern void _PyEval_FiniGIL(PyThreadState *tstate); diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 5bf8998e67320..26e7a473a12dc 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -46,6 +46,9 @@ struct _ceval_state { /* Request for dropping the GIL */ _Py_atomic_int gil_drop_request; struct _pending_calls pending; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + struct _gil_runtime_state gil; +#endif }; diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index 34eb492b9f254..ebdc12b23a9ca 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -19,7 +19,9 @@ struct _ceval_runtime_state { the main thread of the main interpreter can handle signals: see _Py_ThreadCanHandleSignals(). */ _Py_atomic_int signals_pending; +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS struct _gil_runtime_state gil; +#endif }; /* GIL state */ diff --git a/Python/ceval.c b/Python/ceval.c index b5854d3446463..6435bd05446aa 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -250,6 +250,21 @@ ensure_tstate_not_null(const char *func, PyThreadState *tstate) } +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +int +_PyEval_ThreadsInitialized(PyInterpreterState *interp) +{ + return gil_created(&interp->ceval.gil); +} + +int +PyEval_ThreadsInitialized(void) +{ + // Fatal error if there is no current interpreter + PyInterpreterState *interp = PyInterpreterState_Get(); + return _PyEval_ThreadsInitialized(interp); +} +#else int _PyEval_ThreadsInitialized(_PyRuntimeState *runtime) { @@ -262,18 +277,25 @@ PyEval_ThreadsInitialized(void) _PyRuntimeState *runtime = &_PyRuntime; return _PyEval_ThreadsInitialized(runtime); } +#endif PyStatus _PyEval_InitGIL(PyThreadState *tstate) { +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS if (!_Py_IsMainInterpreter(tstate)) { /* Currently, the GIL is shared by all interpreters, and only the main interpreter is responsible to create and destroy it. */ return _PyStatus_OK(); } +#endif +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + struct _gil_runtime_state *gil = &tstate->interp->ceval.gil; +#else struct _gil_runtime_state *gil = &tstate->interp->runtime->ceval.gil; +#endif assert(!gil_created(gil)); PyThread_init_thread(); @@ -288,14 +310,20 @@ _PyEval_InitGIL(PyThreadState *tstate) void _PyEval_FiniGIL(PyThreadState *tstate) { +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS if (!_Py_IsMainInterpreter(tstate)) { /* Currently, the GIL is shared by all interpreters, and only the main interpreter is responsible to create and destroy it. */ return; } +#endif +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + struct _gil_runtime_state *gil = &tstate->interp->ceval.gil; +#else struct _gil_runtime_state *gil = &tstate->interp->runtime->ceval.gil; +#endif if (!gil_created(gil)) { /* First Py_InitializeFromConfig() call: the GIL doesn't exist yet: do nothing. */ @@ -413,13 +441,18 @@ PyEval_ReleaseThread(PyThreadState *tstate) void _PyEval_ReInitThreads(_PyRuntimeState *runtime) { + PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); + ensure_tstate_not_null(__func__, tstate); + +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + struct _gil_runtime_state *gil = &tstate->interp->ceval.gil; +#else struct _gil_runtime_state *gil = &runtime->ceval.gil; +#endif if (!gil_created(gil)) { return; } recreate_gil(gil); - PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); - ensure_tstate_not_null(__func__, tstate); take_gil(tstate); @@ -457,7 +490,11 @@ PyEval_SaveThread(void) struct _ceval_runtime_state *ceval = &runtime->ceval; struct _ceval_state *ceval2 = &tstate->interp->ceval; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + assert(gil_created(&ceval2->gil)); +#else assert(gil_created(&ceval->gil)); +#endif drop_gil(ceval, ceval2, tstate); return tstate; } @@ -716,7 +753,9 @@ void _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval) { _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS _gil_initialize(&ceval->gil); +#endif } int @@ -731,6 +770,11 @@ _PyEval_InitState(struct _ceval_state *ceval) if (pending->lock == NULL) { return -1; } + +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + _gil_initialize(&ceval->gil); +#endif + return 0; } diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index f25f810073294..56944b89237fb 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -144,7 +144,11 @@ static void drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2, PyThreadState *tstate) { +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + struct _gil_runtime_state *gil = &ceval2->gil; +#else struct _gil_runtime_state *gil = &ceval->gil; +#endif if (!_Py_atomic_load_relaxed(&gil->locked)) { Py_FatalError("drop_gil: GIL is not locked"); } @@ -228,7 +232,11 @@ take_gil(PyThreadState *tstate) PyInterpreterState *interp = tstate->interp; struct _ceval_runtime_state *ceval = &interp->runtime->ceval; struct _ceval_state *ceval2 = &interp->ceval; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + struct _gil_runtime_state *gil = &ceval2->gil; +#else struct _gil_runtime_state *gil = &ceval->gil; +#endif /* Check that _PyEval_InitThreads() was called to create the lock */ assert(gil_created(gil)); @@ -320,10 +328,22 @@ take_gil(PyThreadState *tstate) void _PyEval_SetSwitchInterval(unsigned long microseconds) { - _PyRuntime.ceval.gil.interval = microseconds; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + PyInterpreterState *interp = PyInterpreterState_Get(); + struct _gil_runtime_state *gil = &interp->ceval.gil; +#else + struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil; +#endif + gil->interval = microseconds; } unsigned long _PyEval_GetSwitchInterval() { - return _PyRuntime.ceval.gil.interval; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + PyInterpreterState *interp = PyInterpreterState_Get(); + struct _gil_runtime_state *gil = &interp->ceval.gil; +#else + struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil; +#endif + return gil->interval; } diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 2149d8928d596..da66a82ada70a 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1561,9 +1561,13 @@ new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter) /* Copy the current interpreter config into the new interpreter */ const PyConfig *config; +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS if (save_tstate != NULL) { config = _PyInterpreterState_GetConfig(save_tstate->interp); - } else { + } + else +#endif + { /* No current thread state, copy from the main interpreter */ PyInterpreterState *main_interp = PyInterpreterState_Main(); config = _PyInterpreterState_GetConfig(main_interp); From webhook-mailer at python.org Tue May 5 14:33:11 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 May 2020 18:33:11 -0000 Subject: [Python-checkins] bpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944) Message-ID: https://github.com/python/cpython/commit/fb2c7c4afbab0514352ab0246b0c0cc85d1bba53 commit: fb2c7c4afbab0514352ab0246b0c0cc85d1bba53 branch: master author: Victor Stinner committer: GitHub date: 2020-05-05T20:33:06+02:00 summary: bpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944) In the experimental isolated subinterpreters build mode, _xxsubinterpreters.run_string() now releases the GIL. files: M Modules/_xxsubinterpretersmodule.c diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index de11c090870f9..8a6fce9e0b4bd 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -1939,6 +1939,20 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr, return -1; } +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + // Switch to interpreter. + PyThreadState *new_tstate = PyInterpreterState_ThreadHead(interp); + PyThreadState *save1 = PyEval_SaveThread(); + + (void)PyThreadState_Swap(new_tstate); + + // Run the script. + _sharedexception *exc = NULL; + int result = _run_script(interp, codestr, shared, &exc); + + // Switch back. + PyEval_RestoreThread(save1); +#else // Switch to interpreter. PyThreadState *save_tstate = NULL; if (interp != PyInterpreterState_Get()) { @@ -1956,6 +1970,7 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr, if (save_tstate != NULL) { PyThreadState_Swap(save_tstate); } +#endif // Propagate any exception out to the caller. if (exc != NULL) { From webhook-mailer at python.org Tue May 5 15:41:05 2020 From: webhook-mailer at python.org (Curtis Bucher) Date: Tue, 05 May 2020 19:41:05 -0000 Subject: [Python-checkins] bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868) Message-ID: https://github.com/python/cpython/commit/c21c51235aa8061da6b0593d6f857f42fd92fd8b commit: c21c51235aa8061da6b0593d6f857f42fd92fd8b branch: master author: Curtis Bucher committer: GitHub date: 2020-05-05T20:40:56+01:00 summary: bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868) Co-authored-by: Pablo Galindo files: A Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst M Lib/ast.py M Lib/test/test_ast.py diff --git a/Lib/ast.py b/Lib/ast.py index 5c68c4a66e1dd..7a43581c0e6ce 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -62,11 +62,12 @@ def literal_eval(node_or_string): node_or_string = parse(node_or_string, mode='eval') if isinstance(node_or_string, Expression): node_or_string = node_or_string.body + def _raise_malformed_node(node): + raise ValueError(f'malformed node or string: {node!r}') def _convert_num(node): - if isinstance(node, Constant): - if type(node.value) in (int, float, complex): - return node.value - raise ValueError('malformed node or string: ' + repr(node)) + if not isinstance(node, Constant) or type(node.value) not in (int, float, complex): + _raise_malformed_node(node) + return node.value def _convert_signed_num(node): if isinstance(node, UnaryOp) and isinstance(node.op, (UAdd, USub)): operand = _convert_num(node.operand) @@ -88,6 +89,8 @@ def _convert(node): node.func.id == 'set' and node.args == node.keywords == []): return set() elif isinstance(node, Dict): + if len(node.keys) != len(node.values): + _raise_malformed_node(node) return dict(zip(map(_convert, node.keys), map(_convert, node.values))) elif isinstance(node, BinOp) and isinstance(node.op, (Add, Sub)): diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 9063b3d2d7b74..a8a13fdcd7426 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -965,6 +965,12 @@ def test_literal_eval_complex(self): self.assertRaises(ValueError, ast.literal_eval, '3+(0+6j)') self.assertRaises(ValueError, ast.literal_eval, '-(3+6j)') + def test_literal_eval_malformed_dict_nodes(self): + malformed = ast.Dict(keys=[ast.Constant(1), ast.Constant(2)], values=[ast.Constant(3)]) + self.assertRaises(ValueError, ast.literal_eval, malformed) + malformed = ast.Dict(keys=[ast.Constant(1)], values=[ast.Constant(2), ast.Constant(3)]) + self.assertRaises(ValueError, ast.literal_eval, malformed) + def test_bad_integer(self): # issue13436: Bad error message with invalid numeric values body = [ast.ImportFrom(module='time', diff --git a/Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst b/Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst new file mode 100644 index 0000000000000..81f9e937a2bff --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst @@ -0,0 +1,2 @@ +Improve error reporting in :func:`ast.literal_eval` in the presence of malformed :class:`ast.Dict` +nodes instead of silently ignoring any non-conforming elements. Patch by Curtis Bucher. From webhook-mailer at python.org Tue May 5 16:01:05 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 05 May 2020 20:01:05 -0000 Subject: [Python-checkins] bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868) Message-ID: https://github.com/python/cpython/commit/2a3b876b0286b22a9058510d9e51dc4d60eeb89a commit: 2a3b876b0286b22a9058510d9e51dc4d60eeb89a branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-05T13:00:57-07:00 summary: bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868) Co-authored-by: Pablo Galindo (cherry picked from commit c21c51235aa8061da6b0593d6f857f42fd92fd8b) Co-authored-by: Curtis Bucher files: A Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst M Lib/ast.py M Lib/test/test_ast.py diff --git a/Lib/ast.py b/Lib/ast.py index 157a8332ebcc5..0c88bcf4c821e 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -59,11 +59,12 @@ def literal_eval(node_or_string): node_or_string = parse(node_or_string, mode='eval') if isinstance(node_or_string, Expression): node_or_string = node_or_string.body + def _raise_malformed_node(node): + raise ValueError(f'malformed node or string: {node!r}') def _convert_num(node): - if isinstance(node, Constant): - if type(node.value) in (int, float, complex): - return node.value - raise ValueError('malformed node or string: ' + repr(node)) + if not isinstance(node, Constant) or type(node.value) not in (int, float, complex): + _raise_malformed_node(node) + return node.value def _convert_signed_num(node): if isinstance(node, UnaryOp) and isinstance(node.op, (UAdd, USub)): operand = _convert_num(node.operand) @@ -82,6 +83,8 @@ def _convert(node): elif isinstance(node, Set): return set(map(_convert, node.elts)) elif isinstance(node, Dict): + if len(node.keys) != len(node.values): + _raise_malformed_node(node) return dict(zip(map(_convert, node.keys), map(_convert, node.values))) elif isinstance(node, BinOp) and isinstance(node.op, (Add, Sub)): diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 3e8a39dc41047..8887558ce4c31 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -869,6 +869,12 @@ def test_literal_eval_complex(self): self.assertRaises(ValueError, ast.literal_eval, '3+(0+6j)') self.assertRaises(ValueError, ast.literal_eval, '-(3+6j)') + def test_literal_eval_malformed_dict_nodes(self): + malformed = ast.Dict(keys=[ast.Constant(1), ast.Constant(2)], values=[ast.Constant(3)]) + self.assertRaises(ValueError, ast.literal_eval, malformed) + malformed = ast.Dict(keys=[ast.Constant(1)], values=[ast.Constant(2), ast.Constant(3)]) + self.assertRaises(ValueError, ast.literal_eval, malformed) + def test_bad_integer(self): # issue13436: Bad error message with invalid numeric values body = [ast.ImportFrom(module='time', diff --git a/Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst b/Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst new file mode 100644 index 0000000000000..81f9e937a2bff --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-02-14-24-48.bpo-40355.xTujaB.rst @@ -0,0 +1,2 @@ +Improve error reporting in :func:`ast.literal_eval` in the presence of malformed :class:`ast.Dict` +nodes instead of silently ignoring any non-conforming elements. Patch by Curtis Bucher. From webhook-mailer at python.org Tue May 5 17:14:40 2020 From: webhook-mailer at python.org (Dennis Sweeney) Date: Tue, 05 May 2020 21:14:40 -0000 Subject: [Python-checkins] bpo-40504: Allow weakrefs to lru_cache objects (GH-19938) Message-ID: https://github.com/python/cpython/commit/1253c3ef70ea5632d32ae19579a14152db0d45c1 commit: 1253c3ef70ea5632d32ae19579a14152db0d45c1 branch: master author: Dennis Sweeney <36520290+sweeneyde at users.noreply.github.com> committer: GitHub date: 2020-05-05T14:14:32-07:00 summary: bpo-40504: Allow weakrefs to lru_cache objects (GH-19938) files: A Misc/NEWS.d/next/Library/2020-05-05-17-12-47.bpo-40504.EX6wPn.rst M Lib/test/test_functools.py M Modules/_functoolsmodule.c diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 9503f4086b1cb..b3893a15566fa 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -14,6 +14,8 @@ import unittest import unittest.mock import os +import weakref +import gc from weakref import proxy import contextlib @@ -1938,6 +1940,35 @@ def f(): return 1 self.assertEqual(f.cache_parameters(), {'maxsize': 1000, "typed": True}) + def test_lru_cache_weakrefable(self): + @self.module.lru_cache + def test_function(x): + return x + + class A: + @self.module.lru_cache + def test_method(self, x): + return (self, x) + + @staticmethod + @self.module.lru_cache + def test_staticmethod(x): + return (self, x) + + refs = [weakref.ref(test_function), + weakref.ref(A.test_method), + weakref.ref(A.test_staticmethod)] + + for ref in refs: + self.assertIsNotNone(ref()) + + del A + del test_function + gc.collect() + + for ref in refs: + self.assertIsNone(ref()) + @py_functools.lru_cache() def py_cached_func(x, y): diff --git a/Misc/NEWS.d/next/Library/2020-05-05-17-12-47.bpo-40504.EX6wPn.rst b/Misc/NEWS.d/next/Library/2020-05-05-17-12-47.bpo-40504.EX6wPn.rst new file mode 100644 index 0000000000000..261a49e432928 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-05-17-12-47.bpo-40504.EX6wPn.rst @@ -0,0 +1 @@ +:func:`functools.lru_cache` objects can now be the targets of weakrefs. \ No newline at end of file diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index fd4b4c268cc97..d158d3bae157b 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -783,6 +783,7 @@ typedef struct lru_cache_object { Py_ssize_t misses; PyObject *cache_info_type; PyObject *dict; + PyObject *weakreflist; } lru_cache_object; static PyTypeObject lru_cache_type; @@ -1196,6 +1197,7 @@ lru_cache_new(PyTypeObject *type, PyObject *args, PyObject *kw) Py_INCREF(cache_info_type); obj->cache_info_type = cache_info_type; obj->dict = NULL; + obj->weakreflist = NULL; return (PyObject *)obj; } @@ -1227,6 +1229,8 @@ lru_cache_dealloc(lru_cache_object *obj) lru_list_elem *list; /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(obj); + if (obj->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject*)obj); list = lru_cache_unlink_list(obj); Py_XDECREF(obj->cache); @@ -1384,7 +1388,8 @@ static PyTypeObject lru_cache_type = { (traverseproc)lru_cache_tp_traverse,/* tp_traverse */ (inquiry)lru_cache_tp_clear, /* tp_clear */ 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(lru_cache_object, weakreflist), + /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ lru_cache_methods, /* tp_methods */ From webhook-mailer at python.org Tue May 5 17:58:29 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Tue, 05 May 2020 21:58:29 -0000 Subject: [Python-checkins] bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects (GH-19946) Message-ID: https://github.com/python/cpython/commit/96074de573f82fc66a2bd73c36905141a3f1d5c1 commit: 96074de573f82fc66a2bd73c36905141a3f1d5c1 branch: master author: Pablo Galindo committer: GitHub date: 2020-05-05T22:58:19+01:00 summary: bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects (GH-19946) files: A Misc/NEWS.d/next/Core and Builtins/2020-05-05-20-36-15.bpo-40523.hKZVTB.rst M Lib/test/test_weakref.py M Objects/weakrefobject.c diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 563507fee3d7e..56a42f055d0b5 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -411,6 +411,26 @@ def __iter__(self): # can be killed in the middle of the call "blech" in p + def test_proxy_reversed(self): + class MyObj: + def __len__(self): + return 3 + def __reversed__(self): + return iter('cba') + + obj = MyObj() + self.assertEqual("".join(reversed(weakref.proxy(obj))), "cba") + + def test_proxy_hash(self): + cool_hash = 299_792_458 + + class MyObj: + def __hash__(self): + return cool_hash + + obj = MyObj() + self.assertEqual(hash(weakref.proxy(obj)), cool_hash) + def test_getweakrefcount(self): o = C() ref1 = weakref.ref(o) diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-05-20-36-15.bpo-40523.hKZVTB.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-05-20-36-15.bpo-40523.hKZVTB.rst new file mode 100644 index 0000000000000..14f05be59a1ed --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-05-20-36-15.bpo-40523.hKZVTB.rst @@ -0,0 +1,2 @@ +Add pass-throughs for :func:`hash` and :func:`reversed` to +:class:`weakref.proxy` objects. Patch by Pablo Galindo. diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index 9640d93aaf2da..313e8abab5a25 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -665,10 +665,12 @@ proxy_iternext(PyWeakReference *proxy) WRAP_METHOD(proxy_bytes, __bytes__) +WRAP_METHOD(proxy_reversed, __reversed__) static PyMethodDef proxy_methods[] = { {"__bytes__", proxy_bytes, METH_NOARGS}, + {"__reversed__", proxy_reversed, METH_NOARGS}, {NULL, NULL} }; @@ -730,6 +732,21 @@ static PyMappingMethods proxy_as_mapping = { }; +static Py_hash_t +proxy_hash(PyObject *self) +{ + PyWeakReference *proxy = (PyWeakReference *)self; + if (!proxy_checkref(proxy)) { + return -1; + } + PyObject *obj = PyWeakref_GET_OBJECT(proxy); + Py_INCREF(obj); + Py_hash_t res = PyObject_Hash(obj); + Py_DECREF(obj); + return res; +} + + PyTypeObject _PyWeakref_ProxyType = { PyVarObject_HEAD_INIT(&PyType_Type, 0) @@ -746,7 +763,7 @@ _PyWeakref_ProxyType = { &proxy_as_number, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ &proxy_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ + proxy_hash, /* tp_hash */ 0, /* tp_call */ proxy_str, /* tp_str */ proxy_getattr, /* tp_getattro */ From webhook-mailer at python.org Tue May 5 20:32:22 2020 From: webhook-mailer at python.org (Robert Rouhani) Date: Wed, 06 May 2020 00:32:22 -0000 Subject: [Python-checkins] [3.8] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19934) Message-ID: https://github.com/python/cpython/commit/a32587a60da5939a3932bb30432d2bdd3d6203d4 commit: a32587a60da5939a3932bb30432d2bdd3d6203d4 branch: 3.8 author: Robert Rouhani committer: GitHub date: 2020-05-05T17:32:14-07:00 summary: [3.8] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19934) Automerge-Triggered-By: @brettcannon. (cherry picked from commit f40bd466bf14029e2687e36e965875adf9d4be1a) Co-authored-by: Robert Rouhani files: A Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst M Python/import.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst new file mode 100644 index 0000000000000..932e853a8933d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst @@ -0,0 +1 @@ +Fix imp module deprecation warning when PyImport_ReloadModule is called. Patch by Robert Rouhani. diff --git a/Python/import.c b/Python/import.c index b4074d1dfc3fa..b73fe2f93e26c 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1908,23 +1908,23 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals PyObject * PyImport_ReloadModule(PyObject *m) { - _Py_IDENTIFIER(imp); + _Py_IDENTIFIER(importlib); _Py_IDENTIFIER(reload); PyObject *reloaded_module = NULL; - PyObject *imp = _PyImport_GetModuleId(&PyId_imp); - if (imp == NULL) { + PyObject *importlib = _PyImport_GetModuleId(&PyId_importlib); + if (importlib == NULL) { if (PyErr_Occurred()) { return NULL; } - imp = PyImport_ImportModule("imp"); - if (imp == NULL) { + importlib = PyImport_ImportModule("importlib"); + if (importlib == NULL) { return NULL; } } - reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL); - Py_DECREF(imp); + reloaded_module = _PyObject_CallMethodIdObjArgs(importlib, &PyId_reload, m, NULL); + Py_DECREF(importlib); return reloaded_module; } From webhook-mailer at python.org Tue May 5 20:49:37 2020 From: webhook-mailer at python.org (Robert Rouhani) Date: Wed, 06 May 2020 00:49:37 -0000 Subject: [Python-checkins] [3.7] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19935) Message-ID: https://github.com/python/cpython/commit/d64fd617e02346ecbcba9559f227936e08e89602 commit: d64fd617e02346ecbcba9559f227936e08e89602 branch: 3.7 author: Robert Rouhani committer: GitHub date: 2020-05-05T17:49:29-07:00 summary: [3.7] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19935) Use importlib instead of imp. Automerge-Triggered-By: @brettcannon. (cherry picked from commit f40bd46) Co-authored-by: Robert Rouhani robert.rouhani at gmail.com files: A Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst M Python/import.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst new file mode 100644 index 0000000000000..932e853a8933d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-01-19-04-52.bpo-40417.Sti2lJ.rst @@ -0,0 +1 @@ +Fix imp module deprecation warning when PyImport_ReloadModule is called. Patch by Robert Rouhani. diff --git a/Python/import.c b/Python/import.c index edc59249622b1..6d014cf5b008f 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1858,23 +1858,23 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals PyObject * PyImport_ReloadModule(PyObject *m) { - _Py_IDENTIFIER(imp); + _Py_IDENTIFIER(importlib); _Py_IDENTIFIER(reload); PyObject *reloaded_module = NULL; - PyObject *imp = _PyImport_GetModuleId(&PyId_imp); - if (imp == NULL) { + PyObject *importlib = _PyImport_GetModuleId(&PyId_importlib); + if (importlib == NULL) { if (PyErr_Occurred()) { return NULL; } - imp = PyImport_ImportModule("imp"); - if (imp == NULL) { + importlib = PyImport_ImportModule("importlib"); + if (importlib == NULL) { return NULL; } } - reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL); - Py_DECREF(imp); + reloaded_module = _PyObject_CallMethodIdObjArgs(importlib, &PyId_reload, m, NULL); + Py_DECREF(importlib); return reloaded_module; } From webhook-mailer at python.org Tue May 5 22:28:32 2020 From: webhook-mailer at python.org (Tim Peters) Date: Wed, 06 May 2020 02:28:32 -0000 Subject: [Python-checkins] bpo-40480 "fnmatch" exponential execution time (GH-19908) Message-ID: https://github.com/python/cpython/commit/b9c46a2c2d7fc68457bff641f78932d66f5e5f59 commit: b9c46a2c2d7fc68457bff641f78932d66f5e5f59 branch: master author: Tim Peters committer: GitHub date: 2020-05-05T21:28:24-05:00 summary: bpo-40480 "fnmatch" exponential execution time (GH-19908) bpo-40480: create different regexps in the presence of multiple `*` patterns to prevent fnmatch() from taking exponential time. files: A Misc/NEWS.d/next/Library/2020-05-04-21-21-43.bpo-40480.mjldWa.rst M Lib/fnmatch.py M Lib/test/test_fnmatch.py diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py index b98e6413295e1..d7d915d51314d 100644 --- a/Lib/fnmatch.py +++ b/Lib/fnmatch.py @@ -77,15 +77,19 @@ def translate(pat): There is no way to quote meta-characters. """ + STAR = object() + res = [] + add = res.append i, n = 0, len(pat) - res = '' while i < n: c = pat[i] i = i+1 if c == '*': - res = res + '.*' + # compress consecutive `*` into one + if (not res) or res[-1] is not STAR: + add(STAR) elif c == '?': - res = res + '.' + add('.') elif c == '[': j = i if j < n and pat[j] == '!': @@ -95,7 +99,7 @@ def translate(pat): while j < n and pat[j] != ']': j = j+1 if j >= n: - res = res + '\\[' + add('\\[') else: stuff = pat[i:j] if '--' not in stuff: @@ -122,7 +126,49 @@ def translate(pat): stuff = '^' + stuff[1:] elif stuff[0] in ('^', '['): stuff = '\\' + stuff - res = '%s[%s]' % (res, stuff) + add(f'[{stuff}]') else: - res = res + re.escape(c) - return r'(?s:%s)\Z' % res + add(re.escape(c)) + assert i == n + + # Deal with STARs. + inp = res + res = [] + add = res.append + i, n = 0, len(inp) + # Fixed pieces at the start? + while i < n and inp[i] is not STAR: + add(inp[i]) + i += 1 + # Now deal with STAR fixed STAR fixed ... + # For an interior `STAR fixed` pairing, we want to do a minimal + # .*? match followed by `fixed`, with no possibility of backtracking. + # We can't spell that directly, but can trick it into working by matching + # .*?fixed + # in a lookahead assertion, save the matched part in a group, then + # consume that group via a backreference. If the overall match fails, + # the lookahead assertion won't try alternatives. So the translation is: + # (?=(P.*?fixed))(?P=name) + # Group names are created as needed: g1, g2, g3, ... + groupnum = 0 + while i < n: + assert inp[i] is STAR + i += 1 + if i == n: + add(".*") + break + assert inp[i] is not STAR + fixed = [] + while i < n and inp[i] is not STAR: + fixed.append(inp[i]) + i += 1 + fixed = "".join(fixed) + if i == n: + add(".*") + add(fixed) + else: + groupnum += 1 + add(f"(?=(?P.*?{fixed}))(?P=g{groupnum})") + assert i == n + res = "".join(res) + return fr'(?s:{res})\Z' diff --git a/Lib/test/test_fnmatch.py b/Lib/test/test_fnmatch.py index 55f9f0d3a5425..4c173069503cc 100644 --- a/Lib/test/test_fnmatch.py +++ b/Lib/test/test_fnmatch.py @@ -45,6 +45,13 @@ def test_fnmatch(self): check('\nfoo', 'foo*', False) check('\n', '*') + def test_slow_fnmatch(self): + check = self.check_match + check('a' * 50, '*a*a*a*a*a*a*a*a*a*a') + # The next "takes forever" if the regexp translation is + # straightforward. See bpo-40480. + check('a' * 50 + 'b', '*a*a*a*a*a*a*a*a*a*a', False) + def test_mix_bytes_str(self): self.assertRaises(TypeError, fnmatch, 'test', b'*') self.assertRaises(TypeError, fnmatch, b'test', '*') @@ -107,6 +114,16 @@ def test_translate(self): self.assertEqual(translate('[!x]'), r'(?s:[^x])\Z') self.assertEqual(translate('[^x]'), r'(?s:[\^x])\Z') self.assertEqual(translate('[x'), r'(?s:\[x)\Z') + # from the docs + self.assertEqual(translate('*.txt'), r'(?s:.*\.txt)\Z') + # squash consecutive stars + self.assertEqual(translate('*********'), r'(?s:.*)\Z') + self.assertEqual(translate('A*********'), r'(?s:A.*)\Z') + self.assertEqual(translate('*********A'), r'(?s:.*A)\Z') + self.assertEqual(translate('A*********?[?]?'), r'(?s:A.*.[?].)\Z') + # fancy translation to prevent exponential-time match failure + self.assertEqual(translate('**a*a****a'), + r'(?s:(?=(?P.*?a))(?P=g1)(?=(?P.*?a))(?P=g2).*a)\Z') class FilterTestCase(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Library/2020-05-04-21-21-43.bpo-40480.mjldWa.rst b/Misc/NEWS.d/next/Library/2020-05-04-21-21-43.bpo-40480.mjldWa.rst new file mode 100644 index 0000000000000..d046b1422419d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-04-21-21-43.bpo-40480.mjldWa.rst @@ -0,0 +1 @@ +``fnmatch.fnmatch()`` could take exponential time in the presence of multiple ``*`` pattern characters. This was repaired by generating more elaborate regular expressions to avoid futile backtracking. \ No newline at end of file From webhook-mailer at python.org Wed May 6 01:24:49 2020 From: webhook-mailer at python.org (Batuhan Taskaya) Date: Wed, 06 May 2020 05:24:49 -0000 Subject: [Python-checkins] bpo-40517: Implement syntax highlighting support for ASDL (#19928) Message-ID: https://github.com/python/cpython/commit/d60040ba226bd2e3b6f58d074015aa2499dc1cb8 commit: d60040ba226bd2e3b6f58d074015aa2499dc1cb8 branch: master author: Batuhan Taskaya committer: GitHub date: 2020-05-05T22:24:39-07:00 summary: bpo-40517: Implement syntax highlighting support for ASDL (#19928) files: A Doc/tools/extensions/asdl_highlight.py M Doc/conf.py M Doc/library/ast.rst diff --git a/Doc/conf.py b/Doc/conf.py index 32db34344a70a..12d74ea24ce4a 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -14,7 +14,8 @@ # --------------------- extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', - 'pyspecific', 'c_annotations', 'escape4chm'] + 'pyspecific', 'c_annotations', 'escape4chm', + 'asdl_highlight'] doctest_global_setup = ''' diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index fc04114949c0c..6c6ad01b842c8 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -35,7 +35,7 @@ Abstract Grammar The abstract grammar is currently defined as follows: .. literalinclude:: ../../Parser/Python.asdl - :language: none + :language: asdl Node classes diff --git a/Doc/tools/extensions/asdl_highlight.py b/Doc/tools/extensions/asdl_highlight.py new file mode 100644 index 0000000000000..9b003e9905c56 --- /dev/null +++ b/Doc/tools/extensions/asdl_highlight.py @@ -0,0 +1,51 @@ +import os +import sys +sys.path.append(os.path.abspath("../Parser/")) + +from pygments.lexer import RegexLexer, bygroups, include, words +from pygments.token import (Comment, Generic, Keyword, Name, Operator, + Punctuation, Text) + +from asdl import builtin_types +from sphinx.highlighting import lexers + +class ASDLLexer(RegexLexer): + name = "ASDL" + aliases = ["asdl"] + filenames = ["*.asdl"] + _name = r"([^\W\d]\w*)" + _text_ws = r"(\s*)" + + tokens = { + "ws": [ + (r"\n", Text), + (r"\s+", Text), + (r"--.*?$", Comment.Singleline), + ], + "root": [ + include("ws"), + ( + r"(module)" + _text_ws + _name, + bygroups(Keyword, Text, Name.Class), + ), + ( + r"(\w+)(\*\s|\?\s|\s)(\w+)", + bygroups(Name.Variable, Generic.Strong, Name.Tag), + ), + (words(builtin_types), Keyword.Type), + (r"attributes", Name.Builtin), + ( + _name + _text_ws + "(=)", + bygroups(Name.Variable, Text, Operator), + ), + (_name, Name.Function), + (r"\|", Operator), + (r"{|}|\(|\)", Punctuation), + (r".", Text), + ], + } + + +def setup(app): + lexers["asdl"] = ASDLLexer() + return {'version': '1.0', 'parallel_read_safe': True} From webhook-mailer at python.org Wed May 6 01:34:03 2020 From: webhook-mailer at python.org (Raymond Hettinger) Date: Wed, 06 May 2020 05:34:03 -0000 Subject: [Python-checkins] Revert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" (#19950) Message-ID: https://github.com/python/cpython/commit/eff870b618ca6f6b7a60a271f15af7e54b8a1b97 commit: eff870b618ca6f6b7a60a271f15af7e54b8a1b97 branch: master author: Raymond Hettinger committer: GitHub date: 2020-05-05T22:33:55-07:00 summary: Revert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" (#19950) This reverts commit d60040ba226bd2e3b6f58d074015aa2499dc1cb8. files: D Doc/tools/extensions/asdl_highlight.py M Doc/conf.py M Doc/library/ast.rst diff --git a/Doc/conf.py b/Doc/conf.py index 12d74ea24ce4a..32db34344a70a 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -14,8 +14,7 @@ # --------------------- extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', - 'pyspecific', 'c_annotations', 'escape4chm', - 'asdl_highlight'] + 'pyspecific', 'c_annotations', 'escape4chm'] doctest_global_setup = ''' diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 6c6ad01b842c8..fc04114949c0c 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -35,7 +35,7 @@ Abstract Grammar The abstract grammar is currently defined as follows: .. literalinclude:: ../../Parser/Python.asdl - :language: asdl + :language: none Node classes diff --git a/Doc/tools/extensions/asdl_highlight.py b/Doc/tools/extensions/asdl_highlight.py deleted file mode 100644 index 9b003e9905c56..0000000000000 --- a/Doc/tools/extensions/asdl_highlight.py +++ /dev/null @@ -1,51 +0,0 @@ -import os -import sys -sys.path.append(os.path.abspath("../Parser/")) - -from pygments.lexer import RegexLexer, bygroups, include, words -from pygments.token import (Comment, Generic, Keyword, Name, Operator, - Punctuation, Text) - -from asdl import builtin_types -from sphinx.highlighting import lexers - -class ASDLLexer(RegexLexer): - name = "ASDL" - aliases = ["asdl"] - filenames = ["*.asdl"] - _name = r"([^\W\d]\w*)" - _text_ws = r"(\s*)" - - tokens = { - "ws": [ - (r"\n", Text), - (r"\s+", Text), - (r"--.*?$", Comment.Singleline), - ], - "root": [ - include("ws"), - ( - r"(module)" + _text_ws + _name, - bygroups(Keyword, Text, Name.Class), - ), - ( - r"(\w+)(\*\s|\?\s|\s)(\w+)", - bygroups(Name.Variable, Generic.Strong, Name.Tag), - ), - (words(builtin_types), Keyword.Type), - (r"attributes", Name.Builtin), - ( - _name + _text_ws + "(=)", - bygroups(Name.Variable, Text, Operator), - ), - (_name, Name.Function), - (r"\|", Operator), - (r"{|}|\(|\)", Punctuation), - (r".", Text), - ], - } - - -def setup(app): - lexers["asdl"] = ASDLLexer() - return {'version': '1.0', 'parallel_read_safe': True} From webhook-mailer at python.org Wed May 6 09:22:22 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 06 May 2020 13:22:22 -0000 Subject: [Python-checkins] bpo-40527: Fix command line argument parsing (GH-19955) Message-ID: https://github.com/python/cpython/commit/2668a9a5aa506a048aef7b4881c8dcf6b81c6870 commit: 2668a9a5aa506a048aef7b4881c8dcf6b81c6870 branch: master author: Victor Stinner committer: GitHub date: 2020-05-06T22:22:17+09:00 summary: bpo-40527: Fix command line argument parsing (GH-19955) files: A Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst M Lib/test/test_cmd_line.py M Python/getopt.c diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index ee96473322dba..724402533038d 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -756,6 +756,17 @@ def test_argv0_normalization(self): self.assertEqual(proc.returncode, 0, proc) self.assertEqual(proc.stdout.strip(), b'0') + def test_parsing_error(self): + args = [sys.executable, '-I', '--unknown-option'] + proc = subprocess.run(args, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True) + err_msg = "unknown option --unknown-option\nusage: " + self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr) + self.assertNotEqual(proc.returncode, 0) + + @unittest.skipIf(interpreter_requires_environment(), 'Cannot run -I tests when PYTHON env vars are required.') class IgnoreEnvironmentTest(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst new file mode 100644 index 0000000000000..19b8888230c65 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst @@ -0,0 +1,2 @@ +Fix command line argument parsing: no longer write errors multiple times +into stderr. diff --git a/Python/getopt.c b/Python/getopt.c index 708d9ce496287..2e3891aae2d16 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -101,7 +101,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) if (option == L'-') { // Parse long option. if (*opt_ptr == L'\0') { - fprintf(stderr, "expected long option\n"); + if (_PyOS_opterr) { + fprintf(stderr, "expected long option\n"); + } return -1; } *longindex = 0; @@ -111,7 +113,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) break; } if (!opt->name) { - fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]); + if (_PyOS_opterr) { + fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]); + } return '_'; } opt_ptr = L""; @@ -119,8 +123,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) return opt->val; } if (_PyOS_optind >= argc) { - fprintf(stderr, "Argument expected for the %ls options\n", - argv[_PyOS_optind - 1]); + if (_PyOS_opterr) { + fprintf(stderr, "Argument expected for the %ls options\n", + argv[_PyOS_optind - 1]); + } return '_'; } _PyOS_optarg = argv[_PyOS_optind++]; @@ -128,14 +134,16 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) } if (option == 'J') { - if (_PyOS_opterr) + if (_PyOS_opterr) { fprintf(stderr, "-J is reserved for Jython\n"); + } return '_'; } if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) { - if (_PyOS_opterr) + if (_PyOS_opterr) { fprintf(stderr, "Unknown option: -%c\n", (char)option); + } return '_'; } @@ -147,9 +155,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) else { if (_PyOS_optind >= argc) { - if (_PyOS_opterr) + if (_PyOS_opterr) { fprintf(stderr, "Argument expected for the -%c option\n", (char)option); + } return '_'; } From webhook-mailer at python.org Wed May 6 09:43:14 2020 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 06 May 2020 13:43:14 -0000 Subject: [Python-checkins] bpo-40527: Fix command line argument parsing (GH-19955) Message-ID: https://github.com/python/cpython/commit/bce4ddafdd188cc6deb1584728b67b9e149ca6a4 commit: bce4ddafdd188cc6deb1584728b67b9e149ca6a4 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2020-05-06T06:43:09-07:00 summary: bpo-40527: Fix command line argument parsing (GH-19955) (cherry picked from commit 2668a9a5aa506a048aef7b4881c8dcf6b81c6870) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst M Lib/test/test_cmd_line.py M Python/getopt.c diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 497bfa9eb89de..5fc5bff6603e2 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -740,6 +740,17 @@ def test_argv0_normalization(self): self.assertEqual(proc.returncode, 0, proc) self.assertEqual(proc.stdout.strip(), b'0') + def test_parsing_error(self): + args = [sys.executable, '-I', '--unknown-option'] + proc = subprocess.run(args, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True) + err_msg = "unknown option --unknown-option\nusage: " + self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr) + self.assertNotEqual(proc.returncode, 0) + + @unittest.skipIf(interpreter_requires_environment(), 'Cannot run -I tests when PYTHON env vars are required.') class IgnoreEnvironmentTest(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst new file mode 100644 index 0000000000000..19b8888230c65 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-06-14-52-35.bpo-40527.gTNKuy.rst @@ -0,0 +1,2 @@ +Fix command line argument parsing: no longer write errors multiple times +into stderr. diff --git a/Python/getopt.c b/Python/getopt.c index 1a7db3fce888e..249ad1e873607 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -105,7 +105,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) if (option == L'-') { // Parse long option. if (*opt_ptr == L'\0') { - fprintf(stderr, "expected long option\n"); + if (_PyOS_opterr) { + fprintf(stderr, "expected long option\n"); + } return -1; } *longindex = 0; @@ -115,7 +117,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) break; } if (!opt->name) { - fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]); + if (_PyOS_opterr) { + fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]); + } return '_'; } opt_ptr = L""; @@ -123,8 +127,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) return opt->val; } if (_PyOS_optind >= argc) { - fprintf(stderr, "Argument expected for the %ls options\n", - argv[_PyOS_optind - 1]); + if (_PyOS_opterr) { + fprintf(stderr, "Argument expected for the %ls options\n", + argv[_PyOS_optind - 1]); + } return '_'; } _PyOS_optarg = argv[_PyOS_optind++]; @@ -132,14 +138,16 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) } if (option == 'J') { - if (_PyOS_opterr) + if (_PyOS_opterr) { fprintf(stderr, "-J is reserved for Jython\n"); + } return '_'; } if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) { - if (_PyOS_opterr) + if (_PyOS_opterr) { fprintf(stderr, "Unknown option: -%c\n", (char)option); + } return '_'; } @@ -151,9 +159,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) else { if (_PyOS_optind >= argc) { - if (_PyOS_opterr) + if (_PyOS_opterr) { fprintf(stderr, "Argument expected for the -%c option\n", (char)option); + } return '_'; } From webhook-mailer at python.org Wed May 6 10:29:41 2020 From: webhook-mailer at python.org (Batuhan Taskaya) Date: Wed, 06 May 2020 14:29:41 -0000 Subject: [Python-checkins] bpo-40528: Improve and clear several aspects of the ASDL definition code for the AST (GH-19952) Message-ID: https://github.com/python/cpython/commit/091951a67c832db83c60f4eb22f1fb474b70e635 commit: 091951a67c832db83c60f4eb22f1fb474b70e635 branch: master author: Batuhan Taskaya committer: GitHub date: 2020-05-06T15:29:32+01:00 summary: bpo-40528: Improve and clear several aspects of the ASDL definition code for the AST (GH-19952) files: M Include/asdl.h M Lib/test/test_ast.py M Parser/Python.asdl M Parser/asdl.py M Parser/asdl_c.py M Python/Python-ast.c diff --git a/Include/asdl.h b/Include/asdl.h index 549df2ace7555..e962560bcd4cb 100644 --- a/Include/asdl.h +++ b/Include/asdl.h @@ -4,9 +4,7 @@ typedef PyObject * identifier; typedef PyObject * string; -typedef PyObject * bytes; typedef PyObject * object; -typedef PyObject * singleton; typedef PyObject * constant; /* It would be nice if the code generated by asdl_c.py was completely diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index a8a13fdcd7426..6b71adac4e4a6 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -597,7 +597,7 @@ def test_empty_yield_from(self): empty_yield_from.body[0].body[0].value.value = None with self.assertRaises(ValueError) as cm: compile(empty_yield_from, "", "exec") - self.assertIn("field value is required", str(cm.exception)) + self.assertIn("field 'value' is required", str(cm.exception)) @support.cpython_only def test_issue31592(self): diff --git a/Parser/Python.asdl b/Parser/Python.asdl index f789f1da456e9..889712b4b3d36 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -1,5 +1,5 @@ --- ASDL's 5 builtin types are: --- identifier, int, string, object, constant +-- ASDL's 4 builtin types are: +-- identifier, int, string, constant module Python { diff --git a/Parser/asdl.py b/Parser/asdl.py index 5416377100c64..7f509488b96ed 100644 --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -33,8 +33,7 @@ # See the EBNF at the top of the file to understand the logical connection # between the various node types. -builtin_types = {'identifier', 'string', 'bytes', 'int', 'object', 'singleton', - 'constant'} +builtin_types = {'identifier', 'string', 'int', 'constant'} class AST: def __repr__(self): diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index c98f949042f30..59bf03ef8df3d 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -323,7 +323,7 @@ def emit(s, depth=0, reflow=True): if not opt and argtype != "int": emit("if (!%s) {" % argname, 1) emit("PyErr_SetString(PyExc_ValueError,", 2) - msg = "field %s is required for %s" % (argname, name) + msg = "field '%s' is required for %s" % (argname, name) emit(' "%s");' % msg, 2, reflow=False) emit('return NULL;', 2) @@ -853,11 +853,9 @@ def visitModule(self, mod): Py_INCREF((PyObject*)o); return (PyObject*)o; } -#define ast2obj_singleton ast2obj_object #define ast2obj_constant ast2obj_object #define ast2obj_identifier ast2obj_object #define ast2obj_string ast2obj_object -#define ast2obj_bytes ast2obj_object static PyObject* ast2obj_int(long b) { @@ -1147,12 +1145,8 @@ def simpleSum(self, sum, name): self.emit("case %s:" % t.name, 2) self.emit("Py_INCREF(astmodulestate_global->%s_singleton);" % t.name, 3) self.emit("return astmodulestate_global->%s_singleton;" % t.name, 3) - self.emit("default:", 2) - self.emit('/* should never happen, but just in case ... */', 3) - code = "PyErr_Format(PyExc_SystemError, \"unknown %s found\");" % name - self.emit(code, 3, reflow=False) - self.emit("return NULL;", 3) self.emit("}", 1) + self.emit("Py_UNREACHABLE();", 1); self.emit("}", 0) def visitProduct(self, prod, name): diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 80f91646fd62e..f34b1450c66ef 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -1294,11 +1294,9 @@ static PyObject* ast2obj_object(void *o) Py_INCREF((PyObject*)o); return (PyObject*)o; } -#define ast2obj_singleton ast2obj_object #define ast2obj_constant ast2obj_object #define ast2obj_identifier ast2obj_object #define ast2obj_string ast2obj_object -#define ast2obj_bytes ast2obj_object static PyObject* ast2obj_int(long b) { @@ -2077,7 +2075,7 @@ Expression(expr_ty body, PyArena *arena) mod_ty p; if (!body) { PyErr_SetString(PyExc_ValueError, - "field body is required for Expression"); + "field 'body' is required for Expression"); return NULL; } p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2094,7 +2092,7 @@ FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena) mod_ty p; if (!returns) { PyErr_SetString(PyExc_ValueError, - "field returns is required for FunctionType"); + "field 'returns' is required for FunctionType"); return NULL; } p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2114,12 +2112,12 @@ FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * stmt_ty p; if (!name) { PyErr_SetString(PyExc_ValueError, - "field name is required for FunctionDef"); + "field 'name' is required for FunctionDef"); return NULL; } if (!args) { PyErr_SetString(PyExc_ValueError, - "field args is required for FunctionDef"); + "field 'args' is required for FunctionDef"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2148,12 +2146,12 @@ AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq stmt_ty p; if (!name) { PyErr_SetString(PyExc_ValueError, - "field name is required for AsyncFunctionDef"); + "field 'name' is required for AsyncFunctionDef"); return NULL; } if (!args) { PyErr_SetString(PyExc_ValueError, - "field args is required for AsyncFunctionDef"); + "field 'args' is required for AsyncFunctionDef"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2181,7 +2179,7 @@ ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, asdl_seq * stmt_ty p; if (!name) { PyErr_SetString(PyExc_ValueError, - "field name is required for ClassDef"); + "field 'name' is required for ClassDef"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2241,7 +2239,7 @@ Assign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int stmt_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Assign"); + "field 'value' is required for Assign"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2265,17 +2263,17 @@ AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int stmt_ty p; if (!target) { PyErr_SetString(PyExc_ValueError, - "field target is required for AugAssign"); + "field 'target' is required for AugAssign"); return NULL; } if (!op) { PyErr_SetString(PyExc_ValueError, - "field op is required for AugAssign"); + "field 'op' is required for AugAssign"); return NULL; } if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for AugAssign"); + "field 'value' is required for AugAssign"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2300,12 +2298,12 @@ AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int stmt_ty p; if (!target) { PyErr_SetString(PyExc_ValueError, - "field target is required for AnnAssign"); + "field 'target' is required for AnnAssign"); return NULL; } if (!annotation) { PyErr_SetString(PyExc_ValueError, - "field annotation is required for AnnAssign"); + "field 'annotation' is required for AnnAssign"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2331,12 +2329,12 @@ For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string stmt_ty p; if (!target) { PyErr_SetString(PyExc_ValueError, - "field target is required for For"); + "field 'target' is required for For"); return NULL; } if (!iter) { PyErr_SetString(PyExc_ValueError, - "field iter is required for For"); + "field 'iter' is required for For"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2363,12 +2361,12 @@ AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, stmt_ty p; if (!target) { PyErr_SetString(PyExc_ValueError, - "field target is required for AsyncFor"); + "field 'target' is required for AsyncFor"); return NULL; } if (!iter) { PyErr_SetString(PyExc_ValueError, - "field iter is required for AsyncFor"); + "field 'iter' is required for AsyncFor"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2394,7 +2392,7 @@ While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int stmt_ty p; if (!test) { PyErr_SetString(PyExc_ValueError, - "field test is required for While"); + "field 'test' is required for While"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2418,7 +2416,7 @@ If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int stmt_ty p; if (!test) { PyErr_SetString(PyExc_ValueError, - "field test is required for If"); + "field 'test' is required for If"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2519,7 +2517,7 @@ Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno, stmt_ty p; if (!test) { PyErr_SetString(PyExc_ValueError, - "field test is required for Assert"); + "field 'test' is required for Assert"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2612,7 +2610,7 @@ Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int stmt_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Expr"); + "field 'value' is required for Expr"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2682,7 +2680,7 @@ BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, int expr_ty p; if (!op) { PyErr_SetString(PyExc_ValueError, - "field op is required for BoolOp"); + "field 'op' is required for BoolOp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2705,12 +2703,12 @@ NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int expr_ty p; if (!target) { PyErr_SetString(PyExc_ValueError, - "field target is required for NamedExpr"); + "field 'target' is required for NamedExpr"); return NULL; } if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for NamedExpr"); + "field 'value' is required for NamedExpr"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2733,17 +2731,17 @@ BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, expr_ty p; if (!left) { PyErr_SetString(PyExc_ValueError, - "field left is required for BinOp"); + "field 'left' is required for BinOp"); return NULL; } if (!op) { PyErr_SetString(PyExc_ValueError, - "field op is required for BinOp"); + "field 'op' is required for BinOp"); return NULL; } if (!right) { PyErr_SetString(PyExc_ValueError, - "field right is required for BinOp"); + "field 'right' is required for BinOp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2767,12 +2765,12 @@ UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int expr_ty p; if (!op) { PyErr_SetString(PyExc_ValueError, - "field op is required for UnaryOp"); + "field 'op' is required for UnaryOp"); return NULL; } if (!operand) { PyErr_SetString(PyExc_ValueError, - "field operand is required for UnaryOp"); + "field 'operand' is required for UnaryOp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2795,12 +2793,12 @@ Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int expr_ty p; if (!args) { PyErr_SetString(PyExc_ValueError, - "field args is required for Lambda"); + "field 'args' is required for Lambda"); return NULL; } if (!body) { PyErr_SetString(PyExc_ValueError, - "field body is required for Lambda"); + "field 'body' is required for Lambda"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2823,17 +2821,17 @@ IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, expr_ty p; if (!test) { PyErr_SetString(PyExc_ValueError, - "field test is required for IfExp"); + "field 'test' is required for IfExp"); return NULL; } if (!body) { PyErr_SetString(PyExc_ValueError, - "field body is required for IfExp"); + "field 'body' is required for IfExp"); return NULL; } if (!orelse) { PyErr_SetString(PyExc_ValueError, - "field orelse is required for IfExp"); + "field 'orelse' is required for IfExp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2892,7 +2890,7 @@ ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int expr_ty p; if (!elt) { PyErr_SetString(PyExc_ValueError, - "field elt is required for ListComp"); + "field 'elt' is required for ListComp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2915,7 +2913,7 @@ SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int expr_ty p; if (!elt) { PyErr_SetString(PyExc_ValueError, - "field elt is required for SetComp"); + "field 'elt' is required for SetComp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2938,12 +2936,12 @@ DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int expr_ty p; if (!key) { PyErr_SetString(PyExc_ValueError, - "field key is required for DictComp"); + "field 'key' is required for DictComp"); return NULL; } if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for DictComp"); + "field 'value' is required for DictComp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2967,7 +2965,7 @@ GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, expr_ty p; if (!elt) { PyErr_SetString(PyExc_ValueError, - "field elt is required for GeneratorExp"); + "field 'elt' is required for GeneratorExp"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2990,7 +2988,7 @@ Await(expr_ty value, int lineno, int col_offset, int end_lineno, int expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Await"); + "field 'value' is required for Await"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3029,7 +3027,7 @@ YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for YieldFrom"); + "field 'value' is required for YieldFrom"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3051,7 +3049,7 @@ Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, expr_ty p; if (!left) { PyErr_SetString(PyExc_ValueError, - "field left is required for Compare"); + "field 'left' is required for Compare"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3075,7 +3073,7 @@ Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int lineno, int expr_ty p; if (!func) { PyErr_SetString(PyExc_ValueError, - "field func is required for Call"); + "field 'func' is required for Call"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3100,7 +3098,7 @@ FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno, expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for FormattedValue"); + "field 'value' is required for FormattedValue"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3141,7 +3139,7 @@ Constant(constant value, string kind, int lineno, int col_offset, int expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Constant"); + "field 'value' is required for Constant"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3164,17 +3162,17 @@ Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Attribute"); + "field 'value' is required for Attribute"); return NULL; } if (!attr) { PyErr_SetString(PyExc_ValueError, - "field attr is required for Attribute"); + "field 'attr' is required for Attribute"); return NULL; } if (!ctx) { PyErr_SetString(PyExc_ValueError, - "field ctx is required for Attribute"); + "field 'ctx' is required for Attribute"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3198,17 +3196,17 @@ Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno, int expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Subscript"); + "field 'value' is required for Subscript"); return NULL; } if (!slice) { PyErr_SetString(PyExc_ValueError, - "field slice is required for Subscript"); + "field 'slice' is required for Subscript"); return NULL; } if (!ctx) { PyErr_SetString(PyExc_ValueError, - "field ctx is required for Subscript"); + "field 'ctx' is required for Subscript"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3232,12 +3230,12 @@ Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, int expr_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for Starred"); + "field 'value' is required for Starred"); return NULL; } if (!ctx) { PyErr_SetString(PyExc_ValueError, - "field ctx is required for Starred"); + "field 'ctx' is required for Starred"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3260,12 +3258,12 @@ Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int expr_ty p; if (!id) { PyErr_SetString(PyExc_ValueError, - "field id is required for Name"); + "field 'id' is required for Name"); return NULL; } if (!ctx) { PyErr_SetString(PyExc_ValueError, - "field ctx is required for Name"); + "field 'ctx' is required for Name"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3288,7 +3286,7 @@ List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int expr_ty p; if (!ctx) { PyErr_SetString(PyExc_ValueError, - "field ctx is required for List"); + "field 'ctx' is required for List"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3311,7 +3309,7 @@ Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int expr_ty p; if (!ctx) { PyErr_SetString(PyExc_ValueError, - "field ctx is required for Tuple"); + "field 'ctx' is required for Tuple"); return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3353,12 +3351,12 @@ comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async, comprehension_ty p; if (!target) { PyErr_SetString(PyExc_ValueError, - "field target is required for comprehension"); + "field 'target' is required for comprehension"); return NULL; } if (!iter) { PyErr_SetString(PyExc_ValueError, - "field iter is required for comprehension"); + "field 'iter' is required for comprehension"); return NULL; } p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3416,7 +3414,7 @@ arg(identifier arg, expr_ty annotation, string type_comment, int lineno, int arg_ty p; if (!arg) { PyErr_SetString(PyExc_ValueError, - "field arg is required for arg"); + "field 'arg' is required for arg"); return NULL; } p = (arg_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3439,7 +3437,7 @@ keyword(identifier arg, expr_ty value, int lineno, int col_offset, int keyword_ty p; if (!value) { PyErr_SetString(PyExc_ValueError, - "field value is required for keyword"); + "field 'value' is required for keyword"); return NULL; } p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3460,7 +3458,7 @@ alias(identifier name, identifier asname, PyArena *arena) alias_ty p; if (!name) { PyErr_SetString(PyExc_ValueError, - "field name is required for alias"); + "field 'name' is required for alias"); return NULL; } p = (alias_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3477,7 +3475,7 @@ withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena) withitem_ty p; if (!context_expr) { PyErr_SetString(PyExc_ValueError, - "field context_expr is required for withitem"); + "field 'context_expr' is required for withitem"); return NULL; } p = (withitem_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -3494,7 +3492,7 @@ TypeIgnore(int lineno, string tag, PyArena *arena) type_ignore_ty p; if (!tag) { PyErr_SetString(PyExc_ValueError, - "field tag is required for TypeIgnore"); + "field 'tag' is required for TypeIgnore"); return NULL; } p = (type_ignore_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -4602,11 +4600,8 @@ PyObject* ast2obj_expr_context(expr_context_ty o) case Del: Py_INCREF(astmodulestate_global->Del_singleton); return astmodulestate_global->Del_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown expr_context found"); - return NULL; } + Py_UNREACHABLE(); } PyObject* ast2obj_boolop(boolop_ty o) { @@ -4617,11 +4612,8 @@ PyObject* ast2obj_boolop(boolop_ty o) case Or: Py_INCREF(astmodulestate_global->Or_singleton); return astmodulestate_global->Or_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown boolop found"); - return NULL; } + Py_UNREACHABLE(); } PyObject* ast2obj_operator(operator_ty o) { @@ -4665,11 +4657,8 @@ PyObject* ast2obj_operator(operator_ty o) case FloorDiv: Py_INCREF(astmodulestate_global->FloorDiv_singleton); return astmodulestate_global->FloorDiv_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown operator found"); - return NULL; } + Py_UNREACHABLE(); } PyObject* ast2obj_unaryop(unaryop_ty o) { @@ -4686,11 +4675,8 @@ PyObject* ast2obj_unaryop(unaryop_ty o) case USub: Py_INCREF(astmodulestate_global->USub_singleton); return astmodulestate_global->USub_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown unaryop found"); - return NULL; } + Py_UNREACHABLE(); } PyObject* ast2obj_cmpop(cmpop_ty o) { @@ -4725,11 +4711,8 @@ PyObject* ast2obj_cmpop(cmpop_ty o) case NotIn: Py_INCREF(astmodulestate_global->NotIn_singleton); return astmodulestate_global->NotIn_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown cmpop found"); - return NULL; } + Py_UNREACHABLE(); } PyObject* ast2obj_comprehension(void* _o) From webhook-mailer at python.org Wed May 6 12:24:07 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 06 May 2020 16:24:07 -0000 Subject: [Python-checkins] bpo-40521: Disable method cache in subinterpreters (GH-19960) Message-ID: https://github.com/python/cpython/commit/89fc4a34cf7a01df9dd269d32d3706c68a72d130 commit: 89fc4a34cf7a01df9dd269d32d3706c68a72d130 branch: master author: Victor Stinner committer: GitHub date: 2020-05-06T18:23:58+02:00 summary: bpo-40521: Disable method cache in subinterpreters (GH-19960) When Python is built with experimental isolated interpreters, disable the type method cache. Temporary workaround until the cache is made per-interpreter. files: M Objects/typeobject.c diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 1565b90898605..0d5600b4ce4fa 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -19,6 +19,12 @@ class object "PyObject *" "&PyBaseObject_Type" #include "clinic/typeobject.c.h" +/* bpo-40521: Type method cache is shared by all subinterpreters */ +#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# define MCACHE +#endif + +#ifdef MCACHE /* Support type attribute cache */ /* The cache can keep references to the names alive for longer than @@ -47,6 +53,7 @@ struct method_cache_entry { static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP]; static unsigned int next_version_tag = 0; +#endif #define MCACHE_STATS 0 @@ -216,6 +223,7 @@ _PyType_GetTextSignatureFromInternalDoc(const char *name, const char *internal_d unsigned int PyType_ClearCache(void) { +#ifdef MCACHE Py_ssize_t i; unsigned int cur_version_tag = next_version_tag - 1; @@ -240,6 +248,9 @@ PyType_ClearCache(void) /* mark all version tags as invalid */ PyType_Modified(&PyBaseObject_Type); return cur_version_tag; +#else + return 0; +#endif } void @@ -350,6 +361,7 @@ type_mro_modified(PyTypeObject *type, PyObject *bases) { Py_TPFLAGS_VALID_VERSION_TAG); } +#ifdef MCACHE static int assign_version_tag(PyTypeObject *type) { @@ -396,6 +408,7 @@ assign_version_tag(PyTypeObject *type) type->tp_flags |= Py_TPFLAGS_VALID_VERSION_TAG; return 1; } +#endif static PyMemberDef type_members[] = { @@ -3232,12 +3245,12 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name) { PyObject *res; int error; - unsigned int h; +#ifdef MCACHE if (MCACHE_CACHEABLE_NAME(name) && _PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) { /* fast path */ - h = MCACHE_HASH_METHOD(type, name); + unsigned int h = MCACHE_HASH_METHOD(type, name); if (method_cache[h].version == type->tp_version_tag && method_cache[h].name == name) { #if MCACHE_STATS @@ -3246,6 +3259,7 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name) return method_cache[h].value; } } +#endif /* We may end up clearing live exceptions below, so make sure it's ours. */ assert(!PyErr_Occurred()); @@ -3267,8 +3281,9 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name) return NULL; } +#ifdef MCACHE if (MCACHE_CACHEABLE_NAME(name) && assign_version_tag(type)) { - h = MCACHE_HASH_METHOD(type, name); + unsigned int h = MCACHE_HASH_METHOD(type, name); method_cache[h].version = type->tp_version_tag; method_cache[h].value = res; /* borrowed */ Py_INCREF(name); @@ -3281,6 +3296,7 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name) #endif Py_SETREF(method_cache[h].name, name); } +#endif return res; } From webhook-mailer at python.org Wed May 6 12:25:11 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 06 May 2020 16:25:11 -0000 Subject: [Python-checkins] bpo-40533: Disable GC in subinterpreters (GH-19961) Message-ID: https://github.com/python/cpython/commit/d8135e913ab7c694db247c86d0a84c450c32d86e commit: d8135e913ab7c694db247c86d0a84c450c32d86e branch: master author: Victor Stinner committer: GitHub date: 2020-05-06T18:25:06+02:00 summary: bpo-40533: Disable GC in subinterpreters (GH-19961) When Python is built with experimental isolated interpreters, a garbage collection now does nothing in an isolated interpreter. Temporary workaround until subinterpreters stop sharing Python objects. files: M Modules/gcmodule.c diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 56dcb101e0005..a44752b1cc4da 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -1181,6 +1181,14 @@ collect(PyThreadState *tstate, int generation, _PyTime_t t1 = 0; /* initialize to prevent a compiler warning */ GCState *gcstate = &tstate->interp->gc; +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS + if (tstate->interp->config._isolated_interpreter) { + // bpo-40533: The garbage collector must not be run on parallel on + // Python objects shared by multiple interpreters. + return 0; + } +#endif + if (gcstate->debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", generation); show_stats_each_generations(gcstate); From webhook-mailer at python.org Wed May 6 13:05:35 2020 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 06 May 2020 17:05:35 -0000 Subject: [Python-checkins] bpo-40521: Disable list free list in subinterpreters (GH-19959) Message-ID: https://github.com/python/cpython/commit/b7aa23d29fa48238dab3692d02e1f0a7e8a5af9c commit: b7aa23d29fa48238dab3692d02e1f0a7e8a5af9c branch: master author: Victor Stinner committer: GitHub date: 2020-05-06T19:05:27+02:00 summary: bpo-40521: Disable list free list in subinterpreters (GH-19959) When Python is built with experimental isolated interpreters, disable the list free list. Temporary workaround until this cache is made per-interpreter. files: M Objects/listobject.c diff --git a/Objects/listobject.c b/Objects/listobject.c index 904bea317c9da..37fadca129ac0 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -98,8 +98,15 @@ list_preallocate_exact(PyListObject *self, Py_ssize_t size) /* Empty list reuse scheme to save calls to malloc and free */ #ifndef PyList_MAXFREELIST -#define PyList_MAXFREELIST 80 +# define PyList_MAXFREELIST 80 #endif + +/* bpo-40521: list free lists are shared by all interpreters. */ +#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS +# undef PyList_MAXFREELIST +# define PyList_MAXFREELIST 0 +#endif + static PyListObject *free_list[PyList_MAXFREELIST]; static int numfree = 0; From webhook-mailer at python.org Wed May 6 14:11:15 2020 From: webhook-mailer at python.org (Lysandros Nikolaou) Date: Wed, 06 May 2020 18:11:15 -0000 Subject: [Python-checkins] bpo-40334: Add type to the assignment rule in the grammar file (GH-19963) Message-ID: https://github.com/python/cpython/commit/999ec9ab6af536cc2666a0847ec02331aaf00416 commit: 999ec9ab6af536cc2666a0847ec02331aaf00416 branch: master author: Lysandros Nikolaou committer: GitHub date: 2020-05-06T19:11:04+01:00 summary: bpo-40334: Add type to the assignment rule in the grammar file (GH-19963) files: M Grammar/python.gram M Parser/pegen/parse.c diff --git a/Grammar/python.gram b/Grammar/python.gram index 0ce6ab4b4ba90..3f16768198f9d 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -82,7 +82,7 @@ compound_stmt[stmt_ty]: | &'while' while_stmt # NOTE: annotated_rhs may start with 'yield'; yield_expr must start with 'yield' -assignment: +assignment[stmt_ty]: | a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] { CHECK_VERSION( 6, diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 55605d5770f1e..3b518ee263777 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -378,7 +378,7 @@ static asdl_seq* statement_newline_rule(Parser *p); static asdl_seq* simple_stmt_rule(Parser *p); static stmt_ty small_stmt_rule(Parser *p); static stmt_ty compound_stmt_rule(Parser *p); -static void *assignment_rule(Parser *p); +static stmt_ty assignment_rule(Parser *p); static AugOperator* augassign_rule(Parser *p); static stmt_ty global_stmt_rule(Parser *p); static stmt_ty nonlocal_stmt_rule(Parser *p); @@ -1256,7 +1256,7 @@ small_stmt_rule(Parser *p) int start_col_offset = p->tokens[mark]->col_offset; UNUSED(start_col_offset); // Only used by EXTRA macro { // assignment - void *assignment_var; + stmt_ty assignment_var; if ( (assignment_var = assignment_rule(p)) ) @@ -1586,13 +1586,13 @@ compound_stmt_rule(Parser *p) // | ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT? // | target augassign (yield_expr | star_expressions) // | invalid_assignment -static void * +static stmt_ty assignment_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + stmt_ty res = NULL; int mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; From webhook-mailer at python.org Wed May 6 15:51:52 2020 From: webhook-mailer at python.org (Naglis) Date: Wed, 06 May 2020 19:51:52 -0000 Subject: [Python-checkins] Fix typo in sqlite3 documentation (GH-19965) Message-ID: https://github.com/python/cpython/commit/441416c9a06f11f28e17d56c915ea6116c0c9ea7 commit: 441416c9a06f11f28e17d56c915ea6116c0c9ea7 branch: master author: Naglis committer: GitHub date: 2020-05-06T16:51:43-03:00 summary: Fix typo in sqlite3 documentation (GH-19965) *first* is repeated twice. files: M Doc/library/sqlite3.rst diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 314d3a58e2759..ccb82278bdaa1 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -928,7 +928,7 @@ a class like this:: self.x, self.y = x, y Now you want to store the point in a single SQLite column. First you'll have to -choose one of the supported types first to be used for representing the point. +choose one of the supported types to be used for representing the point. Let's just use str and separate the coordinates using a semicolon. Then you need to give your class a method ``__conform__(self, protocol)`` which must return the converted value. The parameter *protocol* will be :class:`PrepareProtocol`. From webhook-mailer at python.org Wed May 6 17:54:42 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Wed, 06 May 2020 21:54:42 -0000 Subject: [Python-checkins] bpo-40334: Allow trailing comma in parenthesised context managers (GH-19964) Message-ID: https://github.com/python/cpython/commit/99db2a1db7a9b468a0ce8377d579f78fa03a2a34 commit: 99db2a1db7a9b468a0ce8377d579f78fa03a2a34 branch: master author: Pablo Galindo committer: GitHub date: 2020-05-06T22:54:34+01:00 summary: bpo-40334: Allow trailing comma in parenthesised context managers (GH-19964) files: M Grammar/python.gram M Lib/test/test_grammar.py M Parser/pegen/parse.c diff --git a/Grammar/python.gram b/Grammar/python.gram index 3f16768198f9d..3d8a39b1d5906 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -170,11 +170,11 @@ for_stmt[stmt_ty]: CHECK_VERSION(5, "Async for loops are", _Py_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) } with_stmt[stmt_ty]: - | 'with' '(' a=','.with_item+ ')' ':' b=block { + | 'with' '(' a=','.with_item+ ','? ')' ':' b=block { _Py_With(a, b, NULL, EXTRA) } | 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block { _Py_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) } - | ASYNC 'with' '(' a=','.with_item+ ')' ':' b=block { + | ASYNC 'with' '(' a=','.with_item+ ','? ')' ':' b=block { CHECK_VERSION(5, "Async with statements are", _Py_AsyncWith(a, b, NULL, EXTRA)) } | ASYNC 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block { CHECK_VERSION(5, "Async with statements are", _Py_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) } diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 922a5166ec12f..c24d3529490be 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -1,7 +1,7 @@ # Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. -from test.support import check_syntax_error, check_syntax_warning +from test.support import check_syntax_error, check_syntax_warning, use_old_parser import inspect import unittest import sys @@ -1694,6 +1694,70 @@ def __exit__(self, *args): with manager() as x, manager(): pass + if not use_old_parser(): + test_cases = [ + """if 1: + with ( + manager() + ): + pass + """, + """if 1: + with ( + manager() as x + ): + pass + """, + """if 1: + with ( + manager() as (x, y), + manager() as z, + ): + pass + """, + """if 1: + with ( + manager(), + manager() + ): + pass + """, + """if 1: + with ( + manager() as x, + manager() as y + ): + pass + """, + """if 1: + with ( + manager() as x, + manager() + ): + pass + """, + """if 1: + with ( + manager() as x, + manager() as y, + manager() as z, + ): + pass + """, + """if 1: + with ( + manager() as x, + manager() as y, + manager(), + ): + pass + """, + ] + for case in test_cases: + with self.subTest(case=case): + compile(case, "", "exec") + + def test_if_else_expr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 3b518ee263777..d86390839d528 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -3031,9 +3031,9 @@ for_stmt_rule(Parser *p) } // with_stmt: -// | 'with' '(' ','.with_item+ ')' ':' block +// | 'with' '(' ','.with_item+ ','? ')' ':' block // | 'with' ','.with_item+ ':' TYPE_COMMENT? block -// | ASYNC 'with' '(' ','.with_item+ ')' ':' block +// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block static stmt_ty with_stmt_rule(Parser *p) @@ -3051,13 +3051,15 @@ with_stmt_rule(Parser *p) UNUSED(start_lineno); // Only used by EXTRA macro int start_col_offset = p->tokens[mark]->col_offset; UNUSED(start_col_offset); // Only used by EXTRA macro - { // 'with' '(' ','.with_item+ ')' ':' block + { // 'with' '(' ','.with_item+ ','? ')' ':' block asdl_seq * a; asdl_seq* b; Token * keyword; Token * literal; Token * literal_1; Token * literal_2; + void *opt_var; + UNUSED(opt_var); // Silence compiler warnings if ( (keyword = _PyPegen_expect_token(p, 519)) && @@ -3065,6 +3067,8 @@ with_stmt_rule(Parser *p) && (a = _gather_38_rule(p)) && + (opt_var = _PyPegen_expect_token(p, 12), 1) + && (literal_1 = _PyPegen_expect_token(p, 8)) && (literal_2 = _PyPegen_expect_token(p, 11)) @@ -3124,7 +3128,7 @@ with_stmt_rule(Parser *p) } p->mark = mark; } - { // ASYNC 'with' '(' ','.with_item+ ')' ':' block + { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block asdl_seq * a; Token * async_var; asdl_seq* b; @@ -3132,6 +3136,8 @@ with_stmt_rule(Parser *p) Token * literal; Token * literal_1; Token * literal_2; + void *opt_var; + UNUSED(opt_var); // Silence compiler warnings if ( (async_var = _PyPegen_expect_token(p, ASYNC)) && @@ -3141,6 +3147,8 @@ with_stmt_rule(Parser *p) && (a = _gather_42_rule(p)) && + (opt_var = _PyPegen_expect_token(p, 12), 1) + && (literal_1 = _PyPegen_expect_token(p, 8)) && (literal_2 = _PyPegen_expect_token(p, 11)) From webhook-mailer at python.org Wed May 6 18:14:51 2020 From: webhook-mailer at python.org (Pablo Galindo) Date: Wed, 06 May 2020 22:14:51 -0000 Subject: [Python-checkins] bpo-40334: Generate comments in the parser code to improve debugging (GH-19966) Message-ID: https://github.com/python/cpython/commit/470aac4d8e76556bd8f820f3f3928dca2b4d2849 commit: 470aac4d8e76556bd8f820f3f3928dca2b4d2849 branch: master author: Pablo Galindo committer: GitHub date: 2020-05-06T23:14:43+01:00 summary: bpo-40334: Generate comments in the parser code to improve debugging (GH-19966) files: M Parser/pegen/parse.c M Tools/peg_generator/pegen/c_generator.py diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index d86390839d528..b1da16640aa6e 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -678,9 +678,9 @@ file_rule(Parser *p) void *a; Token * endmarker_var; if ( - (a = statements_rule(p), 1) + (a = statements_rule(p), 1) // statements? && - (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) + (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' ) { res = _PyPegen_make_module ( p , a ); @@ -709,7 +709,7 @@ interactive_rule(Parser *p) { // statement_newline asdl_seq* a; if ( - (a = statement_newline_rule(p)) + (a = statement_newline_rule(p)) // statement_newline ) { res = Interactive ( a , p -> arena ); @@ -740,11 +740,11 @@ eval_rule(Parser *p) expr_ty a; Token * endmarker_var; if ( - (a = expressions_rule(p)) + (a = expressions_rule(p)) // expressions && - (_loop0_1_var = _loop0_1_rule(p)) + (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* && - (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) + (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' ) { res = Expression ( a , p -> arena ); @@ -779,19 +779,19 @@ func_type_rule(Parser *p) Token * literal_1; Token * literal_2; if ( - (literal = _PyPegen_expect_token(p, 7)) + (literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = type_expressions_rule(p), 1) + (a = type_expressions_rule(p), 1) // type_expressions? && - (literal_1 = _PyPegen_expect_token(p, 8)) + (literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (literal_2 = _PyPegen_expect_token(p, 51)) + (literal_2 = _PyPegen_expect_token(p, 51)) // token='->' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression && - (_loop0_2_var = _loop0_2_rule(p)) + (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE* && - (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) + (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' ) { res = FunctionType ( a , b , p -> arena ); @@ -820,7 +820,7 @@ fstring_rule(Parser *p) { // star_expressions expr_ty star_expressions_var; if ( - (star_expressions_var = star_expressions_rule(p)) + (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { res = star_expressions_var; @@ -858,19 +858,19 @@ type_expressions_rule(Parser *p) Token * literal_2; Token * literal_3; if ( - (a = _gather_3_rule(p)) + (a = _gather_3_rule(p)) // ','.expression+ && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 12)) // token=',' && - (literal_1 = _PyPegen_expect_token(p, 16)) + (literal_1 = _PyPegen_expect_token(p, 16)) // token='*' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression && - (literal_2 = _PyPegen_expect_token(p, 12)) + (literal_2 = _PyPegen_expect_token(p, 12)) // token=',' && - (literal_3 = _PyPegen_expect_token(p, 35)) + (literal_3 = _PyPegen_expect_token(p, 35)) // token='**' && - (c = expression_rule(p)) + (c = expression_rule(p)) // expression ) { res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c ); @@ -888,13 +888,13 @@ type_expressions_rule(Parser *p) Token * literal; Token * literal_1; if ( - (a = _gather_5_rule(p)) + (a = _gather_5_rule(p)) // ','.expression+ && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 12)) // token=',' && - (literal_1 = _PyPegen_expect_token(p, 16)) + (literal_1 = _PyPegen_expect_token(p, 16)) // token='*' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression ) { res = _PyPegen_seq_append_to_end ( p , a , b ); @@ -912,13 +912,13 @@ type_expressions_rule(Parser *p) Token * literal; Token * literal_1; if ( - (a = _gather_7_rule(p)) + (a = _gather_7_rule(p)) // ','.expression+ && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 12)) // token=',' && - (literal_1 = _PyPegen_expect_token(p, 35)) + (literal_1 = _PyPegen_expect_token(p, 35)) // token='**' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression ) { res = _PyPegen_seq_append_to_end ( p , a , b ); @@ -937,15 +937,15 @@ type_expressions_rule(Parser *p) Token * literal_1; Token * literal_2; if ( - (literal = _PyPegen_expect_token(p, 16)) + (literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = expression_rule(p)) + (a = expression_rule(p)) // expression && - (literal_1 = _PyPegen_expect_token(p, 12)) + (literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (literal_2 = _PyPegen_expect_token(p, 35)) + (literal_2 = _PyPegen_expect_token(p, 35)) // token='**' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression ) { res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b ); @@ -961,9 +961,9 @@ type_expressions_rule(Parser *p) expr_ty a; Token * literal; if ( - (literal = _PyPegen_expect_token(p, 16)) + (literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = expression_rule(p)) + (a = expression_rule(p)) // expression ) { res = _PyPegen_singleton_seq ( p , a ); @@ -979,9 +979,9 @@ type_expressions_rule(Parser *p) expr_ty a; Token * literal; if ( - (literal = _PyPegen_expect_token(p, 35)) + (literal = _PyPegen_expect_token(p, 35)) // token='**' && - (a = expression_rule(p)) + (a = expression_rule(p)) // expression ) { res = _PyPegen_singleton_seq ( p , a ); @@ -996,7 +996,7 @@ type_expressions_rule(Parser *p) { // ','.expression+ asdl_seq * _gather_9_var; if ( - (_gather_9_var = _gather_9_rule(p)) + (_gather_9_var = _gather_9_rule(p)) // ','.expression+ ) { res = _gather_9_var; @@ -1021,7 +1021,7 @@ statements_rule(Parser *p) { // statement+ asdl_seq * a; if ( - (a = _loop1_11_rule(p)) + (a = _loop1_11_rule(p)) // statement+ ) { res = _PyPegen_seq_flatten ( p , a ); @@ -1050,7 +1050,7 @@ statement_rule(Parser *p) { // compound_stmt stmt_ty a; if ( - (a = compound_stmt_rule(p)) + (a = compound_stmt_rule(p)) // compound_stmt ) { res = _PyPegen_singleton_seq ( p , a ); @@ -1065,7 +1065,7 @@ statement_rule(Parser *p) { // simple_stmt asdl_seq* simple_stmt_var; if ( - (simple_stmt_var = simple_stmt_rule(p)) + (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt ) { res = simple_stmt_var; @@ -1099,9 +1099,9 @@ statement_newline_rule(Parser *p) stmt_ty a; Token * newline_var; if ( - (a = compound_stmt_rule(p)) + (a = compound_stmt_rule(p)) // compound_stmt && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { res = _PyPegen_singleton_seq ( p , a ); @@ -1116,7 +1116,7 @@ statement_newline_rule(Parser *p) { // simple_stmt asdl_seq* simple_stmt_var; if ( - (simple_stmt_var = simple_stmt_rule(p)) + (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt ) { res = simple_stmt_var; @@ -1127,7 +1127,7 @@ statement_newline_rule(Parser *p) { // NEWLINE Token * newline_var; if ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1150,7 +1150,7 @@ statement_newline_rule(Parser *p) { // $ Token * endmarker_var; if ( - (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) + (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' ) { res = _PyPegen_interactive_exit ( p ); @@ -1180,11 +1180,11 @@ simple_stmt_rule(Parser *p) stmt_ty a; Token * newline_var; if ( - (a = small_stmt_rule(p)) + (a = small_stmt_rule(p)) // small_stmt && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { res = _PyPegen_singleton_seq ( p , a ); @@ -1202,11 +1202,11 @@ simple_stmt_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_12_rule(p)) + (a = _gather_12_rule(p)) // ';'.small_stmt+ && - (opt_var = _PyPegen_expect_token(p, 13), 1) + (opt_var = _PyPegen_expect_token(p, 13), 1) // ';'? && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { res = a; @@ -1258,7 +1258,7 @@ small_stmt_rule(Parser *p) { // assignment stmt_ty assignment_var; if ( - (assignment_var = assignment_rule(p)) + (assignment_var = assignment_rule(p)) // assignment ) { res = assignment_var; @@ -1269,7 +1269,7 @@ small_stmt_rule(Parser *p) { // star_expressions expr_ty e; if ( - (e = star_expressions_rule(p)) + (e = star_expressions_rule(p)) // star_expressions ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1292,9 +1292,9 @@ small_stmt_rule(Parser *p) { // &'return' return_stmt stmt_ty return_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' && - (return_stmt_var = return_stmt_rule(p)) + (return_stmt_var = return_stmt_rule(p)) // return_stmt ) { res = return_stmt_var; @@ -1307,7 +1307,7 @@ small_stmt_rule(Parser *p) if ( _PyPegen_lookahead(1, _tmp_14_rule, p) && - (import_stmt_var = import_stmt_rule(p)) + (import_stmt_var = import_stmt_rule(p)) // import_stmt ) { res = import_stmt_var; @@ -1318,9 +1318,9 @@ small_stmt_rule(Parser *p) { // &'raise' raise_stmt stmt_ty raise_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' && - (raise_stmt_var = raise_stmt_rule(p)) + (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt ) { res = raise_stmt_var; @@ -1331,7 +1331,7 @@ small_stmt_rule(Parser *p) { // 'pass' Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 502)) + (keyword = _PyPegen_expect_token(p, 502)) // token='pass' ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1354,9 +1354,9 @@ small_stmt_rule(Parser *p) { // &'del' del_stmt stmt_ty del_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' && - (del_stmt_var = del_stmt_rule(p)) + (del_stmt_var = del_stmt_rule(p)) // del_stmt ) { res = del_stmt_var; @@ -1367,9 +1367,9 @@ small_stmt_rule(Parser *p) { // &'yield' yield_stmt stmt_ty yield_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' && - (yield_stmt_var = yield_stmt_rule(p)) + (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt ) { res = yield_stmt_var; @@ -1380,9 +1380,9 @@ small_stmt_rule(Parser *p) { // &'assert' assert_stmt stmt_ty assert_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' && - (assert_stmt_var = assert_stmt_rule(p)) + (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt ) { res = assert_stmt_var; @@ -1393,7 +1393,7 @@ small_stmt_rule(Parser *p) { // 'break' Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 506)) + (keyword = _PyPegen_expect_token(p, 506)) // token='break' ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1416,7 +1416,7 @@ small_stmt_rule(Parser *p) { // 'continue' Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 507)) + (keyword = _PyPegen_expect_token(p, 507)) // token='continue' ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1439,9 +1439,9 @@ small_stmt_rule(Parser *p) { // &'global' global_stmt stmt_ty global_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' && - (global_stmt_var = global_stmt_rule(p)) + (global_stmt_var = global_stmt_rule(p)) // global_stmt ) { res = global_stmt_var; @@ -1452,9 +1452,9 @@ small_stmt_rule(Parser *p) { // &'nonlocal' nonlocal_stmt stmt_ty nonlocal_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' && - (nonlocal_stmt_var = nonlocal_stmt_rule(p)) + (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt ) { res = nonlocal_stmt_var; @@ -1489,7 +1489,7 @@ compound_stmt_rule(Parser *p) if ( _PyPegen_lookahead(1, _tmp_15_rule, p) && - (function_def_var = function_def_rule(p)) + (function_def_var = function_def_rule(p)) // function_def ) { res = function_def_var; @@ -1500,9 +1500,9 @@ compound_stmt_rule(Parser *p) { // &'if' if_stmt stmt_ty if_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if' && - (if_stmt_var = if_stmt_rule(p)) + (if_stmt_var = if_stmt_rule(p)) // if_stmt ) { res = if_stmt_var; @@ -1515,7 +1515,7 @@ compound_stmt_rule(Parser *p) if ( _PyPegen_lookahead(1, _tmp_16_rule, p) && - (class_def_var = class_def_rule(p)) + (class_def_var = class_def_rule(p)) // class_def ) { res = class_def_var; @@ -1528,7 +1528,7 @@ compound_stmt_rule(Parser *p) if ( _PyPegen_lookahead(1, _tmp_17_rule, p) && - (with_stmt_var = with_stmt_rule(p)) + (with_stmt_var = with_stmt_rule(p)) // with_stmt ) { res = with_stmt_var; @@ -1541,7 +1541,7 @@ compound_stmt_rule(Parser *p) if ( _PyPegen_lookahead(1, _tmp_18_rule, p) && - (for_stmt_var = for_stmt_rule(p)) + (for_stmt_var = for_stmt_rule(p)) // for_stmt ) { res = for_stmt_var; @@ -1552,9 +1552,9 @@ compound_stmt_rule(Parser *p) { // &'try' try_stmt stmt_ty try_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try' && - (try_stmt_var = try_stmt_rule(p)) + (try_stmt_var = try_stmt_rule(p)) // try_stmt ) { res = try_stmt_var; @@ -1565,9 +1565,9 @@ compound_stmt_rule(Parser *p) { // &'while' while_stmt stmt_ty while_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while' && - (while_stmt_var = while_stmt_rule(p)) + (while_stmt_var = while_stmt_rule(p)) // while_stmt ) { res = while_stmt_var; @@ -1608,13 +1608,13 @@ assignment_rule(Parser *p) void *c; Token * literal; if ( - (a = _PyPegen_name_token(p)) + (a = _PyPegen_name_token(p)) // NAME && - (literal = _PyPegen_expect_token(p, 11)) + (literal = _PyPegen_expect_token(p, 11)) // token=':' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression && - (c = _tmp_19_rule(p), 1) + (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs] ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1640,13 +1640,13 @@ assignment_rule(Parser *p) void *c; Token * literal; if ( - (a = _tmp_20_rule(p)) + (a = _tmp_20_rule(p)) // '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target && - (literal = _PyPegen_expect_token(p, 11)) + (literal = _PyPegen_expect_token(p, 11)) // token=':' && - (b = expression_rule(p)) + (b = expression_rule(p)) // expression && - (c = _tmp_21_rule(p), 1) + (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs] ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1671,11 +1671,11 @@ assignment_rule(Parser *p) void *b; void *tc; if ( - (a = _loop1_22_rule(p)) + (a = _loop1_22_rule(p)) // ((star_targets '='))+ && - (b = _tmp_23_rule(p)) + (b = _tmp_23_rule(p)) // yield_expr | star_expressions && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1700,11 +1700,11 @@ assignment_rule(Parser *p) AugOperator* b; void *c; if ( - (a = target_rule(p)) + (a = target_rule(p)) // target && - (b = augassign_rule(p)) + (b = augassign_rule(p)) // augassign && - (c = _tmp_24_rule(p)) + (c = _tmp_24_rule(p)) // yield_expr | star_expressions ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -1727,7 +1727,7 @@ assignment_rule(Parser *p) { // invalid_assignment void *invalid_assignment_var; if ( - (invalid_assignment_var = invalid_assignment_rule(p)) + (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment ) { res = invalid_assignment_var; @@ -1765,7 +1765,7 @@ augassign_rule(Parser *p) { // '+=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 36)) + (literal = _PyPegen_expect_token(p, 36)) // token='+=' ) { res = _PyPegen_augoperator ( p , Add ); @@ -1780,7 +1780,7 @@ augassign_rule(Parser *p) { // '-=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 37)) + (literal = _PyPegen_expect_token(p, 37)) // token='-=' ) { res = _PyPegen_augoperator ( p , Sub ); @@ -1795,7 +1795,7 @@ augassign_rule(Parser *p) { // '*=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 38)) + (literal = _PyPegen_expect_token(p, 38)) // token='*=' ) { res = _PyPegen_augoperator ( p , Mult ); @@ -1810,7 +1810,7 @@ augassign_rule(Parser *p) { // '@=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 50)) + (literal = _PyPegen_expect_token(p, 50)) // token='@=' ) { res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); @@ -1825,7 +1825,7 @@ augassign_rule(Parser *p) { // '/=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 39)) + (literal = _PyPegen_expect_token(p, 39)) // token='/=' ) { res = _PyPegen_augoperator ( p , Div ); @@ -1840,7 +1840,7 @@ augassign_rule(Parser *p) { // '%=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 40)) + (literal = _PyPegen_expect_token(p, 40)) // token='%=' ) { res = _PyPegen_augoperator ( p , Mod ); @@ -1855,7 +1855,7 @@ augassign_rule(Parser *p) { // '&=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 41)) + (literal = _PyPegen_expect_token(p, 41)) // token='&=' ) { res = _PyPegen_augoperator ( p , BitAnd ); @@ -1870,7 +1870,7 @@ augassign_rule(Parser *p) { // '|=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 42)) + (literal = _PyPegen_expect_token(p, 42)) // token='|=' ) { res = _PyPegen_augoperator ( p , BitOr ); @@ -1885,7 +1885,7 @@ augassign_rule(Parser *p) { // '^=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 43)) + (literal = _PyPegen_expect_token(p, 43)) // token='^=' ) { res = _PyPegen_augoperator ( p , BitXor ); @@ -1900,7 +1900,7 @@ augassign_rule(Parser *p) { // '<<=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 44)) + (literal = _PyPegen_expect_token(p, 44)) // token='<<=' ) { res = _PyPegen_augoperator ( p , LShift ); @@ -1915,7 +1915,7 @@ augassign_rule(Parser *p) { // '>>=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 45)) + (literal = _PyPegen_expect_token(p, 45)) // token='>>=' ) { res = _PyPegen_augoperator ( p , RShift ); @@ -1930,7 +1930,7 @@ augassign_rule(Parser *p) { // '**=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 46)) + (literal = _PyPegen_expect_token(p, 46)) // token='**=' ) { res = _PyPegen_augoperator ( p , Pow ); @@ -1945,7 +1945,7 @@ augassign_rule(Parser *p) { // '//=' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 48)) + (literal = _PyPegen_expect_token(p, 48)) // token='//=' ) { res = _PyPegen_augoperator ( p , FloorDiv ); @@ -1983,9 +1983,9 @@ global_stmt_rule(Parser *p) asdl_seq * a; Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 508)) + (keyword = _PyPegen_expect_token(p, 508)) // token='global' && - (a = _gather_25_rule(p)) + (a = _gather_25_rule(p)) // ','.NAME+ ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2031,9 +2031,9 @@ nonlocal_stmt_rule(Parser *p) asdl_seq * a; Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 509)) + (keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal' && - (a = _gather_27_rule(p)) + (a = _gather_27_rule(p)) // ','.NAME+ ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2078,7 +2078,7 @@ yield_stmt_rule(Parser *p) { // yield_expr expr_ty y; if ( - (y = yield_expr_rule(p)) + (y = yield_expr_rule(p)) // yield_expr ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2125,11 +2125,11 @@ assert_stmt_rule(Parser *p) void *b; Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 505)) + (keyword = _PyPegen_expect_token(p, 505)) // token='assert' && - (a = expression_rule(p)) + (a = expression_rule(p)) // expression && - (b = _tmp_29_rule(p), 1) + (b = _tmp_29_rule(p), 1) // [',' expression] ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2175,9 +2175,9 @@ del_stmt_rule(Parser *p) asdl_seq* a; Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 503)) + (keyword = _PyPegen_expect_token(p, 503)) // token='del' && - (a = del_targets_rule(p)) + (a = del_targets_rule(p)) // del_targets ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2214,7 +2214,7 @@ import_stmt_rule(Parser *p) { // import_name stmt_ty import_name_var; if ( - (import_name_var = import_name_rule(p)) + (import_name_var = import_name_rule(p)) // import_name ) { res = import_name_var; @@ -2225,7 +2225,7 @@ import_stmt_rule(Parser *p) { // import_from stmt_ty import_from_var; if ( - (import_from_var = import_from_rule(p)) + (import_from_var = import_from_rule(p)) // import_from ) { res = import_from_var; @@ -2259,9 +2259,9 @@ import_name_rule(Parser *p) asdl_seq* a; Token * keyword; if ( - (keyword = _PyPegen_expect_token(p, 513)) + (keyword = _PyPegen_expect_token(p, 513)) // token='import' && - (a = dotted_as_names_rule(p)) + (a = dotted_as_names_rule(p)) // dotted_as_names ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2312,15 +2312,15 @@ import_from_rule(Parser *p) Token * keyword; Token * keyword_1; if ( - (keyword = _PyPegen_expect_token(p, 514)) + (keyword = _PyPegen_expect_token(p, 514)) // token='from' && - (a = _loop0_30_rule(p)) + (a = _loop0_30_rule(p)) // (('.' | '...'))* && - (b = dotted_name_rule(p)) + (b = dotted_name_rule(p)) // dotted_name && - (keyword_1 = _PyPegen_expect_token(p, 513)) + (keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' && - (c = import_from_targets_rule(p)) + (c = import_from_targets_rule(p)) // import_from_targets ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2346,13 +2346,13 @@ import_from_rule(Parser *p) Token * keyword; Token * keyword_1; if ( - (keyword = _PyPegen_expect_token(p, 514)) + (keyword = _PyPegen_expect_token(p, 514)) // token='from' && - (a = _loop1_31_rule(p)) + (a = _loop1_31_rule(p)) // (('.' | '...'))+ && - (keyword_1 = _PyPegen_expect_token(p, 513)) + (keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' && - (b = import_from_targets_rule(p)) + (b = import_from_targets_rule(p)) // import_from_targets ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -2393,13 +2393,13 @@ import_from_targets_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (literal = _PyPegen_expect_token(p, 7)) + (literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = import_from_as_names_rule(p)) + (a = import_from_as_names_rule(p)) // import_from_as_names && - (opt_var = _PyPegen_expect_token(p, 12), 1) + (opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && - (literal_1 = _PyPegen_expect_token(p, 8)) + (literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { res = a; @@ -2414,7 +2414,7 @@ import_from_targets_rule(Parser *p) { // import_from_as_names asdl_seq* import_from_as_names_var; if ( - (import_from_as_names_var = import_from_as_names_rule(p)) + (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names ) { res = import_from_as_names_var; @@ -2425,7 +2425,7 @@ import_from_targets_rule(Parser *p) { // '*' Token * literal; if ( - (literal = _PyPegen_expect_token(p, 16)) + (literal = _PyPegen_expect_token(p, 16)) // token='*' ) { res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) ); @@ -2454,7 +2454,7 @@ import_from_as_names_rule(Parser *p) { // ','.import_from_as_name+ asdl_seq * a; if ( - (a = _gather_32_rule(p)) + (a = _gather_32_rule(p)) // ','.import_from_as_name+ )