diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-28 15:23:28 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-28 15:23:28 +0100 |
commit | e19b28f2bd89c047b12f6a8ffb1fe793834700d3 (patch) | |
tree | 8261b98b29eedb8ce67df4d571e8ba9b948d17ab /Python | |
parent | f7868847da9f84cb68605b4b94d8fcc205e0766e (diff) | |
parent | 3eca28c61363a03b81b9fb12775490d6e42d8ecf (diff) | |
download | cpython-git-e19b28f2bd89c047b12f6a8ffb1fe793834700d3.tar.gz |
Merge branch 'master' into bind-socket
Diffstat (limited to 'Python')
-rw-r--r-- | Python/Python-ast.c | 37 | ||||
-rw-r--r-- | Python/ast.c | 160 | ||||
-rw-r--r-- | Python/bltinmodule.c | 11 | ||||
-rw-r--r-- | Python/ceval.c | 189 | ||||
-rw-r--r-- | Python/clinic/_warnings.c.h | 44 | ||||
-rw-r--r-- | Python/clinic/bltinmodule.c.h | 119 | ||||
-rw-r--r-- | Python/clinic/import.c.h | 25 | ||||
-rw-r--r-- | Python/clinic/sysmodule.c.h | 18 | ||||
-rw-r--r-- | Python/clinic/traceback.c.h | 35 | ||||
-rw-r--r-- | Python/compile.c | 10 | ||||
-rw-r--r-- | Python/coreconfig.c | 1067 | ||||
-rw-r--r-- | Python/dtoa.c | 79 | ||||
-rw-r--r-- | Python/dynload_win.c | 2 | ||||
-rw-r--r-- | Python/fileutils.c | 37 | ||||
-rw-r--r-- | Python/getargs.c | 349 | ||||
-rw-r--r-- | Python/getopt.c | 8 | ||||
-rw-r--r-- | Python/graminit.c | 390 | ||||
-rw-r--r-- | Python/hamt.c | 2 | ||||
-rw-r--r-- | Python/import.c | 24 | ||||
-rw-r--r-- | Python/importlib_external.h | 1747 | ||||
-rw-r--r-- | Python/modsupport.c | 21 | ||||
-rw-r--r-- | Python/pathconfig.c | 182 | ||||
-rw-r--r-- | Python/preconfig.c | 695 | ||||
-rw-r--r-- | Python/pyarena.c | 2 | ||||
-rw-r--r-- | Python/pylifecycle.c | 241 | ||||
-rw-r--r-- | Python/pystate.c | 140 | ||||
-rw-r--r-- | Python/pythonrun.c | 6 | ||||
-rw-r--r-- | Python/sysmodule.c | 196 |
28 files changed, 3409 insertions, 2427 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 92ec157571..d0416eb639 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -324,8 +324,10 @@ static char *JoinedStr_fields[]={ "values", }; static PyTypeObject *Constant_type; +_Py_IDENTIFIER(kind); static char *Constant_fields[]={ "value", + "kind", }; static PyTypeObject *Attribute_type; _Py_IDENTIFIER(attr); @@ -950,7 +952,7 @@ static int init_types(void) if (!FormattedValue_type) return 0; JoinedStr_type = make_type("JoinedStr", expr_type, JoinedStr_fields, 1); if (!JoinedStr_type) return 0; - Constant_type = make_type("Constant", expr_type, Constant_fields, 1); + Constant_type = make_type("Constant", expr_type, Constant_fields, 2); if (!Constant_type) return 0; Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3); if (!Attribute_type) return 0; @@ -2287,8 +2289,8 @@ JoinedStr(asdl_seq * values, int lineno, int col_offset, int end_lineno, int } expr_ty -Constant(constant value, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +Constant(constant value, string kind, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!value) { @@ -2301,6 +2303,7 @@ Constant(constant value, int lineno, int col_offset, int end_lineno, int return NULL; p->kind = Constant_kind; p->v.Constant.value = value; + p->v.Constant.kind = kind; p->lineno = lineno; p->col_offset = col_offset; p->end_lineno = end_lineno; @@ -3507,6 +3510,11 @@ ast2obj_expr(void* _o) if (_PyObject_SetAttrId(result, &PyId_value, value) == -1) goto failed; Py_DECREF(value); + value = ast2obj_string(o->v.Constant.kind); + if (!value) goto failed; + if (_PyObject_SetAttrId(result, &PyId_kind, value) == -1) + goto failed; + Py_DECREF(value); break; case Attribute_kind: result = PyType_GenericNew(Attribute_type, NULL, NULL); @@ -7224,6 +7232,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) } if (isinstance) { constant value; + string kind; if (_PyObject_LookupAttrId(obj, &PyId_value, &tmp) < 0) { return 1; @@ -7238,8 +7247,21 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Constant(value, lineno, col_offset, end_lineno, end_col_offset, - arena); + if (_PyObject_LookupAttrId(obj, &PyId_kind, &tmp) < 0) { + return 1; + } + if (tmp == NULL || tmp == Py_None) { + Py_CLEAR(tmp); + kind = NULL; + } + else { + int res; + res = obj2ast_string(tmp, &kind, arena); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + *out = Constant(value, kind, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8900,6 +8922,11 @@ PyObject* PyAST_mod2obj(mod_ty t) /* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) { + return PyAST_obj2mod_ex(ast, arena, mode, PY_MINOR_VERSION); +} + +mod_ty PyAST_obj2mod_ex(PyObject* ast, PyArena* arena, int mode, int feature_version) +{ mod_ty res; PyObject *req_type[3]; char *req_name[] = {"Module", "Expression", "Interactive"}; diff --git a/Python/ast.c b/Python/ast.c index 2e960485f4..e9154fecff 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -316,13 +316,14 @@ validate_expr(expr_ty exp, expr_context_ty ctx) return validate_exprs(exp->v.List.elts, ctx, 0); case Tuple_kind: return validate_exprs(exp->v.Tuple.elts, ctx, 0); + case NamedExpr_kind: + return validate_expr(exp->v.NamedExpr.value, Load); /* This last case doesn't have any checking. */ case Name_kind: return 1; - default: - PyErr_SetString(PyExc_SystemError, "unexpected expression"); - return 0; } + PyErr_SetString(PyExc_SystemError, "unexpected expression"); + return 0; } static int @@ -564,6 +565,7 @@ struct compiling { PyArena *c_arena; /* Arena for allocating memory. */ PyObject *c_filename; /* filename */ PyObject *c_normalize; /* Normalization function from unicodedata. */ + int c_feature_version; /* Latest minor version of Python for allowed features */ }; static asdl_seq *seq_for_testlist(struct compiling *, const node *); @@ -783,6 +785,7 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags, /* borrowed reference */ c.c_filename = filename; c.c_normalize = NULL; + c.c_feature_version = flags->cf_feature_version; if (TYPE(n) == encoding_decl) n = CHILD(n, 0); @@ -955,7 +958,7 @@ PyAST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename_str, */ static operator_ty -get_operator(const node *n) +get_operator(struct compiling *c, const node *n) { switch (TYPE(n)) { case VBAR: @@ -975,6 +978,11 @@ get_operator(const node *n) case STAR: return Mult; case AT: + if (c->c_feature_version < 5) { + ast_error(c, n, + "The '@' operator is only supported in Python 3.5 and greater"); + return (operator_ty)0; + } return MatMult; case SLASH: return Div; @@ -1209,6 +1217,11 @@ ast_for_augassign(struct compiling *c, const node *n) else return Mult; case '@': + if (c->c_feature_version < 5) { + ast_error(c, n, + "The '@' operator is only supported in Python 3.5 and greater"); + return (operator_ty)0; + } return MatMult; default: PyErr_Format(PyExc_SystemError, "invalid augassign: %s", STR(n)); @@ -1518,7 +1531,7 @@ ast_for_arguments(struct compiling *c, const node *n) } else if (found_default) { ast_error(c, n, - "non-default argument follows default argument"); + "non-default argument follows default argument"); return NULL; } arg = ast_for_arg(c, ch); @@ -1719,6 +1732,12 @@ ast_for_funcdef_impl(struct compiling *c, const node *n0, node *tc; string type_comment = NULL; + if (is_async && c->c_feature_version < 5) { + ast_error(c, n, + "Async functions are only supported in Python 3.5 and greater"); + return NULL; + } + REQ(n, funcdef); name = NEW_IDENTIFIER(CHILD(n, name_i)); @@ -1772,10 +1791,9 @@ ast_for_funcdef_impl(struct compiling *c, const node *n0, static stmt_ty ast_for_async_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) { - /* async_funcdef: 'async' funcdef */ + /* async_funcdef: ASYNC funcdef */ REQ(n, async_funcdef); - REQ(CHILD(n, 0), NAME); - assert(strcmp(STR(CHILD(n, 0)), "async") == 0); + REQ(CHILD(n, 0), ASYNC); REQ(CHILD(n, 1), funcdef); return ast_for_funcdef_impl(c, n, decorator_seq, @@ -1794,10 +1812,9 @@ ast_for_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) static stmt_ty ast_for_async_stmt(struct compiling *c, const node *n) { - /* async_stmt: 'async' (funcdef | with_stmt | for_stmt) */ + /* async_stmt: ASYNC (funcdef | with_stmt | for_stmt) */ REQ(n, async_stmt); - REQ(CHILD(n, 0), NAME); - assert(strcmp(STR(CHILD(n, 0)), "async") == 0); + REQ(CHILD(n, 0), ASYNC); switch (TYPE(CHILD(n, 1))) { case funcdef: @@ -1948,8 +1965,7 @@ count_comp_fors(struct compiling *c, const node *n) n_fors++; REQ(n, comp_for); if (NCH(n) == 2) { - REQ(CHILD(n, 0), NAME); - assert(strcmp(STR(CHILD(n, 0)), "async") == 0); + REQ(CHILD(n, 0), ASYNC); n = CHILD(n, 1); } else if (NCH(n) == 1) { @@ -2034,8 +2050,7 @@ ast_for_comprehension(struct compiling *c, const node *n) if (NCH(n) == 2) { is_async = 1; - REQ(CHILD(n, 0), NAME); - assert(strcmp(STR(CHILD(n, 0)), "async") == 0); + REQ(CHILD(n, 0), ASYNC); sync_n = CHILD(n, 1); } else { @@ -2043,6 +2058,13 @@ ast_for_comprehension(struct compiling *c, const node *n) } REQ(sync_n, sync_comp_for); + /* Async comprehensions only allowed in Python 3.6 and greater */ + if (is_async && c->c_feature_version < 6) { + ast_error(c, n, + "Async comprehensions are only supported in Python 3.6 and greater"); + return NULL; + } + for_ch = CHILD(sync_n, 1); t = ast_for_exprlist(c, for_ch, Store); if (!t) @@ -2292,13 +2314,13 @@ ast_for_atom(struct compiling *c, const node *n) size_t len = strlen(s); if (len >= 4 && len <= 5) { if (!strcmp(s, "None")) - return Constant(Py_None, LINENO(n), n->n_col_offset, + return Constant(Py_None, NULL, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); if (!strcmp(s, "True")) - return Constant(Py_True, LINENO(n), n->n_col_offset, + return Constant(Py_True, NULL, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); if (!strcmp(s, "False")) - return Constant(Py_False, LINENO(n), n->n_col_offset, + return Constant(Py_False, NULL, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); } name = new_identifier(s, c); @@ -2337,7 +2359,15 @@ ast_for_atom(struct compiling *c, const node *n) return str; } case NUMBER: { - PyObject *pynum = parsenumber(c, STR(ch)); + PyObject *pynum; + /* Underscores in numeric literals are only allowed in Python 3.6 or greater */ + /* Check for underscores here rather than in parse_number so we can report a line number on error */ + if (c->c_feature_version < 6 && strchr(STR(ch), '_') != NULL) { + ast_error(c, ch, + "Underscores in numeric literals are only supported in Python 3.6 and greater"); + return NULL; + } + pynum = parsenumber(c, STR(ch)); if (!pynum) return NULL; @@ -2345,11 +2375,11 @@ ast_for_atom(struct compiling *c, const node *n) Py_DECREF(pynum); return NULL; } - return Constant(pynum, LINENO(n), n->n_col_offset, + return Constant(pynum, NULL, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); } case ELLIPSIS: /* Ellipsis */ - return Constant(Py_Ellipsis, LINENO(n), n->n_col_offset, + return Constant(Py_Ellipsis, NULL, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); case LPAR: /* some parenthesized expressions */ ch = CHILD(n, 1); @@ -2420,8 +2450,8 @@ ast_for_atom(struct compiling *c, const node *n) TYPE(CHILD(ch, 3 - is_dict)) == comp_for) { /* It's a dictionary comprehension. */ if (is_dict) { - ast_error(c, n, "dict unpacking cannot be used in " - "dict comprehension"); + ast_error(c, n, + "dict unpacking cannot be used in dict comprehension"); return NULL; } res = ast_for_dictcomp(c, ch); @@ -2524,7 +2554,7 @@ ast_for_binop(struct compiling *c, const node *n) if (!expr2) return NULL; - newoperator = get_operator(CHILD(n, 1)); + newoperator = get_operator(c, CHILD(n, 1)); if (!newoperator) return NULL; @@ -2539,7 +2569,7 @@ ast_for_binop(struct compiling *c, const node *n) expr_ty tmp_result, tmp; const node* next_oper = CHILD(n, i * 2 + 1); - newoperator = get_operator(next_oper); + newoperator = get_operator(c, next_oper); if (!newoperator) return NULL; @@ -2678,7 +2708,12 @@ ast_for_atom_expr(struct compiling *c, const node *n) REQ(n, atom_expr); nch = NCH(n); - if (TYPE(CHILD(n, 0)) == NAME && strcmp(STR(CHILD(n, 0)), "await") == 0) { + if (TYPE(CHILD(n, 0)) == AWAIT) { + if (c->c_feature_version < 5) { + ast_error(c, n, + "Await expressions are only supported in Python 3.5 and greater"); + return NULL; + } start = 1; assert(nch > 1); } @@ -2775,7 +2810,7 @@ ast_for_expr(struct compiling *c, const node *n) term: factor (('*'|'@'|'/'|'%'|'//') factor)* factor: ('+'|'-'|'~') factor | power power: atom_expr ['**' factor] - atom_expr: ['await'] atom trailer* + atom_expr: [AWAIT] atom trailer* yield_expr: 'yield' [yield_arg] */ @@ -3233,6 +3268,13 @@ ast_for_expr_stmt(struct compiling *c, const node *n) node *deep, *ann = CHILD(n, 1); int simple = 1; + /* AnnAssigns are only allowed in Python 3.6 or greater */ + if (c->c_feature_version < 6) { + ast_error(c, ch, + "Variable annotation syntax is only supported in Python 3.6 and greater"); + return NULL; + } + /* we keep track of parens to qualify (x) as expression not name */ deep = ch; while (NCH(deep) == 1) { @@ -4050,6 +4092,13 @@ ast_for_for_stmt(struct compiling *c, const node *n0, bool is_async) int end_lineno, end_col_offset; int has_type_comment; string type_comment; + + if (is_async && c->c_feature_version < 5) { + ast_error(c, n, + "Async for loops are only supported in Python 3.5 and greater"); + return NULL; + } + /* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */ REQ(n, for_stmt); @@ -4278,6 +4327,12 @@ ast_for_with_stmt(struct compiling *c, const node *n0, bool is_async) asdl_seq *items, *body; string type_comment; + if (is_async && c->c_feature_version < 5) { + ast_error(c, n, + "Async with statements are only supported in Python 3.5 and greater"); + return NULL; + } + REQ(n, with_stmt); has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT; @@ -4768,6 +4823,7 @@ fstring_compile_expr(const char *expr_start, const char *expr_end, str[len+2] = 0; cf.cf_flags = PyCF_ONLY_AST; + cf.cf_feature_version = PY_MINOR_VERSION; mod_n = PyParser_SimpleParseStringFlagsFilename(str, "<fstring>", Py_eval_input, 0); if (!mod_n) { @@ -5333,18 +5389,57 @@ FstringParser_Dealloc(FstringParser *state) ExprList_Dealloc(&state->expr_list); } +/* Constants for the following */ +static PyObject *u_kind; + +/* Compute 'kind' field for string Constant (either 'u' or None) */ +static PyObject * +make_kind(struct compiling *c, const node *n) +{ + char *s = NULL; + PyObject *kind = NULL; + + /* Find the first string literal, if any */ + while (TYPE(n) != STRING) { + if (NCH(n) == 0) + return NULL; + n = CHILD(n, 0); + } + REQ(n, STRING); + + /* If it starts with 'u', return a PyUnicode "u" string */ + s = STR(n); + if (s && *s == 'u') { + if (!u_kind) { + u_kind = PyUnicode_InternFromString("u"); + if (!u_kind) + return NULL; + } + kind = u_kind; + if (PyArena_AddPyObject(c->c_arena, kind) < 0) { + return NULL; + } + Py_INCREF(kind); + } + return kind; +} + /* Make a Constant node, but decref the PyUnicode object being added. */ static expr_ty make_str_node_and_del(PyObject **str, struct compiling *c, const node* n) { PyObject *s = *str; + PyObject *kind = NULL; *str = NULL; assert(PyUnicode_CheckExact(s)); if (PyArena_AddPyObject(c->c_arena, s) < 0) { Py_DECREF(s); return NULL; } - return Constant(s, LINENO(n), n->n_col_offset, + kind = make_kind(c, n); + if (kind == NULL && PyErr_Occurred()) + return NULL; + return Constant(s, kind, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); } @@ -5568,6 +5663,13 @@ parsestr(struct compiling *c, const node *n, int *bytesmode, int *rawmode, } } } + + /* fstrings are only allowed in Python 3.6 and greater */ + if (fmode && c->c_feature_version < 6) { + ast_error(c, n, "Format strings are only supported in Python 3.6 and greater"); + return -1; + } + if (fmode && *bytesmode) { PyErr_BadInternalCall(); return -1; @@ -5712,7 +5814,7 @@ parsestrplus(struct compiling *c, const node *n) /* Just return the bytes object and we're done. */ if (PyArena_AddPyObject(c->c_arena, bytes_str) < 0) goto error; - return Constant(bytes_str, LINENO(n), n->n_col_offset, + return Constant(bytes_str, NULL, LINENO(n), n->n_col_offset, n->n_end_lineno, n->n_end_col_offset, c->c_arena); } diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index a19b8b8ddc..7a2b259cbd 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -745,6 +745,7 @@ compile as builtin_compile flags: int = 0 dont_inherit: bool(accept={int}) = False optimize: int = -1 + feature_version: int = -1 Compile source into a code object that can be executed by exec() or eval(). @@ -763,8 +764,8 @@ in addition to any features explicitly specified. static PyObject * builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, - int optimize) -/*[clinic end generated code: output=1fa176e33452bb63 input=0ff726f595eb9fcd]*/ + int optimize, int feature_version) +/*[clinic end generated code: output=b0c09c84f116d3d7 input=5fcc30651a6acaa9]*/ { PyObject *source_copy; const char *str; @@ -775,6 +776,10 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, PyObject *result; cf.cf_flags = flags | PyCF_SOURCE_IS_UTF8; + cf.cf_feature_version = PY_MINOR_VERSION; + if (feature_version >= 0 && (flags & PyCF_ONLY_AST)) { + cf.cf_feature_version = feature_version; + } if (flags & ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST | PyCF_TYPE_COMMENTS)) @@ -981,6 +986,7 @@ builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals, } cf.cf_flags = PyCF_SOURCE_IS_UTF8; + cf.cf_feature_version = PY_MINOR_VERSION; str = source_as_string(source, "eval", "string, bytes or code", &cf, &source_copy); if (str == NULL) return NULL; @@ -1068,6 +1074,7 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, const char *str; PyCompilerFlags cf; cf.cf_flags = PyCF_SOURCE_IS_UTF8; + cf.cf_feature_version = PY_MINOR_VERSION; str = source_as_string(source, "exec", "string, bytes or code", &cf, &source_copy); diff --git a/Python/ceval.c b/Python/ceval.c index b311248c6a..28e923219d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -169,23 +169,34 @@ PyEval_ThreadsInitialized(void) void PyEval_InitThreads(void) { - if (gil_created()) + if (gil_created()) { return; + } + PyThread_init_thread(); create_gil(); take_gil(_PyThreadState_GET()); - _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); - if (!_PyRuntime.ceval.pending.lock) - _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + if (_PyRuntime.ceval.pending.lock == NULL) { + Py_FatalError("Can't initialize threads for pending calls"); + } } void _PyEval_FiniThreads(void) { - if (!gil_created()) + if (!gil_created()) { return; + } + destroy_gil(); assert(!gil_created()); + + if (_PyRuntime.ceval.pending.lock != NULL) { + PyThread_free_lock(_PyRuntime.ceval.pending.lock); + _PyRuntime.ceval.pending.lock = NULL; + } } void @@ -243,9 +254,12 @@ PyEval_ReInitThreads(void) if (!gil_created()) return; recreate_gil(); - _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); take_gil(current_tstate); - _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); + + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + if (_PyRuntime.ceval.pending.lock == NULL) { + Py_FatalError("Can't initialize threads for pending calls"); + } /* Destroy all threads except the current one */ _PyThreadState_DeleteExcept(current_tstate); @@ -323,6 +337,37 @@ _PyEval_SignalReceived(void) SIGNAL_PENDING_SIGNALS(); } +/* Push one item onto the queue while holding the lock. */ +static int +_push_pending_call(struct _pending_calls *pending, + int (*func)(void *), void *arg) +{ + int i = pending->last; + int j = (i + 1) % NPENDINGCALLS; + if (j == pending->first) { + return -1; /* Queue full */ + } + pending->calls[i].func = func; + pending->calls[i].arg = arg; + pending->last = j; + return 0; +} + +/* Pop one item off the queue while holding the lock. */ +static void +_pop_pending_call(struct _pending_calls *pending, + int (**func)(void *), void **arg) +{ + int i = pending->first; + if (i == pending->last) { + return; /* Queue empty */ + } + + *func = pending->calls[i].func; + *arg = pending->calls[i].arg; + pending->first = (i + 1) % NPENDINGCALLS; +} + /* This implementation is thread-safe. It allows scheduling to be made from any thread, and even from an executing callback. @@ -331,52 +376,36 @@ _PyEval_SignalReceived(void) int Py_AddPendingCall(int (*func)(void *), void *arg) { - int i, j, result=0; - PyThread_type_lock lock = _PyRuntime.ceval.pending.lock; - - /* try a few times for the lock. Since this mechanism is used - * for signal handling (on the main thread), there is a (slim) - * chance that a signal is delivered on the same thread while we - * hold the lock during the Py_MakePendingCalls() function. - * This avoids a deadlock in that case. - * Note that signals can be delivered on any thread. In particular, - * on Windows, a SIGINT is delivered on a system-created worker - * thread. - * We also check for lock being NULL, in the unlikely case that - * this function is called before any bytecode evaluation takes place. - */ - if (lock != NULL) { - for (i = 0; i<100; i++) { - if (PyThread_acquire_lock(lock, NOWAIT_LOCK)) - break; - } - if (i == 100) - return -1; - } + struct _pending_calls *pending = &_PyRuntime.ceval.pending; - i = _PyRuntime.ceval.pending.last; - j = (i + 1) % NPENDINGCALLS; - if (j == _PyRuntime.ceval.pending.first) { - result = -1; /* Queue full */ - } else { - _PyRuntime.ceval.pending.calls[i].func = func; - _PyRuntime.ceval.pending.calls[i].arg = arg; - _PyRuntime.ceval.pending.last = j; + PyThread_acquire_lock(pending->lock, WAIT_LOCK); + if (pending->finishing) { + PyThread_release_lock(pending->lock); + + PyObject *exc, *val, *tb; + PyErr_Fetch(&exc, &val, &tb); + PyErr_SetString(PyExc_SystemError, + "Py_AddPendingCall: cannot add pending calls " + "(Python shutting down)"); + PyErr_Print(); + PyErr_Restore(exc, val, tb); + return -1; } + int result = _push_pending_call(pending, func, arg); + PyThread_release_lock(pending->lock); + /* signal main loop */ SIGNAL_PENDING_CALLS(); - if (lock != NULL) - PyThread_release_lock(lock); return result; } static int handle_signals(void) { - /* Only handle signals on main thread. */ - if (_PyRuntime.ceval.pending.main_thread && - PyThread_get_thread_ident() != _PyRuntime.ceval.pending.main_thread) - { + /* Only handle signals on main thread. PyEval_InitThreads must + * have been called already. + */ + if (PyThread_get_thread_ident() != _PyRuntime.main_thread) { return 0; } /* @@ -396,14 +425,12 @@ handle_signals(void) } static int -make_pending_calls(void) +make_pending_calls(struct _pending_calls* pending) { static int busy = 0; /* only service pending calls on main thread */ - if (_PyRuntime.ceval.pending.main_thread && - PyThread_get_thread_ident() != _PyRuntime.ceval.pending.main_thread) - { + if (PyThread_get_thread_ident() != _PyRuntime.main_thread) { return 0; } @@ -417,35 +444,20 @@ make_pending_calls(void) UNSIGNAL_PENDING_CALLS(); int res = 0; - if (!_PyRuntime.ceval.pending.lock) { - /* initial allocation of the lock */ - _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); - if (_PyRuntime.ceval.pending.lock == NULL) { - res = -1; - goto error; - } - } - /* perform a bounded number of calls, in case of recursion */ for (int i=0; i<NPENDINGCALLS; i++) { - int j; - int (*func)(void *); + int (*func)(void *) = NULL; void *arg = NULL; /* pop one item off the queue while holding the lock */ - PyThread_acquire_lock(_PyRuntime.ceval.pending.lock, WAIT_LOCK); - j = _PyRuntime.ceval.pending.first; - if (j == _PyRuntime.ceval.pending.last) { - func = NULL; /* Queue empty */ - } else { - func = _PyRuntime.ceval.pending.calls[j].func; - arg = _PyRuntime.ceval.pending.calls[j].arg; - _PyRuntime.ceval.pending.first = (j + 1) % NPENDINGCALLS; - } - PyThread_release_lock(_PyRuntime.ceval.pending.lock); + PyThread_acquire_lock(pending->lock, WAIT_LOCK); + _pop_pending_call(pending, &func, &arg); + PyThread_release_lock(pending->lock); + /* having released the lock, perform the callback */ - if (func == NULL) + if (func == NULL) { break; + } res = func(arg); if (res) { goto error; @@ -461,6 +473,30 @@ error: return res; } +void +_Py_FinishPendingCalls(void) +{ + struct _pending_calls *pending = &_PyRuntime.ceval.pending; + + assert(PyGILState_Check()); + + PyThread_acquire_lock(pending->lock, WAIT_LOCK); + pending->finishing = 1; + PyThread_release_lock(pending->lock); + + if (!_Py_atomic_load_relaxed(&(pending->calls_to_do))) { + return; + } + + if (make_pending_calls(pending) < 0) { + PyObject *exc, *val, *tb; + PyErr_Fetch(&exc, &val, &tb); + PyErr_BadInternalCall(); + _PyErr_ChainExceptions(exc, val, tb); + PyErr_Print(); + } +} + /* Py_MakePendingCalls() is a simple wrapper for the sake of backward-compatibility. */ int @@ -475,7 +511,7 @@ Py_MakePendingCalls(void) return res; } - res = make_pending_calls(); + res = make_pending_calls(&_PyRuntime.ceval.pending); if (res != 0) { return res; } @@ -602,6 +638,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) PyObject **fastlocals, **freevars; PyObject *retval = NULL; /* Return value */ PyThreadState *tstate = _PyThreadState_GET(); + _Py_atomic_int *eval_breaker = &_PyRuntime.ceval.eval_breaker; PyCodeObject *co; /* when tracing we set things up so that @@ -687,7 +724,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) #define DISPATCH() \ { \ - if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \ + if (!_Py_atomic_load_relaxed(eval_breaker)) { \ FAST_DISPATCH(); \ } \ continue; \ @@ -989,7 +1026,7 @@ main_loop: async I/O handler); see Py_AddPendingCall() and Py_MakePendingCalls() above. */ - if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { + if (_Py_atomic_load_relaxed(eval_breaker)) { opcode = _Py_OPCODE(*next_instr); if (opcode == SETUP_FINALLY || opcode == SETUP_WITH || @@ -1024,7 +1061,7 @@ main_loop: if (_Py_atomic_load_relaxed( &_PyRuntime.ceval.pending.calls_to_do)) { - if (make_pending_calls() != 0) { + if (make_pending_calls(&_PyRuntime.ceval.pending) != 0) { goto error; } } @@ -4911,7 +4948,7 @@ import_from(PyObject *v, PyObject *name) } x = PyImport_GetModule(fullmodname); Py_DECREF(fullmodname); - if (x == NULL) { + if (x == NULL && !PyErr_Occurred()) { goto error; } Py_DECREF(pkgname); @@ -4934,7 +4971,7 @@ import_from(PyObject *v, PyObject *name) "cannot import name %R from %R (unknown location)", name, pkgname_or_unknown ); - /* NULL check for errmsg done by PyErr_SetImportError. */ + /* NULL checks for errmsg and pkgname done by PyErr_SetImportError. */ PyErr_SetImportError(errmsg, pkgname, NULL); } else { @@ -4942,7 +4979,7 @@ import_from(PyObject *v, PyObject *name) "cannot import name %R from %R (%S)", name, pkgname_or_unknown, pkgpath ); - /* NULL check for errmsg done by PyErr_SetImportError. */ + /* NULL checks for errmsg and pkgname done by PyErr_SetImportError. */ PyErr_SetImportError(errmsg, pkgname, pkgpath); } diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h index d1e50de7d9..67ab0e3d9d 100644 --- a/Python/clinic/_warnings.c.h +++ b/Python/clinic/_warnings.c.h @@ -20,19 +20,55 @@ warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec { PyObject *return_value = NULL; static const char * const _keywords[] = {"message", "category", "stacklevel", "source", NULL}; - static _PyArg_Parser _parser = {"O|OnO:warn", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "warn", 0}; + PyObject *argsbuf[4]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; PyObject *message; PyObject *category = Py_None; Py_ssize_t stacklevel = 1; PyObject *source = Py_None; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &message, &category, &stacklevel, &source)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); + if (!args) { goto exit; } + message = args[0]; + if (!noptargs) { + goto skip_optional_pos; + } + if (args[1]) { + category = args[1]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[2]) { + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[2]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + stacklevel = ival; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + source = args[3]; +skip_optional_pos: return_value = warnings_warn_impl(module, message, category, stacklevel, source); exit: return return_value; } -/*[clinic end generated code: output=a4fbe6e2d1cc2091 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/ diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h index 1b82f773ed..0ed11bceeb 100644 --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -151,7 +151,7 @@ exit: PyDoc_STRVAR(builtin_compile__doc__, "compile($module, /, source, filename, mode, flags=0,\n" -" dont_inherit=False, optimize=-1)\n" +" dont_inherit=False, optimize=-1, feature_version=-1)\n" "--\n" "\n" "Compile source into a code object that can be executed by exec() or eval().\n" @@ -173,26 +173,101 @@ PyDoc_STRVAR(builtin_compile__doc__, static PyObject * builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, - int optimize); + int optimize, int feature_version); static PyObject * builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL}; - static _PyArg_Parser _parser = {"OO&s|iii:compile", _keywords, 0}; + static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", "feature_version", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "compile", 0}; + PyObject *argsbuf[7]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; PyObject *source; PyObject *filename; const char *mode; int flags = 0; int dont_inherit = 0; int optimize = -1; + int feature_version = -1; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 7, 0, argsbuf); + if (!args) { goto exit; } - return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize); + source = args[0]; + if (!PyUnicode_FSDecoder(args[1], &filename)) { + goto exit; + } + if (!PyUnicode_Check(args[2])) { + _PyArg_BadArgument("compile", 3, "str", args[2]); + goto exit; + } + Py_ssize_t mode_length; + mode = PyUnicode_AsUTF8AndSize(args[2], &mode_length); + if (mode == NULL) { + goto exit; + } + if (strlen(mode) != (size_t)mode_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (args[3]) { + if (PyFloat_Check(args[3])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + flags = _PyLong_AsInt(args[3]); + if (flags == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[4]) { + if (PyFloat_Check(args[4])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + dont_inherit = _PyLong_AsInt(args[4]); + if (dont_inherit == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[5]) { + if (PyFloat_Check(args[5])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + optimize = _PyLong_AsInt(args[5]); + if (optimize == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (PyFloat_Check(args[6])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + feature_version = _PyLong_AsInt(args[6]); + if (feature_version == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: + return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version); exit: return return_value; @@ -636,14 +711,22 @@ builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec { PyObject *return_value = NULL; static const char * const _keywords[] = {"number", "ndigits", NULL}; - static _PyArg_Parser _parser = {"O|O:round", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "round", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; PyObject *number; PyObject *ndigits = NULL; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &number, &ndigits)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); + if (!args) { goto exit; } + number = args[0]; + if (!noptargs) { + goto skip_optional_pos; + } + ndigits = args[1]; +skip_optional_pos: return_value = builtin_round_impl(module, number, ndigits); exit: @@ -671,14 +754,22 @@ builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject { PyObject *return_value = NULL; static const char * const _keywords[] = {"", "start", NULL}; - static _PyArg_Parser _parser = {"O|O:sum", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "sum", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; PyObject *iterable; PyObject *start = NULL; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &iterable, &start)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); + if (!args) { goto exit; } + iterable = args[0]; + if (!noptargs) { + goto skip_optional_pos; + } + start = args[1]; +skip_optional_pos: return_value = builtin_sum_impl(module, iterable, start); exit: @@ -754,4 +845,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) exit: return return_value; } -/*[clinic end generated code: output=54e5e33dcc2659e0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3f690311ac556c31 input=a9049054013a1b77]*/ diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h index 9ee20fbe50..05e3106bb3 100644 --- a/Python/clinic/import.c.h +++ b/Python/clinic/import.c.h @@ -411,12 +411,29 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb { PyObject *return_value = NULL; static const char * const _keywords[] = {"key", "source", NULL}; - static _PyArg_Parser _parser = {"ly*:source_hash", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "source_hash", 0}; + PyObject *argsbuf[2]; long key; Py_buffer source = {NULL, NULL}; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &key, &source)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + key = PyLong_AsLong(args[0]); + if (key == -1 && PyErr_Occurred()) { + goto exit; + } + if (PyObject_GetBuffer(args[1], &source, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&source, 'C')) { + _PyArg_BadArgument("source_hash", 2, "contiguous buffer", args[1]); goto exit; } return_value = _imp_source_hash_impl(module, key, &source); @@ -437,4 +454,4 @@ exit: #ifndef _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=2409b8feeafe7c4b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b51244770fdcf4b8 input=a9049054013a1b77]*/ diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index fc9794bf25..c70b721983 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -410,11 +410,21 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, { PyObject *return_value = NULL; static const char * const _keywords[] = {"depth", NULL}; - static _PyArg_Parser _parser = {"i:set_coroutine_origin_tracking_depth", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "set_coroutine_origin_tracking_depth", 0}; + PyObject *argsbuf[1]; int depth; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &depth)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + depth = _PyLong_AsInt(args[0]); + if (depth == -1 && PyErr_Occurred()) { goto exit; } return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth); @@ -1050,4 +1060,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=109787af3401cd27 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3ba4c194d00f1866 input=a9049054013a1b77]*/ diff --git a/Python/clinic/traceback.c.h b/Python/clinic/traceback.c.h index d9daccbbb7..2815f65d3d 100644 --- a/Python/clinic/traceback.c.h +++ b/Python/clinic/traceback.c.h @@ -17,14 +17,41 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL}; - static _PyArg_Parser _parser = {"OO!ii:TracebackType", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "TracebackType", 0}; + PyObject *argsbuf[4]; + PyObject * const *fastargs; + Py_ssize_t nargs = PyTuple_GET_SIZE(args); PyObject *tb_next; PyFrameObject *tb_frame; int tb_lasti; int tb_lineno; - if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, - &tb_next, &PyFrame_Type, &tb_frame, &tb_lasti, &tb_lineno)) { + fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf); + if (!fastargs) { + goto exit; + } + tb_next = fastargs[0]; + if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) { + _PyArg_BadArgument("TracebackType", 2, (&PyFrame_Type)->tp_name, fastargs[1]); + goto exit; + } + tb_frame = (PyFrameObject *)fastargs[1]; + if (PyFloat_Check(fastargs[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + tb_lasti = _PyLong_AsInt(fastargs[2]); + if (tb_lasti == -1 && PyErr_Occurred()) { + goto exit; + } + if (PyFloat_Check(fastargs[3])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + tb_lineno = _PyLong_AsInt(fastargs[3]); + if (tb_lineno == -1 && PyErr_Occurred()) { goto exit; } return_value = tb_new_impl(type, tb_next, tb_frame, tb_lasti, tb_lineno); @@ -32,4 +59,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=0133130d7d19556f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7e4c0e252d0973b0 input=a9049054013a1b77]*/ diff --git a/Python/compile.c b/Python/compile.c index c26210675d..a992e4b465 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -330,6 +330,7 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags, goto finally; if (!flags) { local_flags.cf_flags = 0; + local_flags.cf_feature_version = PY_MINOR_VERSION; flags = &local_flags; } merged = c.c_future->ff_features | flags->cf_flags; @@ -1209,7 +1210,7 @@ merge_consts_recursive(struct compiler *c, PyObject *o) PyObject *t = PyDict_SetDefault(c->c_const_cache, key, key); if (t != key) { // o is registered in c_const_cache. Just use it. - Py_INCREF(t); + Py_XINCREF(t); Py_DECREF(key); return t; } @@ -3878,6 +3879,7 @@ check_index(struct compiler *c, expr_ty e, slice_ty s) } } +// Return 1 if the method call was optimized, -1 if not, and 0 on error. static int maybe_optimize_method_call(struct compiler *c, expr_ty e) { @@ -3911,8 +3913,10 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e) static int compiler_call(struct compiler *c, expr_ty e) { - if (maybe_optimize_method_call(c, e) > 0) - return 1; + int ret = maybe_optimize_method_call(c, e); + if (ret >= 0) { + return ret; + } if (!check_caller(c, e->v.Call.func)) { return 0; } diff --git a/Python/coreconfig.c b/Python/coreconfig.c index cd4ef22ff6..13aa227201 100644 --- a/Python/coreconfig.c +++ b/Python/coreconfig.c @@ -5,6 +5,7 @@ #include "pycore_getopt.h" #include "pycore_pylifecycle.h" #include "pycore_pymem.h" +#include "pycore_pystate.h" /* _PyRuntime */ #include "pycore_pathconfig.h" #include <locale.h> /* setlocale() */ #ifdef HAVE_LANGINFO_H @@ -130,7 +131,7 @@ int Py_LegacyWindowsStdioFlag = 0; /* Uses FileIO instead of WindowsConsoleIO */ #endif -PyObject * +static PyObject * _Py_GetGlobalVariablesAsDict(void) { PyObject *dict, *obj; @@ -202,81 +203,140 @@ fail: } -/* --- _Py_wstrlist ----------------------------------------------- */ +/* --- _PyWstrList ------------------------------------------------ */ + +#ifndef NDEBUG +int +_PyWstrList_CheckConsistency(const _PyWstrList *list) +{ + assert(list->length >= 0); + if (list->length != 0) { + assert(list->items != NULL); + } + for (Py_ssize_t i = 0; i < list->length; i++) { + assert(list->items[i] != NULL); + } + return 1; +} +#endif /* Py_DEBUG */ + void -_Py_wstrlist_clear(int len, wchar_t **list) +_PyWstrList_Clear(_PyWstrList *list) { - for (int i=0; i < len; i++) { - PyMem_RawFree(list[i]); + assert(_PyWstrList_CheckConsistency(list)); + for (Py_ssize_t i=0; i < list->length; i++) { + PyMem_RawFree(list->items[i]); } - PyMem_RawFree(list); + PyMem_RawFree(list->items); + list->length = 0; + list->items = NULL; } -wchar_t** -_Py_wstrlist_copy(int len, wchar_t * const *list) +int +_PyWstrList_Copy(_PyWstrList *list, const _PyWstrList *list2) { - assert((len > 0 && list != NULL) || len == 0); - size_t size = len * sizeof(list[0]); - wchar_t **list_copy = PyMem_RawMalloc(size); - if (list_copy == NULL) { - return NULL; + assert(_PyWstrList_CheckConsistency(list)); + assert(_PyWstrList_CheckConsistency(list2)); + + if (list2->length == 0) { + _PyWstrList_Clear(list); + return 0; } - for (int i=0; i < len; i++) { - wchar_t* arg = _PyMem_RawWcsdup(list[i]); - if (arg == NULL) { - _Py_wstrlist_clear(i, list_copy); - return NULL; + + _PyWstrList copy = _PyWstrList_INIT; + + size_t size = list2->length * sizeof(list2->items[0]); + copy.items = PyMem_RawMalloc(size); + if (copy.items == NULL) { + return -1; + } + + for (Py_ssize_t i=0; i < list2->length; i++) { + wchar_t *item = _PyMem_RawWcsdup(list2->items[i]); + if (item == NULL) { + _PyWstrList_Clear(©); + return -1; } - list_copy[i] = arg; + copy.items[i] = item; + copy.length = i + 1; } - return list_copy; + + _PyWstrList_Clear(list); + *list = copy; + return 0; } -_PyInitError -_Py_wstrlist_append(int *len, wchar_t ***list, const wchar_t *str) +int +_PyWstrList_Append(_PyWstrList *list, const wchar_t *item) { - if (*len == INT_MAX) { - /* len+1 would overflow */ - return _Py_INIT_NO_MEMORY(); + if (list->length == PY_SSIZE_T_MAX) { + /* lenght+1 would overflow */ + return -1; } - wchar_t *str2 = _PyMem_RawWcsdup(str); - if (str2 == NULL) { - return _Py_INIT_NO_MEMORY(); + + wchar_t *item2 = _PyMem_RawWcsdup(item); + if (item2 == NULL) { + return -1; } - size_t size = (*len + 1) * sizeof(list[0]); - wchar_t **list2 = (wchar_t **)PyMem_RawRealloc(*list, size); - if (list2 == NULL) { - PyMem_RawFree(str2); - return _Py_INIT_NO_MEMORY(); + size_t size = (list->length + 1) * sizeof(list->items[0]); + wchar_t **items2 = (wchar_t **)PyMem_RawRealloc(list->items, size); + if (items2 == NULL) { + PyMem_RawFree(item2); + return -1; } - list2[*len] = str2; - *list = list2; - (*len)++; - return _Py_INIT_OK(); + + items2[list->length] = item2; + list->items = items2; + list->length++; + return 0; +} + + +int +_PyWstrList_Extend(_PyWstrList *list, const _PyWstrList *list2) +{ + for (Py_ssize_t i = 0; i < list2->length; i++) { + if (_PyWstrList_Append(list, list2->items[i])) { + return -1; + } + } + return 0; +} + + +static int +_PyWstrList_Find(_PyWstrList *list, const wchar_t *item) +{ + for (Py_ssize_t i = 0; i < list->length; i++) { + if (wcscmp(list->items[i], item) == 0) { + return 1; + } + } + return 0; } PyObject* -_Py_wstrlist_as_pylist(int len, wchar_t **list) +_PyWstrList_AsList(const _PyWstrList *list) { - assert(list != NULL || len < 1); + assert(_PyWstrList_CheckConsistency(list)); - PyObject *pylist = PyList_New(len); + PyObject *pylist = PyList_New(list->length); if (pylist == NULL) { return NULL; } - for (int i = 0; i < len; i++) { - PyObject *v = PyUnicode_FromWideChar(list[i], -1); - if (v == NULL) { + for (Py_ssize_t i = 0; i < list->length; i++) { + PyObject *item = PyUnicode_FromWideChar(list->items[i], -1); + if (item == NULL) { Py_DECREF(pylist); return NULL; } - PyList_SET_ITEM(pylist, i, v); + PyList_SET_ITEM(pylist, i, item); } return pylist; } @@ -369,8 +429,7 @@ _Py_ClearStandardStreamEncoding(void) /* --- Py_GetArgcArgv() ------------------------------------------- */ /* For Py_GetArgcArgv(); set by _Py_SetArgcArgv() */ -static int orig_argc = 0; -static wchar_t **orig_argv = NULL; +static _PyWstrList orig_argv = {.length = 0, .items = NULL}; void @@ -379,32 +438,22 @@ _Py_ClearArgcArgv(void) PyMemAllocatorEx old_alloc; _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); - _Py_wstrlist_clear(orig_argc, orig_argv); - orig_argc = 0; - orig_argv = NULL; + _PyWstrList_Clear(&orig_argv); PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } static int -_Py_SetArgcArgv(int argc, wchar_t * const *argv) +_Py_SetArgcArgv(Py_ssize_t argc, wchar_t * const *argv) { + const _PyWstrList argv_list = {.length = argc, .items = (wchar_t **)argv}; int res; PyMemAllocatorEx old_alloc; _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); - wchar_t **argv_copy = _Py_wstrlist_copy(argc, argv); - if (argv_copy != NULL) { - _Py_ClearArgcArgv(); - orig_argc = argc; - orig_argv = argv_copy; - res = 0; - } - else { - res = -1; - } + res = _PyWstrList_Copy(&orig_argv, &argv_list); PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); return res; @@ -416,8 +465,8 @@ _Py_SetArgcArgv(int argc, wchar_t * const *argv) void Py_GetArgcArgv(int *argc, wchar_t ***argv) { - *argc = orig_argc; - *argv = orig_argv; + *argc = (int)orig_argv.length; + *argv = orig_argv.items; } @@ -432,19 +481,11 @@ Py_GetArgcArgv(int *argc, wchar_t ***argv) void _PyCoreConfig_Clear(_PyCoreConfig *config) { - _PyPreConfig_Clear(&config->preconfig); - #define CLEAR(ATTR) \ do { \ PyMem_RawFree(ATTR); \ ATTR = NULL; \ } while (0) -#define CLEAR_WSTRLIST(LEN, LIST) \ - do { \ - _Py_wstrlist_clear(LEN, LIST); \ - LEN = 0; \ - LIST = NULL; \ - } while (0) CLEAR(config->pycache_prefix); CLEAR(config->module_search_path_env); @@ -452,13 +493,11 @@ _PyCoreConfig_Clear(_PyCoreConfig *config) CLEAR(config->program_name); CLEAR(config->program); - CLEAR_WSTRLIST(config->argc, config->argv); - config->argc = -1; - - CLEAR_WSTRLIST(config->nwarnoption, config->warnoptions); - CLEAR_WSTRLIST(config->nxoption, config->xoptions); - CLEAR_WSTRLIST(config->nmodule_search_path, config->module_search_paths); - config->nmodule_search_path = -1; + _PyWstrList_Clear(&config->argv); + _PyWstrList_Clear(&config->warnoptions); + _PyWstrList_Clear(&config->xoptions); + _PyWstrList_Clear(&config->module_search_paths); + config->use_module_search_paths = 0; CLEAR(config->executable); CLEAR(config->prefix); @@ -477,7 +516,6 @@ _PyCoreConfig_Clear(_PyCoreConfig *config) CLEAR(config->run_module); CLEAR(config->run_filename); #undef CLEAR -#undef CLEAR_WSTRLIST } @@ -486,10 +524,6 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) { _PyCoreConfig_Clear(config); - if (_PyPreConfig_Copy(&config->preconfig, &config2->preconfig) < 0) { - return -1; - } - #define COPY_ATTR(ATTR) config->ATTR = config2->ATTR #define COPY_STR_ATTR(ATTR) \ do { \ @@ -509,17 +543,16 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) } \ } \ } while (0) -#define COPY_WSTRLIST(LEN, LIST) \ +#define COPY_WSTRLIST(LIST) \ do { \ - if (config2->LIST != NULL) { \ - config->LIST = _Py_wstrlist_copy(config2->LEN, config2->LIST); \ - if (config->LIST == NULL) { \ - return -1; \ - } \ + if (_PyWstrList_Copy(&config->LIST, &config2->LIST) < 0 ) { \ + return -1; \ } \ - config->LEN = config2->LEN; \ } while (0) + COPY_ATTR(isolated); + COPY_ATTR(use_environment); + COPY_ATTR(dev_mode); COPY_ATTR(install_signal_handlers); COPY_ATTR(use_hash_seed); COPY_ATTR(hash_seed); @@ -538,10 +571,11 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) COPY_WSTR_ATTR(program_name); COPY_WSTR_ATTR(program); - COPY_WSTRLIST(argc, argv); - COPY_WSTRLIST(nwarnoption, warnoptions); - COPY_WSTRLIST(nxoption, xoptions); - COPY_WSTRLIST(nmodule_search_path, module_search_paths); + COPY_WSTRLIST(argv); + COPY_WSTRLIST(warnoptions); + COPY_WSTRLIST(xoptions); + COPY_WSTRLIST(module_search_paths); + COPY_ATTR(use_module_search_paths); COPY_WSTR_ATTR(executable); COPY_WSTR_ATTR(prefix); @@ -576,6 +610,7 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) COPY_WSTR_ATTR(run_filename); COPY_ATTR(_check_hash_pycs_mode); COPY_ATTR(_frozen); + COPY_ATTR(_init_main); #undef COPY_ATTR #undef COPY_STR_ATTR @@ -585,21 +620,139 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) } -const char* +static PyObject * +_PyCoreConfig_AsDict(const _PyCoreConfig *config) +{ + PyObject *dict; + + dict = PyDict_New(); + if (dict == NULL) { + return NULL; + } + +#define SET_ITEM(KEY, EXPR) \ + do { \ + PyObject *obj = (EXPR); \ + if (obj == NULL) { \ + goto fail; \ + } \ + int res = PyDict_SetItemString(dict, (KEY), obj); \ + Py_DECREF(obj); \ + if (res < 0) { \ + goto fail; \ + } \ + } while (0) +#define FROM_STRING(STR) \ + ((STR != NULL) ? \ + PyUnicode_FromString(STR) \ + : (Py_INCREF(Py_None), Py_None)) +#define SET_ITEM_INT(ATTR) \ + SET_ITEM(#ATTR, PyLong_FromLong(config->ATTR)) +#define SET_ITEM_UINT(ATTR) \ + SET_ITEM(#ATTR, PyLong_FromUnsignedLong(config->ATTR)) +#define SET_ITEM_STR(ATTR) \ + SET_ITEM(#ATTR, FROM_STRING(config->ATTR)) +#define FROM_WSTRING(STR) \ + ((STR != NULL) ? \ + PyUnicode_FromWideChar(STR, -1) \ + : (Py_INCREF(Py_None), Py_None)) +#define SET_ITEM_WSTR(ATTR) \ + SET_ITEM(#ATTR, FROM_WSTRING(config->ATTR)) +#define SET_ITEM_WSTRLIST(LIST) \ + SET_ITEM(#LIST, _PyWstrList_AsList(&config->LIST)) + + SET_ITEM_INT(isolated); + SET_ITEM_INT(use_environment); + SET_ITEM_INT(dev_mode); + SET_ITEM_INT(install_signal_handlers); + SET_ITEM_INT(use_hash_seed); + SET_ITEM_UINT(hash_seed); + SET_ITEM_INT(faulthandler); + SET_ITEM_INT(tracemalloc); + SET_ITEM_INT(import_time); + SET_ITEM_INT(show_ref_count); + SET_ITEM_INT(show_alloc_count); + SET_ITEM_INT(dump_refs); + SET_ITEM_INT(malloc_stats); + SET_ITEM_STR(filesystem_encoding); + SET_ITEM_STR(filesystem_errors); + SET_ITEM_WSTR(pycache_prefix); + SET_ITEM_WSTR(program_name); + SET_ITEM_WSTRLIST(argv); + SET_ITEM_WSTR(program); + SET_ITEM_WSTRLIST(xoptions); + SET_ITEM_WSTRLIST(warnoptions); + SET_ITEM_WSTR(module_search_path_env); + SET_ITEM_WSTR(home); + SET_ITEM_WSTRLIST(module_search_paths); + SET_ITEM_WSTR(executable); + SET_ITEM_WSTR(prefix); + SET_ITEM_WSTR(base_prefix); + SET_ITEM_WSTR(exec_prefix); + SET_ITEM_WSTR(base_exec_prefix); +#ifdef MS_WINDOWS + SET_ITEM_WSTR(dll_path); +#endif + SET_ITEM_INT(site_import); + SET_ITEM_INT(bytes_warning); + SET_ITEM_INT(inspect); + SET_ITEM_INT(interactive); + SET_ITEM_INT(optimization_level); + SET_ITEM_INT(parser_debug); + SET_ITEM_INT(write_bytecode); + SET_ITEM_INT(verbose); + SET_ITEM_INT(quiet); + SET_ITEM_INT(user_site_directory); + SET_ITEM_INT(buffered_stdio); + SET_ITEM_STR(stdio_encoding); + SET_ITEM_STR(stdio_errors); +#ifdef MS_WINDOWS + SET_ITEM_INT(legacy_windows_stdio); +#endif + SET_ITEM_INT(skip_source_first_line); + SET_ITEM_WSTR(run_command); + SET_ITEM_WSTR(run_module); + SET_ITEM_WSTR(run_filename); + SET_ITEM_INT(_install_importlib); + SET_ITEM_STR(_check_hash_pycs_mode); + SET_ITEM_INT(_frozen); + SET_ITEM_INT(_init_main); + + return dict; + +fail: + Py_DECREF(dict); + return NULL; + +#undef FROM_STRING +#undef FROM_WSTRING +#undef SET_ITEM +#undef SET_ITEM_INT +#undef SET_ITEM_UINT +#undef SET_ITEM_STR +#undef SET_ITEM_WSTR +#undef SET_ITEM_WSTRLIST +} + + +static const char* _PyCoreConfig_GetEnv(const _PyCoreConfig *config, const char *name) { - return _PyPreConfig_GetEnv(&config->preconfig, name); + return _Py_GetEnv(config->use_environment, name); } -int +/* Get a copy of the environment variable as wchar_t*. + Return 0 on success, but *dest can be NULL. + Return -1 on memory allocation failure. Return -2 on decoding error. */ +static int _PyCoreConfig_GetEnvDup(const _PyCoreConfig *config, wchar_t **dest, wchar_t *wname, char *name) { - assert(config->preconfig.use_environment >= 0); + assert(config->use_environment >= 0); - if (!config->preconfig.use_environment) { + if (!config->use_environment) { *dest = NULL; return 0; } @@ -640,11 +793,9 @@ _PyCoreConfig_GetEnvDup(const _PyCoreConfig *config, } -void +static void _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config) { - _PyPreConfig_GetGlobalConfig(&config->preconfig); - #define COPY_FLAG(ATTR, VALUE) \ if (config->ATTR == -1) { \ config->ATTR = VALUE; \ @@ -654,6 +805,8 @@ _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config) config->ATTR = !(VALUE); \ } + COPY_FLAG(isolated, Py_IsolatedFlag); + COPY_NOT_FLAG(use_environment, Py_IgnoreEnvironmentFlag); COPY_FLAG(bytes_warning, Py_BytesWarningFlag); COPY_FLAG(inspect, Py_InspectFlag); COPY_FLAG(interactive, Py_InteractiveFlag); @@ -677,7 +830,7 @@ _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config) /* Set Py_xxx global configuration variables from 'config' configuration. */ -void +static void _PyCoreConfig_SetGlobalConfig(const _PyCoreConfig *config) { #define COPY_FLAG(ATTR, VAR) \ @@ -689,6 +842,8 @@ _PyCoreConfig_SetGlobalConfig(const _PyCoreConfig *config) VAR = !config->ATTR; \ } + COPY_FLAG(isolated, Py_IsolatedFlag); + COPY_NOT_FLAG(use_environment, Py_IgnoreEnvironmentFlag); COPY_FLAG(bytes_warning, Py_BytesWarningFlag); COPY_FLAG(inspect, Py_InspectFlag); COPY_FLAG(interactive, Py_InteractiveFlag); @@ -817,17 +972,17 @@ config_init_executable(_PyCoreConfig *config) static const wchar_t* config_get_xoption(const _PyCoreConfig *config, wchar_t *name) { - return _Py_get_xoption(config->nxoption, config->xoptions, name); + return _Py_get_xoption(&config->xoptions, name); } static _PyInitError config_init_home(_PyCoreConfig *config) { - wchar_t *home; + assert(config->home == NULL); /* If Py_SetPythonHome() was called, use its value */ - home = _Py_path_config.home; + wchar_t *home = _Py_path_config.home; if (home) { config->home = _PyMem_RawWcsdup(home); if (config->home == NULL) { @@ -899,34 +1054,34 @@ config_wstr_to_int(const wchar_t *wstr, int *result) static _PyInitError config_read_env_vars(_PyCoreConfig *config) { - _PyPreConfig *preconfig = &config->preconfig; + int use_env = config->use_environment; /* Get environment variables */ - _Py_get_env_flag(preconfig, &config->parser_debug, "PYTHONDEBUG"); - _Py_get_env_flag(preconfig, &config->verbose, "PYTHONVERBOSE"); - _Py_get_env_flag(preconfig, &config->optimization_level, "PYTHONOPTIMIZE"); - _Py_get_env_flag(preconfig, &config->inspect, "PYTHONINSPECT"); + _Py_get_env_flag(use_env, &config->parser_debug, "PYTHONDEBUG"); + _Py_get_env_flag(use_env, &config->verbose, "PYTHONVERBOSE"); + _Py_get_env_flag(use_env, &config->optimization_level, "PYTHONOPTIMIZE"); + _Py_get_env_flag(use_env, &config->inspect, "PYTHONINSPECT"); int dont_write_bytecode = 0; - _Py_get_env_flag(preconfig, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE"); + _Py_get_env_flag(use_env, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE"); if (dont_write_bytecode) { config->write_bytecode = 0; } int no_user_site_directory = 0; - _Py_get_env_flag(preconfig, &no_user_site_directory, "PYTHONNOUSERSITE"); + _Py_get_env_flag(use_env, &no_user_site_directory, "PYTHONNOUSERSITE"); if (no_user_site_directory) { config->user_site_directory = 0; } int unbuffered_stdio = 0; - _Py_get_env_flag(preconfig, &unbuffered_stdio, "PYTHONUNBUFFERED"); + _Py_get_env_flag(use_env, &unbuffered_stdio, "PYTHONUNBUFFERED"); if (unbuffered_stdio) { config->buffered_stdio = 0; } #ifdef MS_WINDOWS - _Py_get_env_flag(preconfig, &config->legacy_windows_stdio, + _Py_get_env_flag(use_env, &config->legacy_windows_stdio, "PYTHONLEGACYWINDOWSSTDIO"); #endif @@ -937,13 +1092,15 @@ config_read_env_vars(_PyCoreConfig *config) config->malloc_stats = 1; } - wchar_t *path; - int res = _PyCoreConfig_GetEnvDup(config, &path, - L"PYTHONPATH", "PYTHONPATH"); - if (res < 0) { - return DECODE_LOCALE_ERR("PYTHONPATH", res); + if (config->module_search_path_env == NULL) { + wchar_t *path; + int res = _PyCoreConfig_GetEnvDup(config, &path, + L"PYTHONPATH", "PYTHONPATH"); + if (res < 0) { + return DECODE_LOCALE_ERR("PYTHONPATH", res); + } + config->module_search_path_env = path; } - config->module_search_path_env = path; if (config->use_hash_seed < 0) { _PyInitError err = config_init_hash_seed(config); @@ -1072,7 +1229,7 @@ config_read_complex_options(_PyCoreConfig *config) static const char * -get_stdio_errors(const _PyCoreConfig *config) +config_get_stdio_errors(const _PyCoreConfig *config) { #ifndef MS_WINDOWS const char *loc = setlocale(LC_CTYPE, NULL); @@ -1099,11 +1256,11 @@ get_stdio_errors(const _PyCoreConfig *config) static _PyInitError -get_locale_encoding(char **locale_encoding) +config_get_locale_encoding(char **locale_encoding) { #ifdef MS_WINDOWS char encoding[20]; - PyOS_snprintf(encoding, sizeof(encoding), "cp%d", GetACP()); + PyOS_snprintf(encoding, sizeof(encoding), "cp%u", GetACP()); #elif defined(__ANDROID__) || defined(__VXWORKS__) const char *encoding = "UTF-8"; #else @@ -1122,7 +1279,8 @@ get_locale_encoding(char **locale_encoding) static _PyInitError -config_init_stdio_encoding(_PyCoreConfig *config) +config_init_stdio_encoding(_PyCoreConfig *config, + const _PyPreConfig *preconfig) { /* If Py_SetStandardStreamEncoding() have been called, use these parameters. */ @@ -1192,7 +1350,7 @@ config_init_stdio_encoding(_PyCoreConfig *config) } /* UTF-8 Mode uses UTF-8/surrogateescape */ - if (config->preconfig.utf8_mode) { + if (preconfig->utf8_mode) { if (config->stdio_encoding == NULL) { config->stdio_encoding = _PyMem_RawStrdup("utf-8"); if (config->stdio_encoding == NULL) { @@ -1209,13 +1367,13 @@ config_init_stdio_encoding(_PyCoreConfig *config) /* Choose the default error handler based on the current locale. */ if (config->stdio_encoding == NULL) { - _PyInitError err = get_locale_encoding(&config->stdio_encoding); + _PyInitError err = config_get_locale_encoding(&config->stdio_encoding); if (_Py_INIT_FAILED(err)) { return err; } } if (config->stdio_errors == NULL) { - const char *errors = get_stdio_errors(config); + const char *errors = config_get_stdio_errors(config); config->stdio_errors = _PyMem_RawStrdup(errors); if (config->stdio_errors == NULL) { return _Py_INIT_NO_MEMORY(); @@ -1227,10 +1385,10 @@ config_init_stdio_encoding(_PyCoreConfig *config) static _PyInitError -config_init_fs_encoding(_PyCoreConfig *config) +config_init_fs_encoding(_PyCoreConfig *config, const _PyPreConfig *preconfig) { #ifdef MS_WINDOWS - if (config->preconfig.legacy_windows_fs_encoding) { + if (preconfig->legacy_windows_fs_encoding) { /* Legacy Windows filesystem encoding: mbcs/replace */ if (config->filesystem_encoding == NULL) { config->filesystem_encoding = _PyMem_RawStrdup("mbcs"); @@ -1265,7 +1423,7 @@ config_init_fs_encoding(_PyCoreConfig *config) } #else if (config->filesystem_encoding == NULL) { - if (config->preconfig.utf8_mode) { + if (preconfig->utf8_mode) { /* UTF-8 Mode use: utf-8/surrogateescape */ config->filesystem_encoding = _PyMem_RawStrdup("utf-8"); /* errors defaults to surrogateescape above */ @@ -1279,7 +1437,7 @@ config_init_fs_encoding(_PyCoreConfig *config) #if defined(__APPLE__) || defined(__ANDROID__) config->filesystem_encoding = _PyMem_RawStrdup("utf-8"); #else - _PyInitError err = get_locale_encoding(&config->filesystem_encoding); + _PyInitError err = config_get_locale_encoding(&config->filesystem_encoding); if (_Py_INIT_FAILED(err)) { return err; } @@ -1304,66 +1462,20 @@ config_init_fs_encoding(_PyCoreConfig *config) static _PyInitError -_PyCoreConfig_ReadPreConfig(_PyCoreConfig *config) -{ - _PyInitError err; - _PyPreConfig local_preconfig = _PyPreConfig_INIT; - _PyPreConfig_GetGlobalConfig(&local_preconfig); - - if (_PyPreConfig_Copy(&local_preconfig, &config->preconfig) < 0) { - err = _Py_INIT_NO_MEMORY(); - goto done; - } - - err = _PyPreConfig_Read(&local_preconfig); - if (_Py_INIT_FAILED(err)) { - goto done; - } - - if (_PyPreConfig_Copy(&config->preconfig, &local_preconfig) < 0) { - err = _Py_INIT_NO_MEMORY(); - goto done; - } - err = _Py_INIT_OK(); - -done: - _PyPreConfig_Clear(&local_preconfig); - return err; -} - - -/* Read the configuration into _PyCoreConfig from: - - * Environment variables - * Py_xxx global configuration variables - - See _PyCoreConfig_ReadFromArgv() to parse also command line arguments. */ -_PyInitError -_PyCoreConfig_Read(_PyCoreConfig *config, const _PyPreConfig *preconfig) +config_read(_PyCoreConfig *config, _PyPreCmdline *cmdline) { _PyInitError err; + const _PyPreConfig *preconfig = &_PyRuntime.preconfig; - _PyCoreConfig_GetGlobalConfig(config); - - if (preconfig != NULL) { - if (_PyPreConfig_Copy(&config->preconfig, preconfig) < 0) { - return _Py_INIT_NO_MEMORY(); - } - } - else { - err = _PyCoreConfig_ReadPreConfig(config); - if (_Py_INIT_FAILED(err)) { - return err; - } + if (_PyPreCmdline_SetCoreConfig(cmdline, config) < 0) { + return _Py_INIT_NO_MEMORY(); } - assert(config->preconfig.use_environment >= 0); - - if (config->preconfig.isolated > 0) { + if (config->isolated > 0) { config->user_site_directory = 0; } - if (config->preconfig.use_environment) { + if (config->use_environment) { err = config_read_env_vars(config); if (_Py_INIT_FAILED(err)) { return err; @@ -1412,43 +1524,40 @@ _PyCoreConfig_Read(_PyCoreConfig *config, const _PyPreConfig *preconfig) } /* default values */ - if (config->preconfig.dev_mode) { + if (config->dev_mode) { if (config->faulthandler < 0) { config->faulthandler = 1; } } - if (config->use_hash_seed < 0) { - config->use_hash_seed = 0; - config->hash_seed = 0; - } if (config->faulthandler < 0) { config->faulthandler = 0; } if (config->tracemalloc < 0) { config->tracemalloc = 0; } - if (config->argc < 0) { - config->argc = 0; + if (config->use_hash_seed < 0) { + config->use_hash_seed = 0; + config->hash_seed = 0; } if (config->filesystem_encoding == NULL || config->filesystem_errors == NULL) { - err = config_init_fs_encoding(config); + err = config_init_fs_encoding(config, preconfig); if (_Py_INIT_FAILED(err)) { return err; } } - err = config_init_stdio_encoding(config); + err = config_init_stdio_encoding(config, preconfig); if (_Py_INIT_FAILED(err)) { return err; } - assert(config->preconfig.use_environment >= 0); - assert(config->filesystem_encoding != NULL); - assert(config->filesystem_errors != NULL); - assert(config->stdio_encoding != NULL); - assert(config->stdio_errors != NULL); - assert(config->_check_hash_pycs_mode != NULL); + if (config->argv.length < 1) { + /* Ensure at least one (empty) argument is seen */ + if (_PyWstrList_Append(&config->argv, L"") < 0) { + return _Py_INIT_NO_MEMORY(); + } + } return _Py_INIT_OK(); } @@ -1500,155 +1609,31 @@ _PyCoreConfig_Write(const _PyCoreConfig *config) { _PyCoreConfig_SetGlobalConfig(config); config_init_stdio(config); -} - -PyObject * -_PyCoreConfig_AsDict(const _PyCoreConfig *config) -{ - PyObject *dict; - - dict = PyDict_New(); - if (dict == NULL) { - return NULL; - } - - if (_PyPreConfig_AsDict(&config->preconfig, dict) < 0) { - Py_DECREF(dict); - return NULL; - } - -#define SET_ITEM(KEY, EXPR) \ - do { \ - PyObject *obj = (EXPR); \ - if (obj == NULL) { \ - goto fail; \ - } \ - int res = PyDict_SetItemString(dict, (KEY), obj); \ - Py_DECREF(obj); \ - if (res < 0) { \ - goto fail; \ - } \ - } while (0) -#define FROM_STRING(STR) \ - ((STR != NULL) ? \ - PyUnicode_FromString(STR) \ - : (Py_INCREF(Py_None), Py_None)) -#define SET_ITEM_INT(ATTR) \ - SET_ITEM(#ATTR, PyLong_FromLong(config->ATTR)) -#define SET_ITEM_UINT(ATTR) \ - SET_ITEM(#ATTR, PyLong_FromUnsignedLong(config->ATTR)) -#define SET_ITEM_STR(ATTR) \ - SET_ITEM(#ATTR, FROM_STRING(config->ATTR)) -#define FROM_WSTRING(STR) \ - ((STR != NULL) ? \ - PyUnicode_FromWideChar(STR, -1) \ - : (Py_INCREF(Py_None), Py_None)) -#define SET_ITEM_WSTR(ATTR) \ - SET_ITEM(#ATTR, FROM_WSTRING(config->ATTR)) -#define SET_ITEM_WSTRLIST(NOPTION, OPTIONS) \ - SET_ITEM(#OPTIONS, _Py_wstrlist_as_pylist(config->NOPTION, config->OPTIONS)) - - SET_ITEM_INT(install_signal_handlers); - SET_ITEM_INT(use_hash_seed); - SET_ITEM_UINT(hash_seed); - SET_ITEM_INT(faulthandler); - SET_ITEM_INT(tracemalloc); - SET_ITEM_INT(import_time); - SET_ITEM_INT(show_ref_count); - SET_ITEM_INT(show_alloc_count); - SET_ITEM_INT(dump_refs); - SET_ITEM_INT(malloc_stats); - SET_ITEM_STR(filesystem_encoding); - SET_ITEM_STR(filesystem_errors); - SET_ITEM_WSTR(pycache_prefix); - SET_ITEM_WSTR(program_name); - SET_ITEM_WSTRLIST(argc, argv); - SET_ITEM_WSTR(program); - SET_ITEM_WSTRLIST(nxoption, xoptions); - SET_ITEM_WSTRLIST(nwarnoption, warnoptions); - SET_ITEM_WSTR(module_search_path_env); - SET_ITEM_WSTR(home); - SET_ITEM_WSTRLIST(nmodule_search_path, module_search_paths); - SET_ITEM_WSTR(executable); - SET_ITEM_WSTR(prefix); - SET_ITEM_WSTR(base_prefix); - SET_ITEM_WSTR(exec_prefix); - SET_ITEM_WSTR(base_exec_prefix); -#ifdef MS_WINDOWS - SET_ITEM_WSTR(dll_path); -#endif - SET_ITEM_INT(site_import); - SET_ITEM_INT(bytes_warning); - SET_ITEM_INT(inspect); - SET_ITEM_INT(interactive); - SET_ITEM_INT(optimization_level); - SET_ITEM_INT(parser_debug); - SET_ITEM_INT(write_bytecode); - SET_ITEM_INT(verbose); - SET_ITEM_INT(quiet); - SET_ITEM_INT(user_site_directory); - SET_ITEM_INT(buffered_stdio); - SET_ITEM_STR(stdio_encoding); - SET_ITEM_STR(stdio_errors); -#ifdef MS_WINDOWS - SET_ITEM_INT(legacy_windows_stdio); -#endif - SET_ITEM_INT(skip_source_first_line); - SET_ITEM_WSTR(run_command); - SET_ITEM_WSTR(run_module); - SET_ITEM_WSTR(run_filename); - SET_ITEM_INT(_install_importlib); - SET_ITEM_STR(_check_hash_pycs_mode); - SET_ITEM_INT(_frozen); - - return dict; - -fail: - Py_DECREF(dict); - return NULL; - -#undef FROM_STRING -#undef FROM_WSTRING -#undef SET_ITEM -#undef SET_ITEM_INT -#undef SET_ITEM_UINT -#undef SET_ITEM_STR -#undef SET_ITEM_WSTR -#undef SET_ITEM_WSTRLIST + /* Write the new pre-configuration into _PyRuntime */ + _PyPreConfig *preconfig = &_PyRuntime.preconfig; + preconfig->isolated = config->isolated; + preconfig->use_environment = config->use_environment; + preconfig->dev_mode = config->dev_mode; } /* --- _PyCmdline ------------------------------------------------- */ typedef struct { - const _PyArgv *args; - int argc; - wchar_t **argv; - int nwarnoption; /* Number of -W command line options */ - wchar_t **warnoptions; /* Command line -W options */ - int nenv_warnoption; /* Number of PYTHONWARNINGS environment variables */ - wchar_t **env_warnoptions; /* PYTHONWARNINGS environment variables */ + _PyWstrList cmdline_warnoptions; /* Command line -W options */ + _PyWstrList env_warnoptions; /* PYTHONWARNINGS environment variables */ int print_help; /* -h, -? options */ int print_version; /* -V option */ + int need_usage; } _PyCmdline; static void cmdline_clear(_PyCmdline *cmdline) { - _Py_wstrlist_clear(cmdline->nwarnoption, cmdline->warnoptions); - cmdline->nwarnoption = 0; - cmdline->warnoptions = NULL; - - _Py_wstrlist_clear(cmdline->nenv_warnoption, cmdline->env_warnoptions); - cmdline->nenv_warnoption = 0; - cmdline->env_warnoptions = NULL; - - if (cmdline->args->use_bytes_argv && cmdline->argv != NULL) { - _Py_wstrlist_clear(cmdline->args->argc, cmdline->argv); - } - cmdline->argv = NULL; + _PyWstrList_Clear(&cmdline->cmdline_warnoptions); + _PyWstrList_Clear(&cmdline->env_warnoptions); } @@ -1657,30 +1642,33 @@ cmdline_clear(_PyCmdline *cmdline) /* Parse the command line arguments */ static _PyInitError config_parse_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, - int *need_usage) + _PyPreCmdline *precmdline) { - _PyInitError err; + const _PyWstrList *argv = &precmdline->argv; + _PyOS_ResetGetOpt(); do { int longindex = -1; - int c = _PyOS_GetOpt(cmdline->args->argc, cmdline->argv, &longindex); + int c = _PyOS_GetOpt(argv->length, argv->items, &longindex); if (c == EOF) { break; } if (c == 'c') { - /* -c is the last option; following arguments - that look like options are left for the - command to interpret. */ - size_t len = wcslen(_PyOS_optarg) + 1 + 1; - wchar_t *command = PyMem_RawMalloc(sizeof(wchar_t) * len); - if (command == NULL) { - return _Py_INIT_NO_MEMORY(); + if (config->run_command == NULL) { + /* -c is the last option; following arguments + that look like options are left for the + command to interpret. */ + size_t len = wcslen(_PyOS_optarg) + 1 + 1; + wchar_t *command = PyMem_RawMalloc(sizeof(wchar_t) * len); + if (command == NULL) { + return _Py_INIT_NO_MEMORY(); + } + memcpy(command, _PyOS_optarg, (len - 2) * sizeof(wchar_t)); + command[len - 2] = '\n'; + command[len - 1] = 0; + config->run_command = command; } - memcpy(command, _PyOS_optarg, (len - 2) * sizeof(wchar_t)); - command[len - 2] = '\n'; - command[len - 1] = 0; - config->run_command = command; break; } @@ -1688,9 +1676,11 @@ config_parse_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, /* -m is the last option; following arguments that look like options are left for the module to interpret. */ - config->run_module = _PyMem_RawWcsdup(_PyOS_optarg); if (config->run_module == NULL) { - return _Py_INIT_NO_MEMORY(); + config->run_module = _PyMem_RawWcsdup(_PyOS_optarg); + if (config->run_module == NULL) { + return _Py_INIT_NO_MEMORY(); + } } break; } @@ -1708,7 +1698,7 @@ config_parse_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, } else { fprintf(stderr, "--check-hash-based-pycs must be one of " "'default', 'always', or 'never'\n"); - *need_usage = 1; + cmdline->need_usage = 1; return _Py_INIT_OK(); } break; @@ -1728,7 +1718,8 @@ config_parse_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, case 'E': case 'I': - /* option handled by _PyPreConfig_ReadFromArgv() */ + case 'X': + /* option handled by _PyPreCmdline_Read() */ break; /* case 'J': reserved for Jython */ @@ -1775,20 +1766,8 @@ config_parse_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, break; case 'W': - err = _Py_wstrlist_append(&cmdline->nwarnoption, - &cmdline->warnoptions, - _PyOS_optarg); - if (_Py_INIT_FAILED(err)) { - return err; - } - break; - - case 'X': - err = _Py_wstrlist_append(&config->nxoption, - &config->xoptions, - _PyOS_optarg); - if (_Py_INIT_FAILED(err)) { - return err; + if (_PyWstrList_Append(&cmdline->cmdline_warnoptions, _PyOS_optarg) < 0) { + return _Py_INIT_NO_MEMORY(); } break; @@ -1804,16 +1783,17 @@ config_parse_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, default: /* unknown argument: parsing failed */ - *need_usage = 1; + cmdline->need_usage = 1; return _Py_INIT_OK(); } } while (1); if (config->run_command == NULL && config->run_module == NULL - && _PyOS_optind < cmdline->args->argc - && wcscmp(cmdline->argv[_PyOS_optind], L"-") != 0) + && _PyOS_optind < argv->length + && wcscmp(argv->items[_PyOS_optind], L"-") != 0 + && config->run_filename == NULL) { - config->run_filename = _PyMem_RawWcsdup(cmdline->argv[_PyOS_optind]); + config->run_filename = _PyMem_RawWcsdup(argv->items[_PyOS_optind]); if (config->run_filename == NULL) { return _Py_INIT_NO_MEMORY(); } @@ -1858,12 +1838,9 @@ cmdline_init_env_warnoptions(_PyCmdline *cmdline, const _PyCoreConfig *config) warning != NULL; warning = WCSTOK(NULL, L",", &context)) { - _PyInitError err = _Py_wstrlist_append(&cmdline->nenv_warnoption, - &cmdline->env_warnoptions, - warning); - if (_Py_INIT_FAILED(err)) { + if (_PyWstrList_Append(&cmdline->env_warnoptions, warning) < 0) { PyMem_RawFree(env); - return err; + return _Py_INIT_NO_MEMORY(); } } PyMem_RawFree(env); @@ -1872,11 +1849,12 @@ cmdline_init_env_warnoptions(_PyCmdline *cmdline, const _PyCoreConfig *config) static _PyInitError -config_init_program(_PyCoreConfig *config, const _PyCmdline *cmdline) +config_init_program(_PyCoreConfig *config, const _PyPreCmdline *cmdline) { + const _PyWstrList *argv = &cmdline->argv; wchar_t *program; - if (cmdline->args->argc >= 1 && cmdline->argv != NULL) { - program = cmdline->argv[0]; + if (argv->length >= 1) { + program = argv->items[0]; } else { program = L""; @@ -1890,29 +1868,23 @@ config_init_program(_PyCoreConfig *config, const _PyCmdline *cmdline) } -static _PyInitError -config_add_warnings_optlist(_PyCoreConfig *config, - int len, wchar_t * const *options) +static int +config_add_warnoption(_PyCoreConfig *config, const wchar_t *option) { - for (int i = 0; i < len; i++) { - _PyInitError err = _Py_wstrlist_append(&config->nwarnoption, - &config->warnoptions, - options[i]); - if (_Py_INIT_FAILED(err)) { - return err; - } + if (_PyWstrList_Find(&config->warnoptions, option)) { + /* Already present: do nothing */ + return 0; } - return _Py_INIT_OK(); + if (_PyWstrList_Append(&config->warnoptions, option)) { + return -1; + } + return 0; } static _PyInitError config_init_warnoptions(_PyCoreConfig *config, const _PyCmdline *cmdline) { - _PyInitError err; - - assert(config->nwarnoption == 0); - /* The priority order for warnings configuration is (highest precedence * first): * @@ -1928,27 +1900,27 @@ config_init_warnoptions(_PyCoreConfig *config, const _PyCmdline *cmdline) * the lowest precedence entries first so that later entries override them. */ - if (config->preconfig.dev_mode) { - err = _Py_wstrlist_append(&config->nwarnoption, - &config->warnoptions, - L"default"); - if (_Py_INIT_FAILED(err)) { - return err; + if (config->dev_mode) { + if (config_add_warnoption(config, L"default") < 0) { + return _Py_INIT_NO_MEMORY(); } } - err = config_add_warnings_optlist(config, - cmdline->nenv_warnoption, - cmdline->env_warnoptions); - if (_Py_INIT_FAILED(err)) { - return err; + Py_ssize_t i; + const _PyWstrList *options; + + options = &cmdline->env_warnoptions; + for (i = 0; i < options->length; i++) { + if (config_add_warnoption(config, options->items[i]) < 0) { + return _Py_INIT_NO_MEMORY(); + } } - err = config_add_warnings_optlist(config, - cmdline->nwarnoption, - cmdline->warnoptions); - if (_Py_INIT_FAILED(err)) { - return err; + options = &cmdline->cmdline_warnoptions; + for (i = 0; i < options->length; i++) { + if (config_add_warnoption(config, options->items[i]) < 0) { + return _Py_INIT_NO_MEMORY(); + } } /* If the bytes_warning_flag isn't set, bytesobject.c and bytearrayobject.c @@ -1956,18 +1928,15 @@ config_init_warnoptions(_PyCoreConfig *config, const _PyCmdline *cmdline) * case. */ if (config->bytes_warning) { - wchar_t *filter; + const wchar_t *filter; if (config->bytes_warning> 1) { filter = L"error::BytesWarning"; } else { filter = L"default::BytesWarning"; } - err = _Py_wstrlist_append(&config->nwarnoption, - &config->warnoptions, - filter); - if (_Py_INIT_FAILED(err)) { - return err; + if (config_add_warnoption(config, filter) < 0) { + return _Py_INIT_NO_MEMORY(); } } return _Py_INIT_OK(); @@ -1975,25 +1944,27 @@ config_init_warnoptions(_PyCoreConfig *config, const _PyCmdline *cmdline) static _PyInitError -config_init_argv(_PyCoreConfig *config, const _PyCmdline *cmdline) +config_init_argv(_PyCoreConfig *config, const _PyPreCmdline *cmdline) { - /* Copy argv to be able to modify it (to force -c/-m) */ - int argc = cmdline->args->argc - _PyOS_optind; - wchar_t **argv; + const _PyWstrList *cmdline_argv = &cmdline->argv; + _PyWstrList config_argv = _PyWstrList_INIT; - if (argc <= 0 || cmdline->argv == NULL) { + /* Copy argv to be able to modify it (to force -c/-m) */ + if (cmdline_argv->length <= _PyOS_optind) { /* Ensure at least one (empty) argument is seen */ - static wchar_t *empty_argv[1] = {L""}; - argc = 1; - argv = _Py_wstrlist_copy(1, empty_argv); + if (_PyWstrList_Append(&config_argv, L"") < 0) { + return _Py_INIT_NO_MEMORY(); + } } else { - argv = _Py_wstrlist_copy(argc, &cmdline->argv[_PyOS_optind]); - } - - if (argv == NULL) { - return _Py_INIT_NO_MEMORY(); + _PyWstrList slice; + slice.length = cmdline_argv->length - _PyOS_optind; + slice.items = &cmdline_argv->items[_PyOS_optind]; + if (_PyWstrList_Copy(&config_argv, &slice) < 0) { + return _Py_INIT_NO_MEMORY(); + } } + assert(config_argv.length >= 1); wchar_t *arg0 = NULL; if (config->run_command != NULL) { @@ -2007,17 +1978,16 @@ config_init_argv(_PyCoreConfig *config, const _PyCmdline *cmdline) if (arg0 != NULL) { arg0 = _PyMem_RawWcsdup(arg0); if (arg0 == NULL) { - _Py_wstrlist_clear(argc, argv); + _PyWstrList_Clear(&config_argv); return _Py_INIT_NO_MEMORY(); } - assert(argc >= 1); - PyMem_RawFree(argv[0]); - argv[0] = arg0; + PyMem_RawFree(config_argv.items[0]); + config_argv.items[0] = arg0; } - config->argc = argc; - config->argv = argv; + _PyWstrList_Clear(&config->argv); + config->argv = config_argv; return _Py_INIT_OK(); } @@ -2041,96 +2011,225 @@ config_usage(int error, const wchar_t* program) } -/* Parse command line options and environment variables. */ static _PyInitError -config_from_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline, - const _PyPreConfig *preconfig) +core_read_precmdline(_PyCoreConfig *config, const _PyArgv *args, + _PyPreCmdline *precmdline) { - int need_usage = 0; _PyInitError err; - err = config_init_program(config, cmdline); - if (_Py_INIT_FAILED(err)) { - return err; + if (args) { + err = _PyPreCmdline_SetArgv(precmdline, args); + if (_Py_INIT_FAILED(err)) { + return err; + } } - err = config_parse_cmdline(config, cmdline, &need_usage); - if (_Py_INIT_FAILED(err)) { - return err; + _PyPreConfig preconfig = _PyPreConfig_INIT; + if (_PyPreConfig_Copy(&preconfig, &_PyRuntime.preconfig) < 0) { + err = _Py_INIT_NO_MEMORY(); + goto done; } - if (need_usage) { - config_usage(1, config->program); - return _Py_INIT_EXIT(2); - } + _PyCoreConfig_GetCoreConfig(&preconfig, config); - if (cmdline->print_help) { - config_usage(0, config->program); - return _Py_INIT_EXIT(0); - } + err = _PyPreCmdline_Read(precmdline, &preconfig); - if (cmdline->print_version) { - printf("Python %s\n", - (cmdline->print_version >= 2) ? Py_GetVersion() : PY_VERSION); - return _Py_INIT_EXIT(0); - } +done: + _PyPreConfig_Clear(&preconfig); + return err; +} + + +/* Read the configuration into _PyCoreConfig from: + + * Command line arguments + * Environment variables + * Py_xxx global configuration variables */ +_PyInitError +_PyCoreConfig_Read(_PyCoreConfig *config, const _PyArgv *args) +{ + _PyInitError err; - err = config_init_argv(config, cmdline); + err = _Py_PreInitializeFromCoreConfig(config); if (_Py_INIT_FAILED(err)) { return err; } - err = _PyCoreConfig_Read(config, preconfig); + _PyCoreConfig_GetGlobalConfig(config); + + _PyPreCmdline precmdline = _PyPreCmdline_INIT; + err = core_read_precmdline(config, args, &precmdline); if (_Py_INIT_FAILED(err)) { - return err; + goto done; } - if (config->preconfig.use_environment) { - err = cmdline_init_env_warnoptions(cmdline, config); + if (config->program == NULL) { + err = config_init_program(config, &precmdline); if (_Py_INIT_FAILED(err)) { - return err; + goto done; } } - err = config_init_warnoptions(config, cmdline); - if (_Py_INIT_FAILED(err)) { - return err; - } + _PyCmdline cmdline; + memset(&cmdline, 0, sizeof(cmdline)); - if (_Py_SetArgcArgv(cmdline->args->argc, cmdline->argv) < 0) { - return _Py_INIT_NO_MEMORY(); - } - return _Py_INIT_OK(); -} + if (args) { + err = config_parse_cmdline(config, &cmdline, &precmdline); + if (_Py_INIT_FAILED(err)) { + goto done; + } + if (cmdline.need_usage) { + config_usage(1, config->program); + err = _Py_INIT_EXIT(2); + goto done; + } -/* Read the configuration into _PyCoreConfig from: + if (cmdline.print_help) { + config_usage(0, config->program); + err = _Py_INIT_EXIT(0); + goto done; + } - * Command line arguments - * Environment variables - * Py_xxx global configuration variables */ -_PyInitError -_PyCoreConfig_ReadFromArgv(_PyCoreConfig *config, const _PyArgv *args, - const _PyPreConfig *preconfig) -{ - _PyInitError err; + if (cmdline.print_version) { + printf("Python %s\n", + (cmdline.print_version >= 2) ? Py_GetVersion() : PY_VERSION); + err = _Py_INIT_EXIT(0); + goto done; + } - _PyCmdline cmdline; - memset(&cmdline, 0, sizeof(cmdline)); - cmdline.args = args; + err = config_init_argv(config, &precmdline); + if (_Py_INIT_FAILED(err)) { + goto done; + } + } - err = _PyArgv_Decode(cmdline.args, &cmdline.argv); + err = config_read(config, &precmdline); if (_Py_INIT_FAILED(err)) { goto done; } - err = config_from_cmdline(config, &cmdline, preconfig); + if (config->use_environment) { + err = cmdline_init_env_warnoptions(&cmdline, config); + if (_Py_INIT_FAILED(err)) { + goto done; + } + } + + err = config_init_warnoptions(config, &cmdline); if (_Py_INIT_FAILED(err)) { goto done; } + + const _PyWstrList *argv = &precmdline.argv; + if (_Py_SetArgcArgv(argv->length, argv->items) < 0) { + err = _Py_INIT_NO_MEMORY(); + goto done; + } + + /* Check config consistency */ + assert(config->isolated >= 0); + assert(config->use_environment >= 0); + assert(config->dev_mode >= 0); + assert(config->install_signal_handlers >= 0); + assert(config->use_hash_seed >= 0); + assert(config->faulthandler >= 0); + assert(config->tracemalloc >= 0); + assert(config->site_import >= 0); + assert(config->bytes_warning >= 0); + assert(config->inspect >= 0); + assert(config->interactive >= 0); + assert(config->optimization_level >= 0); + assert(config->parser_debug >= 0); + assert(config->write_bytecode >= 0); + assert(config->verbose >= 0); + assert(config->quiet >= 0); + assert(config->user_site_directory >= 0); + assert(config->buffered_stdio >= 0); + assert(config->program_name != NULL); + assert(config->program != NULL); + assert(_PyWstrList_CheckConsistency(&config->argv)); + assert(_PyWstrList_CheckConsistency(&config->xoptions)); + assert(_PyWstrList_CheckConsistency(&config->warnoptions)); + assert(_PyWstrList_CheckConsistency(&config->module_search_paths)); + if (config->_install_importlib) { + assert(config->executable != NULL); + assert(config->prefix != NULL); + assert(config->base_prefix != NULL); + assert(config->exec_prefix != NULL); + assert(config->base_exec_prefix != NULL); +#ifdef MS_WINDOWS + assert(config->dll_path != NULL); +#endif + } + assert(config->filesystem_encoding != NULL); + assert(config->filesystem_errors != NULL); + assert(config->stdio_encoding != NULL); + assert(config->stdio_errors != NULL); +#ifdef MS_WINDOWS + assert(config->legacy_windows_stdio >= 0); +#endif + assert(config->_check_hash_pycs_mode != NULL); + assert(config->_install_importlib >= 0); + assert(config->_frozen >= 0); + err = _Py_INIT_OK(); done: cmdline_clear(&cmdline); + _PyPreCmdline_Clear(&precmdline); return err; } + + +PyObject* +_Py_GetConfigsAsDict(void) +{ + PyObject *config = NULL; + PyObject *dict = NULL; + + config = PyDict_New(); + if (config == NULL) { + goto error; + } + + /* global config */ + dict = _Py_GetGlobalVariablesAsDict(); + if (dict == NULL) { + goto error; + } + if (PyDict_SetItemString(config, "global_config", dict) < 0) { + goto error; + } + Py_CLEAR(dict); + + /* pre config */ + PyInterpreterState *interp = _PyInterpreterState_Get(); + const _PyPreConfig *pre_config = &_PyRuntime.preconfig; + dict = _PyPreConfig_AsDict(pre_config); + if (dict == NULL) { + goto error; + } + if (PyDict_SetItemString(config, "pre_config", dict) < 0) { + goto error; + } + Py_CLEAR(dict); + + /* core config */ + const _PyCoreConfig *core_config = _PyInterpreterState_GetCoreConfig(interp); + dict = _PyCoreConfig_AsDict(core_config); + if (dict == NULL) { + goto error; + } + if (PyDict_SetItemString(config, "core_config", dict) < 0) { + goto error; + } + Py_CLEAR(dict); + + return config; + +error: + Py_XDECREF(config); + Py_XDECREF(dict); + return NULL; +} diff --git a/Python/dtoa.c b/Python/dtoa.c index 01ca9b0b22..b7bb7acfb6 100644 --- a/Python/dtoa.c +++ b/Python/dtoa.c @@ -1441,8 +1441,9 @@ _Py_dg_strtod(const char *s00, char **se) ULong y, z, abs_exp; Long L; BCinfo bc; - Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; + Bigint *bb = NULL, *bd = NULL, *bd0 = NULL, *bs = NULL, *delta = NULL; size_t ndigits, fraclen; + double result; dval(&rv) = 0.; @@ -1634,7 +1635,6 @@ _Py_dg_strtod(const char *s00, char **se) if (k > 9) { dval(&rv) = tens[k - 9] * dval(&rv) + z; } - bd0 = 0; if (nd <= DBL_DIG && Flt_Rounds == 1 ) { @@ -1804,14 +1804,11 @@ _Py_dg_strtod(const char *s00, char **se) bd = Balloc(bd0->k); if (bd == NULL) { - Bfree(bd0); goto failed_malloc; } Bcopy(bd, bd0); bb = sd2b(&rv, bc.scale, &bbe); /* srv = bb * 2^bbe */ if (bb == NULL) { - Bfree(bd); - Bfree(bd0); goto failed_malloc; } /* Record whether lsb of bb is odd, in case we need this @@ -1821,9 +1818,6 @@ _Py_dg_strtod(const char *s00, char **se) /* tdv = bd * 10**e; srv = bb * 2**bbe */ bs = i2b(1); if (bs == NULL) { - Bfree(bb); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } @@ -1874,54 +1868,36 @@ _Py_dg_strtod(const char *s00, char **se) if (bb5 > 0) { bs = pow5mult(bs, bb5); if (bs == NULL) { - Bfree(bb); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } - bb1 = mult(bs, bb); + Bigint *bb1 = mult(bs, bb); Bfree(bb); bb = bb1; if (bb == NULL) { - Bfree(bs); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } } if (bb2 > 0) { bb = lshift(bb, bb2); if (bb == NULL) { - Bfree(bs); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } } if (bd5 > 0) { bd = pow5mult(bd, bd5); if (bd == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd0); goto failed_malloc; } } if (bd2 > 0) { bd = lshift(bd, bd2); if (bd == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd0); goto failed_malloc; } } if (bs2 > 0) { bs = lshift(bs, bs2); if (bs == NULL) { - Bfree(bb); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } } @@ -1932,10 +1908,6 @@ _Py_dg_strtod(const char *s00, char **se) delta = diff(bb, bd); if (delta == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } dsign = delta->sign; @@ -1989,10 +1961,6 @@ _Py_dg_strtod(const char *s00, char **se) } delta = lshift(delta,Log2P); if (delta == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd); - Bfree(bd0); goto failed_malloc; } if (cmp(delta, bs) > 0) @@ -2094,11 +2062,6 @@ _Py_dg_strtod(const char *s00, char **se) if ((word0(&rv) & Exp_mask) >= Exp_msk1*(DBL_MAX_EXP+Bias-P)) { if (word0(&rv0) == Big0 && word1(&rv0) == Big1) { - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); goto ovfl; } word0(&rv) = Big0; @@ -2140,16 +2103,11 @@ _Py_dg_strtod(const char *s00, char **se) } } cont: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(delta); + Bfree(bb); bb = NULL; + Bfree(bd); bd = NULL; + Bfree(bs); bs = NULL; + Bfree(delta); delta = NULL; } - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); if (bc.nd > nd) { error = bigcomp(&rv, s0, &bc); if (error) @@ -2163,24 +2121,37 @@ _Py_dg_strtod(const char *s00, char **se) } ret: - return sign ? -dval(&rv) : dval(&rv); + result = sign ? -dval(&rv) : dval(&rv); + goto done; parse_error: - return 0.0; + result = 0.0; + goto done; failed_malloc: errno = ENOMEM; - return -1.0; + result = -1.0; + goto done; undfl: - return sign ? -0.0 : 0.0; + result = sign ? -0.0 : 0.0; + goto done; ovfl: errno = ERANGE; /* Can't trust HUGE_VAL */ word0(&rv) = Exp_mask; word1(&rv) = 0; - return sign ? -dval(&rv) : dval(&rv); + result = sign ? -dval(&rv) : dval(&rv); + goto done; + + done: + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); + return result; } diff --git a/Python/dynload_win.c b/Python/dynload_win.c index 129e04d1b2..36918c3579 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -256,7 +256,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, This should not happen if called correctly. */ if (theLength == 0) { message = PyUnicode_FromFormat( - "DLL load failed with error code %d", + "DLL load failed with error code %u", errorCode); } else { /* For some reason a \r\n diff --git a/Python/fileutils.c b/Python/fileutils.c index 75e015afae..b933874193 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1629,10 +1629,12 @@ _Py_write_noraise(int fd, const void *buf, size_t count) #ifdef HAVE_READLINK /* Read value of symbolic link. Encode the path to the locale encoding, decode - the result from the locale encoding. Return -1 on error. */ + the result from the locale encoding. + Return -1 on encoding error, on readlink() error, if the internal buffer is + too short, on decoding error, or if 'buf' is too short. */ int -_Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) +_Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t buflen) { char *cpath; char cbuf[MAXPATHLEN]; @@ -1659,12 +1661,13 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) errno = EINVAL; return -1; } - if (bufsiz <= r1) { + /* wbuf must have space to store the trailing NUL character */ + if (buflen <= r1) { PyMem_RawFree(wbuf); errno = EINVAL; return -1; } - wcsncpy(buf, wbuf, bufsiz); + wcsncpy(buf, wbuf, buflen); PyMem_RawFree(wbuf); return (int)r1; } @@ -1674,11 +1677,12 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) /* Return the canonicalized absolute pathname. Encode path to the locale encoding, decode the result from the locale encoding. - Return NULL on error. */ + Return NULL on encoding error, realpath() error, decoding error + or if 'resolved_path' is too short. */ wchar_t* _Py_wrealpath(const wchar_t *path, - wchar_t *resolved_path, size_t resolved_path_size) + wchar_t *resolved_path, size_t resolved_path_len) { char *cpath; char cresolved_path[MAXPATHLEN]; @@ -1700,27 +1704,29 @@ _Py_wrealpath(const wchar_t *path, errno = EINVAL; return NULL; } - if (resolved_path_size <= r) { + /* wresolved_path must have space to store the trailing NUL character */ + if (resolved_path_len <= r) { PyMem_RawFree(wresolved_path); errno = EINVAL; return NULL; } - wcsncpy(resolved_path, wresolved_path, resolved_path_size); + wcsncpy(resolved_path, wresolved_path, resolved_path_len); PyMem_RawFree(wresolved_path); return resolved_path; } #endif -/* Get the current directory. size is the buffer size in wide characters +/* Get the current directory. buflen is the buffer size in wide characters including the null character. Decode the path from the locale encoding. - Return NULL on error. */ + Return NULL on getcwd() error, on decoding error, or if 'buf' is + too short. */ wchar_t* -_Py_wgetcwd(wchar_t *buf, size_t size) +_Py_wgetcwd(wchar_t *buf, size_t buflen) { #ifdef MS_WINDOWS - int isize = (int)Py_MIN(size, INT_MAX); - return _wgetcwd(buf, isize); + int ibuflen = (int)Py_MIN(buflen, INT_MAX); + return _wgetcwd(buf, ibuflen); #else char fname[MAXPATHLEN]; wchar_t *wname; @@ -1731,11 +1737,12 @@ _Py_wgetcwd(wchar_t *buf, size_t size) wname = Py_DecodeLocale(fname, &len); if (wname == NULL) return NULL; - if (size <= len) { + /* wname must have space to store the trailing NUL character */ + if (buflen <= len) { PyMem_RawFree(wname); return NULL; } - wcsncpy(buf, wname, size); + wcsncpy(buf, wname, buflen); PyMem_RawFree(wname); return buf; #endif diff --git a/Python/getargs.c b/Python/getargs.c index ba1a9d4214..59f0fdabb7 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -372,14 +372,14 @@ vgetargs1_impl(PyObject *compat_args, PyObject *const *stack, Py_ssize_t nargs, if (nargs < min || max < nargs) { if (message == NULL) PyErr_Format(PyExc_TypeError, - "%.150s%s takes %s %d argument%s (%ld given)", + "%.150s%s takes %s %d argument%s (%zd given)", fname==NULL ? "function" : fname, fname==NULL ? "" : "()", min==max ? "exactly" : nargs < min ? "at least" : "at most", nargs < min ? min : max, (nargs < min ? min : max) == 1 ? "" : "s", - Py_SAFE_DOWNCAST(nargs, Py_ssize_t, long)); + nargs); else PyErr_SetString(PyExc_TypeError, message); return cleanreturn(0, &freelist); @@ -681,7 +681,13 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, /* For # codes */ #define FETCH_SIZE int *q=NULL;Py_ssize_t *q2=NULL;\ if (flags & FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \ - else q=va_arg(*p_va, int*); + else { \ + if (PyErr_WarnEx(PyExc_DeprecationWarning, \ + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { \ + return NULL; \ + } \ + q=va_arg(*p_va, int*); \ + } #define STORE_SIZE(s) \ if (flags & FLAG_SIZE_T) \ *q2=s; \ @@ -1741,7 +1747,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format, else { PyErr_Format(PyExc_TypeError, "%.200s%s takes %s %d positional argument%s" - " (%d given)", + " (%zd given)", (fname == NULL) ? "function" : fname, (fname == NULL) ? "" : "()", (min != INT_MAX) ? "at most" : "exactly", @@ -1826,7 +1832,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format, if (skip) { PyErr_Format(PyExc_TypeError, "%.200s%s takes %s %d positional argument%s" - " (%d given)", + " (%zd given)", (fname == NULL) ? "function" : fname, (fname == NULL) ? "" : "()", (Py_MIN(pos, min) < i) ? "at least" : "exactly", @@ -1905,24 +1911,11 @@ parser_init(struct _PyArg_Parser *parser) int i, len, min, max, nkw; PyObject *kwtuple; - assert(parser->format != NULL); assert(parser->keywords != NULL); if (parser->kwtuple != NULL) { return 1; } - /* grab the function name or custom error msg first (mutually exclusive) */ - parser->fname = strchr(parser->format, ':'); - if (parser->fname) { - parser->fname++; - parser->custom_msg = NULL; - } - else { - parser->custom_msg = strchr(parser->format,';'); - if (parser->custom_msg) - parser->custom_msg++; - } - keywords = parser->keywords; /* scan keywords and count the number of positional-only parameters */ for (i = 0; keywords[i] && !*keywords[i]; i++) { @@ -1938,60 +1931,74 @@ parser_init(struct _PyArg_Parser *parser) } len = i; - min = max = INT_MAX; format = parser->format; - for (i = 0; i < len; i++) { - if (*format == '|') { - if (min != INT_MAX) { - PyErr_SetString(PyExc_SystemError, - "Invalid format string (| specified twice)"); - return 0; + if (format) { + /* grab the function name or custom error msg first (mutually exclusive) */ + parser->fname = strchr(parser->format, ':'); + if (parser->fname) { + parser->fname++; + parser->custom_msg = NULL; + } + else { + parser->custom_msg = strchr(parser->format,';'); + if (parser->custom_msg) + parser->custom_msg++; + } + + min = max = INT_MAX; + for (i = 0; i < len; i++) { + if (*format == '|') { + if (min != INT_MAX) { + PyErr_SetString(PyExc_SystemError, + "Invalid format string (| specified twice)"); + return 0; + } + if (max != INT_MAX) { + PyErr_SetString(PyExc_SystemError, + "Invalid format string ($ before |)"); + return 0; + } + min = i; + format++; } - if (max != INT_MAX) { - PyErr_SetString(PyExc_SystemError, - "Invalid format string ($ before |)"); - return 0; + if (*format == '$') { + if (max != INT_MAX) { + PyErr_SetString(PyExc_SystemError, + "Invalid format string ($ specified twice)"); + return 0; + } + if (i < parser->pos) { + PyErr_SetString(PyExc_SystemError, + "Empty parameter name after $"); + return 0; + } + max = i; + format++; } - min = i; - format++; - } - if (*format == '$') { - if (max != INT_MAX) { - PyErr_SetString(PyExc_SystemError, - "Invalid format string ($ specified twice)"); + if (IS_END_OF_FORMAT(*format)) { + PyErr_Format(PyExc_SystemError, + "More keyword list entries (%d) than " + "format specifiers (%d)", len, i); return 0; } - if (i < parser->pos) { - PyErr_SetString(PyExc_SystemError, - "Empty parameter name after $"); + + msg = skipitem(&format, NULL, 0); + if (msg) { + PyErr_Format(PyExc_SystemError, "%s: '%s'", msg, + format); return 0; } - max = i; - format++; - } - if (IS_END_OF_FORMAT(*format)) { - PyErr_Format(PyExc_SystemError, - "More keyword list entries (%d) than " - "format specifiers (%d)", len, i); - return 0; } + parser->min = Py_MIN(min, len); + parser->max = Py_MIN(max, len); - msg = skipitem(&format, NULL, 0); - if (msg) { - PyErr_Format(PyExc_SystemError, "%s: '%s'", msg, - format); + if (!IS_END_OF_FORMAT(*format) && (*format != '|') && (*format != '$')) { + PyErr_Format(PyExc_SystemError, + "more argument specifiers than keyword list entries " + "(remaining format:'%s')", format); return 0; } } - parser->min = Py_MIN(min, len); - parser->max = Py_MIN(max, len); - - if (!IS_END_OF_FORMAT(*format) && (*format != '|') && (*format != '$')) { - PyErr_Format(PyExc_SystemError, - "more argument specifiers than keyword list entries " - "(remaining format:'%s')", format); - return 0; - } nkw = len - parser->pos; kwtuple = PyTuple_New(nkw); @@ -2134,10 +2141,10 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, } else { PyErr_Format(PyExc_TypeError, - "%.200s%s takes %s %d positional argument%s (%d given)", + "%.200s%s takes %s %d positional argument%s (%zd given)", (parser->fname == NULL) ? "function" : parser->fname, (parser->fname == NULL) ? "" : "()", - (parser->min != INT_MAX) ? "at most" : "exactly", + (parser->min < parser->max) ? "at most" : "exactly", parser->max, parser->max == 1 ? "" : "s", nargs); @@ -2194,7 +2201,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, Py_ssize_t min = Py_MIN(pos, parser->min); PyErr_Format(PyExc_TypeError, "%.200s%s takes %s %d positional argument%s" - " (%d given)", + " (%zd given)", (parser->fname == NULL) ? "function" : parser->fname, (parser->fname == NULL) ? "" : "()", min < parser->max ? "at least" : "exactly", @@ -2313,6 +2320,215 @@ vgetargskeywordsfast(PyObject *args, PyObject *keywords, } +#undef _PyArg_UnpackKeywords + +PyObject * const * +_PyArg_UnpackKeywords(PyObject *const *args, Py_ssize_t nargs, + PyObject *kwargs, PyObject *kwnames, + struct _PyArg_Parser *parser, + int minpos, int maxpos, int minkw, + PyObject **buf) +{ + PyObject *kwtuple; + PyObject *keyword; + int i, posonly, minposonly, maxargs; + int reqlimit = minkw ? maxpos + minkw : minpos; + Py_ssize_t nkwargs; + PyObject *current_arg; + PyObject * const *kwstack = NULL; + + assert(kwargs == NULL || PyDict_Check(kwargs)); + assert(kwargs == NULL || kwnames == NULL); + + if (parser == NULL) { + PyErr_BadInternalCall(); + return NULL; + } + + if (kwnames != NULL && !PyTuple_Check(kwnames)) { + PyErr_BadInternalCall(); + return NULL; + } + + if (args == NULL && nargs == 0) { + args = buf; + } + + if (!parser_init(parser)) { + return NULL; + } + + kwtuple = parser->kwtuple; + posonly = parser->pos; + minposonly = Py_MIN(posonly, minpos); + maxargs = posonly + (int)PyTuple_GET_SIZE(kwtuple); + + if (kwargs != NULL) { + nkwargs = PyDict_GET_SIZE(kwargs); + } + else if (kwnames != NULL) { + nkwargs = PyTuple_GET_SIZE(kwnames); + kwstack = args + nargs; + } + else { + nkwargs = 0; + } + if (nkwargs == 0 && minkw == 0 && minpos <= nargs && nargs <= maxpos) { + /* Fast path. */ + return args; + } + if (nargs + nkwargs > maxargs) { + /* Adding "keyword" (when nargs == 0) prevents producing wrong error + messages in some special cases (see bpo-31229). */ + PyErr_Format(PyExc_TypeError, + "%.200s%s takes at most %d %sargument%s (%zd given)", + (parser->fname == NULL) ? "function" : parser->fname, + (parser->fname == NULL) ? "" : "()", + maxargs, + (nargs == 0) ? "keyword " : "", + (maxargs == 1) ? "" : "s", + nargs + nkwargs); + return NULL; + } + if (nargs > maxpos) { + if (maxpos == 0) { + PyErr_Format(PyExc_TypeError, + "%.200s%s takes no positional arguments", + (parser->fname == NULL) ? "function" : parser->fname, + (parser->fname == NULL) ? "" : "()"); + } + else { + PyErr_Format(PyExc_TypeError, + "%.200s%s takes %s %d positional argument%s (%zd given)", + (parser->fname == NULL) ? "function" : parser->fname, + (parser->fname == NULL) ? "" : "()", + (minpos < maxpos) ? "at most" : "exactly", + maxpos, + (maxpos == 1) ? "" : "s", + nargs); + } + return NULL; + } + if (nargs < minposonly) { + PyErr_Format(PyExc_TypeError, + "%.200s%s takes %s %d positional argument%s" + " (%zd given)", + (parser->fname == NULL) ? "function" : parser->fname, + (parser->fname == NULL) ? "" : "()", + minposonly < maxpos ? "at least" : "exactly", + minposonly, + minposonly == 1 ? "" : "s", + nargs); + return NULL; + } + + /* copy tuple args */ + for (i = 0; i < nargs; i++) { + buf[i] = args[i]; + } + + /* copy keyword args using kwtuple to drive process */ + for (i = Py_MAX((int)nargs, posonly); i < maxargs; i++) { + if (nkwargs) { + keyword = PyTuple_GET_ITEM(kwtuple, i - posonly); + if (kwargs != NULL) { + current_arg = PyDict_GetItemWithError(kwargs, keyword); + if (!current_arg && PyErr_Occurred()) { + return NULL; + } + } + else { + current_arg = find_keyword(kwnames, kwstack, keyword); + } + } + else if (i >= reqlimit) { + break; + } + else { + current_arg = NULL; + } + + buf[i] = current_arg; + + if (current_arg) { + --nkwargs; + } + else if (i < minpos || (maxpos <= i && i < reqlimit)) { + /* Less arguments than required */ + keyword = PyTuple_GET_ITEM(kwtuple, i - posonly); + PyErr_Format(PyExc_TypeError, "%.200s%s missing required " + "argument '%U' (pos %d)", + (parser->fname == NULL) ? "function" : parser->fname, + (parser->fname == NULL) ? "" : "()", + keyword, i+1); + return NULL; + } + } + + if (nkwargs > 0) { + Py_ssize_t j; + /* make sure there are no arguments given by name and position */ + for (i = posonly; i < nargs; i++) { + keyword = PyTuple_GET_ITEM(kwtuple, i - posonly); + if (kwargs != NULL) { + current_arg = PyDict_GetItemWithError(kwargs, keyword); + if (!current_arg && PyErr_Occurred()) { + return NULL; + } + } + else { + current_arg = find_keyword(kwnames, kwstack, keyword); + } + if (current_arg) { + /* arg present in tuple and in dict */ + PyErr_Format(PyExc_TypeError, + "argument for %.200s%s given by name ('%U') " + "and position (%d)", + (parser->fname == NULL) ? "function" : parser->fname, + (parser->fname == NULL) ? "" : "()", + keyword, i+1); + return NULL; + } + } + /* make sure there are no extraneous keyword arguments */ + j = 0; + while (1) { + int match; + if (kwargs != NULL) { + if (!PyDict_Next(kwargs, &j, &keyword, NULL)) + break; + } + else { + if (j >= PyTuple_GET_SIZE(kwnames)) + break; + keyword = PyTuple_GET_ITEM(kwnames, j); + j++; + } + + if (!PyUnicode_Check(keyword)) { + PyErr_SetString(PyExc_TypeError, + "keywords must be strings"); + return NULL; + } + match = PySequence_Contains(kwtuple, keyword); + if (match <= 0) { + if (!match) { + PyErr_Format(PyExc_TypeError, + "'%U' is an invalid keyword " + "argument for %.200s%s", + keyword, + (parser->fname == NULL) ? "this function" : parser->fname, + (parser->fname == NULL) ? "" : "()"); + } + return NULL; + } + } + } + + return buf; +} + + static const char * skipitem(const char **p_format, va_list *p_va, int flags) { @@ -2381,8 +2597,13 @@ skipitem(const char **p_format, va_list *p_va, int flags) if (p_va != NULL) { if (flags & FLAG_SIZE_T) (void) va_arg(*p_va, Py_ssize_t *); - else + else { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { + return NULL; + } (void) va_arg(*p_va, int *); + } } format++; } else if ((c == 's' || c == 'z' || c == 'y' || c == 'w') diff --git a/Python/getopt.c b/Python/getopt.c index 1dc872041f..10bd1d49d7 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -37,9 +37,9 @@ extern "C" { #endif -int _PyOS_opterr = 1; /* generate error messages */ -int _PyOS_optind = 1; /* index into argv array */ -wchar_t *_PyOS_optarg = NULL; /* optional argument */ +int _PyOS_opterr = 1; /* generate error messages */ +Py_ssize_t _PyOS_optind = 1; /* index into argv array */ +const wchar_t *_PyOS_optarg = NULL; /* optional argument */ static wchar_t *opt_ptr = L""; @@ -61,7 +61,7 @@ void _PyOS_ResetGetOpt(void) opt_ptr = L""; } -int _PyOS_GetOpt(int argc, wchar_t **argv, int *longindex) +int _PyOS_GetOpt(Py_ssize_t argc, wchar_t **argv, int *longindex) { wchar_t *ptr; wchar_t option; diff --git a/Python/graminit.c b/Python/graminit.c index 6cb7bbc9f7..441502e908 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -106,7 +106,7 @@ static state states_5[3] = { {1, arcs_5_2}, }; static arc arcs_6_0[1] = { - {16, 1}, + {38, 1}, }; static arc arcs_6_1[1] = { {56, 2}, @@ -120,7 +120,7 @@ static state states_6[3] = { {1, arcs_6_2}, }; static arc arcs_7_0[1] = { - {21, 1}, + {19, 1}, }; static arc arcs_7_1[1] = { {40, 2}, @@ -583,7 +583,7 @@ static state states_19[2] = { {1, arcs_19_1}, }; static arc arcs_20_0[1] = { - {22, 1}, + {20, 1}, }; static arc arcs_20_1[1] = { {98, 2}, @@ -597,7 +597,7 @@ static state states_20[3] = { {1, arcs_20_2}, }; static arc arcs_21_0[1] = { - {31, 1}, + {29, 1}, }; static arc arcs_21_1[1] = { {0, 1}, @@ -621,7 +621,7 @@ static state states_22[2] = { {1, arcs_22_1}, }; static arc arcs_23_0[1] = { - {18, 1}, + {16, 1}, }; static arc arcs_23_1[1] = { {0, 1}, @@ -631,7 +631,7 @@ static state states_23[2] = { {1, arcs_23_1}, }; static arc arcs_24_0[1] = { - {20, 1}, + {18, 1}, }; static arc arcs_24_1[1] = { {0, 1}, @@ -641,7 +641,7 @@ static state states_24[2] = { {1, arcs_24_1}, }; static arc arcs_25_0[1] = { - {33, 1}, + {31, 1}, }; static arc arcs_25_1[2] = { {80, 2}, @@ -666,14 +666,14 @@ static state states_26[2] = { {1, arcs_26_1}, }; static arc arcs_27_0[1] = { - {32, 1}, + {30, 1}, }; static arc arcs_27_1[2] = { {60, 2}, {0, 1}, }; static arc arcs_27_2[2] = { - {24, 3}, + {22, 3}, {0, 2}, }; static arc arcs_27_3[1] = { @@ -701,7 +701,7 @@ static state states_28[2] = { {1, arcs_28_1}, }; static arc arcs_29_0[1] = { - {27, 1}, + {25, 1}, }; static arc arcs_29_1[1] = { {106, 2}, @@ -715,7 +715,7 @@ static state states_29[3] = { {1, arcs_29_2}, }; static arc arcs_30_0[1] = { - {24, 1}, + {22, 1}, }; static arc arcs_30_1[3] = { {107, 2}, @@ -725,11 +725,11 @@ static arc arcs_30_1[3] = { static arc arcs_30_2[4] = { {107, 2}, {9, 2}, - {27, 4}, + {25, 4}, {49, 3}, }; static arc arcs_30_3[1] = { - {27, 4}, + {25, 4}, }; static arc arcs_30_4[3] = { {5, 5}, @@ -832,7 +832,7 @@ static state states_35[2] = { {2, arcs_35_1}, }; static arc arcs_36_0[1] = { - {25, 1}, + {23, 1}, }; static arc arcs_36_1[1] = { {40, 2}, @@ -847,7 +847,7 @@ static state states_36[3] = { {2, arcs_36_2}, }; static arc arcs_37_0[1] = { - {29, 1}, + {27, 1}, }; static arc arcs_37_1[1] = { {40, 2}, @@ -903,7 +903,7 @@ static state states_39[2] = { {1, arcs_39_1}, }; static arc arcs_40_0[1] = { - {16, 1}, + {38, 1}, }; static arc arcs_40_1[3] = { {113, 2}, @@ -919,7 +919,7 @@ static state states_40[3] = { {1, arcs_40_2}, }; static arc arcs_41_0[1] = { - {26, 1}, + {24, 1}, }; static arc arcs_41_1[1] = { {118, 2}, @@ -955,7 +955,7 @@ static state states_41[8] = { {1, arcs_41_7}, }; static arc arcs_42_0[1] = { - {35, 1}, + {33, 1}, }; static arc arcs_42_1[1] = { {118, 2}, @@ -990,7 +990,7 @@ static state states_42[8] = { {1, arcs_42_7}, }; static arc arcs_43_0[1] = { - {23, 1}, + {21, 1}, }; static arc arcs_43_1[1] = { {98, 2}, @@ -1038,7 +1038,7 @@ static state states_43[11] = { {1, arcs_43_10}, }; static arc arcs_44_0[1] = { - {34, 1}, + {32, 1}, }; static arc arcs_44_1[1] = { {59, 2}, @@ -1097,7 +1097,7 @@ static state states_44[13] = { {2, arcs_44_12}, }; static arc arcs_45_0[1] = { - {36, 1}, + {34, 1}, }; static arc arcs_45_1[1] = { {125, 2}, @@ -1218,7 +1218,7 @@ static arc arcs_50_1[1] = { {0, 1}, }; static arc arcs_50_2[2] = { - {26, 3}, + {24, 3}, {0, 2}, }; static arc arcs_50_3[1] = { @@ -1250,7 +1250,7 @@ static state states_51[2] = { {1, arcs_51_1}, }; static arc arcs_52_0[1] = { - {28, 1}, + {26, 1}, }; static arc arcs_52_1[2] = { {59, 2}, @@ -1273,7 +1273,7 @@ static state states_52[5] = { {1, arcs_52_4}, }; static arc arcs_53_0[1] = { - {28, 1}, + {26, 1}, }; static arc arcs_53_1[2] = { {59, 2}, @@ -1318,7 +1318,7 @@ static state states_55[2] = { {2, arcs_55_1}, }; static arc arcs_56_0[2] = { - {30, 1}, + {28, 1}, {139, 2}, }; static arc arcs_56_1[1] = { @@ -1353,13 +1353,13 @@ static arc arcs_58_0[10] = { {146, 1}, {122, 1}, {147, 2}, - {30, 3}, + {28, 3}, }; static arc arcs_58_1[1] = { {0, 1}, }; static arc arcs_58_2[2] = { - {30, 1}, + {28, 1}, {0, 2}, }; static arc arcs_58_3[1] = { @@ -1460,7 +1460,7 @@ static state states_65[2] = { static arc arcs_66_0[4] = { {7, 1}, {8, 1}, - {39, 1}, + {37, 1}, {162, 2}, }; static arc arcs_66_1[1] = { @@ -1494,7 +1494,7 @@ static state states_67[4] = { {1, arcs_67_3}, }; static arc arcs_68_0[2] = { - {17, 1}, + {39, 1}, {164, 2}, }; static arc arcs_68_1[1] = { @@ -1516,7 +1516,7 @@ static arc arcs_69_0[10] = { {12, 2}, {13, 2}, {14, 3}, - {38, 4}, + {36, 4}, {40, 2}, {41, 2}, {42, 5}, @@ -1788,7 +1788,7 @@ static state states_77[14] = { {1, arcs_77_13}, }; static arc arcs_78_0[1] = { - {19, 1}, + {17, 1}, }; static arc arcs_78_1[1] = { {40, 2}, @@ -1874,7 +1874,7 @@ static state states_81[2] = { {1, arcs_81_1}, }; static arc arcs_82_0[1] = { - {23, 1}, + {21, 1}, }; static arc arcs_82_1[1] = { {98, 2}, @@ -1901,7 +1901,7 @@ static state states_82[6] = { {1, arcs_82_5}, }; static arc arcs_83_0[2] = { - {16, 1}, + {38, 1}, {177, 2}, }; static arc arcs_83_1[1] = { @@ -1916,7 +1916,7 @@ static state states_83[3] = { {1, arcs_83_2}, }; static arc arcs_84_0[1] = { - {26, 1}, + {24, 1}, }; static arc arcs_84_1[1] = { {133, 2}, @@ -1945,7 +1945,7 @@ static state states_85[2] = { {1, arcs_85_1}, }; static arc arcs_86_0[1] = { - {37, 1}, + {35, 1}, }; static arc arcs_86_1[2] = { {179, 2}, @@ -1960,7 +1960,7 @@ static state states_86[3] = { {1, arcs_86_2}, }; static arc arcs_87_0[2] = { - {24, 1}, + {22, 1}, {80, 2}, }; static arc arcs_87_1[1] = { @@ -2110,190 +2110,190 @@ static state states_91[11] = { {2, arcs_91_10}, }; static dfa dfas[92] = { - {256, "single_input", 0, 3, states_0, + {256, "single_input", 3, states_0, "\344\377\377\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {257, "file_input", 0, 2, states_1, + {257, "file_input", 2, states_1, "\344\377\377\377\377\027\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {258, "eval_input", 0, 3, states_2, - "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {259, "decorator", 0, 7, states_3, + {258, "eval_input", 3, states_2, + "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {259, "decorator", 7, states_3, "\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {260, "decorators", 0, 2, states_4, + {260, "decorators", 2, states_4, "\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {261, "decorated", 0, 3, states_5, + {261, "decorated", 3, states_5, "\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {262, "async_funcdef", 0, 3, states_6, - "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {263, "funcdef", 0, 9, states_7, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {264, "parameters", 0, 4, states_8, + {262, "async_funcdef", 3, states_6, + "\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {263, "funcdef", 9, states_7, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {264, "parameters", 4, states_8, "\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {265, "typedargslist", 0, 22, states_9, + {265, "typedargslist", 22, states_9, "\100\000\000\000\000\001\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {266, "tfpdef", 0, 4, states_10, + {266, "tfpdef", 4, states_10, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {267, "varargslist", 0, 18, states_11, + {267, "varargslist", 18, states_11, "\100\000\000\000\000\001\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {268, "vfpdef", 0, 2, states_12, + {268, "vfpdef", 2, states_12, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {269, "stmt", 0, 2, states_13, + {269, "stmt", 2, states_13, "\340\377\377\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {270, "simple_stmt", 0, 4, states_14, - "\340\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {271, "small_stmt", 0, 2, states_15, - "\340\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {272, "expr_stmt", 0, 6, states_16, - "\340\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {273, "annassign", 0, 5, states_17, + {270, "simple_stmt", 4, states_14, + "\340\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {271, "small_stmt", 2, states_15, + "\340\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {272, "expr_stmt", 6, states_16, + "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {273, "annassign", 5, states_17, "\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {274, "testlist_star_expr", 0, 3, states_18, - "\340\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {275, "augassign", 0, 2, states_19, + {274, "testlist_star_expr", 3, states_18, + "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {275, "augassign", 2, states_19, "\000\000\000\000\000\000\000\000\000\000\340\377\003\000\000\000\000\000\000\000\000\000\000"}, - {276, "del_stmt", 0, 3, states_20, - "\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {277, "pass_stmt", 0, 2, states_21, - "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {278, "flow_stmt", 0, 2, states_22, - "\000\000\024\000\043\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {279, "break_stmt", 0, 2, states_23, - "\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {280, "continue_stmt", 0, 2, states_24, + {276, "del_stmt", 3, states_20, "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {281, "return_stmt", 0, 3, states_25, - "\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {282, "yield_stmt", 0, 2, states_26, - "\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {283, "raise_stmt", 0, 5, states_27, - "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {284, "import_stmt", 0, 2, states_28, - "\000\000\000\011\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {285, "import_name", 0, 3, states_29, - "\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {286, "import_from", 0, 8, states_30, - "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {287, "import_as_name", 0, 4, states_31, + {277, "pass_stmt", 2, states_21, + "\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {278, "flow_stmt", 2, states_22, + "\000\000\005\300\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {279, "break_stmt", 2, states_23, + "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {280, "continue_stmt", 2, states_24, + "\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {281, "return_stmt", 3, states_25, + "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {282, "yield_stmt", 2, states_26, + "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {283, "raise_stmt", 5, states_27, + "\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {284, "import_stmt", 2, states_28, + "\000\000\100\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {285, "import_name", 3, states_29, + "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {286, "import_from", 8, states_30, + "\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {287, "import_as_name", 4, states_31, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {288, "dotted_as_name", 0, 4, states_32, + {288, "dotted_as_name", 4, states_32, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {289, "import_as_names", 0, 3, states_33, + {289, "import_as_names", 3, states_33, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {290, "dotted_as_names", 0, 2, states_34, + {290, "dotted_as_names", 2, states_34, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {291, "dotted_name", 0, 2, states_35, + {291, "dotted_name", 2, states_35, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {292, "global_stmt", 0, 3, states_36, - "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {293, "nonlocal_stmt", 0, 3, states_37, - "\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {294, "assert_stmt", 0, 5, states_38, - "\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {295, "compound_stmt", 0, 2, states_39, - "\000\004\251\004\034\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {296, "async_stmt", 0, 3, states_40, - "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {297, "if_stmt", 0, 8, states_41, - "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {298, "while_stmt", 0, 8, states_42, - "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {299, "for_stmt", 0, 11, states_43, + {292, "global_stmt", 3, states_36, "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {300, "try_stmt", 0, 13, states_44, + {293, "nonlocal_stmt", 3, states_37, + "\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {294, "assert_stmt", 5, states_38, + "\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {295, "compound_stmt", 2, states_39, + "\000\004\052\001\107\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {296, "async_stmt", 3, states_40, + "\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {297, "if_stmt", 8, states_41, + "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {298, "while_stmt", 8, states_42, + "\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {299, "for_stmt", 11, states_43, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {300, "try_stmt", 13, states_44, + "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {301, "with_stmt", 6, states_45, "\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {301, "with_stmt", 0, 6, states_45, - "\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {302, "with_item", 0, 4, states_46, - "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {303, "except_clause", 0, 5, states_47, + {302, "with_item", 4, states_46, + "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {303, "except_clause", 5, states_47, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000"}, - {304, "suite", 0, 5, states_48, - "\344\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {305, "namedexpr_test", 0, 4, states_49, - "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {306, "test", 0, 6, states_50, - "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {307, "test_nocond", 0, 2, states_51, - "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {308, "lambdef", 0, 5, states_52, - "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {309, "lambdef_nocond", 0, 5, states_53, - "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {310, "or_test", 0, 2, states_54, - "\240\173\002\100\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {311, "and_test", 0, 2, states_55, - "\240\173\002\100\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {312, "not_test", 0, 3, states_56, - "\240\173\002\100\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {313, "comparison", 0, 2, states_57, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {314, "comp_op", 0, 4, states_58, - "\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\004\000\340\017\000\000\000\000"}, - {315, "star_expr", 0, 3, states_59, + {304, "suite", 5, states_48, + "\344\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {305, "namedexpr_test", 4, states_49, + "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {306, "test", 6, states_50, + "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {307, "test_nocond", 2, states_51, + "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {308, "lambdef", 5, states_52, + "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {309, "lambdef_nocond", 5, states_53, + "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {310, "or_test", 2, states_54, + "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {311, "and_test", 2, states_55, + "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {312, "not_test", 3, states_56, + "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {313, "comparison", 2, states_57, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {314, "comp_op", 4, states_58, + "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\004\000\340\017\000\000\000\000"}, + {315, "star_expr", 3, states_59, "\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {316, "expr", 0, 2, states_60, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {317, "xor_expr", 0, 2, states_61, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {318, "and_expr", 0, 2, states_62, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {319, "shift_expr", 0, 2, states_63, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {320, "arith_expr", 0, 2, states_64, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {321, "term", 0, 2, states_65, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {322, "factor", 0, 3, states_66, - "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {323, "power", 0, 4, states_67, - "\040\172\002\000\100\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {324, "atom_expr", 0, 3, states_68, - "\040\172\002\000\100\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {325, "atom", 0, 9, states_69, - "\040\172\000\000\100\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {326, "testlist_comp", 0, 5, states_70, - "\340\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {327, "trailer", 0, 7, states_71, + {316, "expr", 2, states_60, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {317, "xor_expr", 2, states_61, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {318, "and_expr", 2, states_62, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {319, "shift_expr", 2, states_63, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {320, "arith_expr", 2, states_64, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {321, "term", 2, states_65, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {322, "factor", 3, states_66, + "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {323, "power", 4, states_67, + "\040\172\000\000\220\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {324, "atom_expr", 3, states_68, + "\040\172\000\000\220\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {325, "atom", 9, states_69, + "\040\172\000\000\020\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {326, "testlist_comp", 5, states_70, + "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {327, "trailer", 7, states_71, "\040\100\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"}, - {328, "subscriptlist", 0, 3, states_72, - "\240\173\002\120\300\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {329, "subscript", 0, 5, states_73, - "\240\173\002\120\300\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {330, "sliceop", 0, 3, states_74, + {328, "subscriptlist", 3, states_72, + "\240\173\000\024\260\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {329, "subscript", 5, states_73, + "\240\173\000\024\260\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {330, "sliceop", 3, states_74, "\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {331, "exprlist", 0, 3, states_75, - "\340\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {332, "testlist", 0, 3, states_76, - "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {333, "dictorsetmaker", 0, 14, states_77, - "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {334, "classdef", 0, 8, states_78, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {335, "arglist", 0, 3, states_79, - "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {336, "argument", 0, 4, states_80, - "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {337, "comp_iter", 0, 2, states_81, - "\000\000\201\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {338, "sync_comp_for", 0, 6, states_82, - "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {339, "comp_for", 0, 3, states_83, - "\000\000\201\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {340, "comp_if", 0, 4, states_84, - "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {341, "encoding_decl", 0, 2, states_85, + {331, "exprlist", 3, states_75, + "\340\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {332, "testlist", 3, states_76, + "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {333, "dictorsetmaker", 14, states_77, + "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {334, "classdef", 8, states_78, + "\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {335, "arglist", 3, states_79, + "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {336, "argument", 4, states_80, + "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {337, "comp_iter", 2, states_81, + "\000\000\040\001\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {338, "sync_comp_for", 6, states_82, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {339, "comp_for", 3, states_83, + "\000\000\040\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {340, "comp_if", 4, states_84, + "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {341, "encoding_decl", 2, states_85, "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {342, "yield_expr", 0, 3, states_86, - "\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {343, "yield_arg", 0, 3, states_87, - "\340\173\002\121\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {344, "func_body_suite", 0, 7, states_88, - "\344\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {345, "func_type_input", 0, 3, states_89, + {342, "yield_expr", 3, states_86, + "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {343, "yield_arg", 3, states_87, + "\340\173\100\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {344, "func_body_suite", 7, states_88, + "\344\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {345, "func_type_input", 3, states_89, "\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {346, "func_type", 0, 6, states_90, + {346, "func_type", 6, states_90, "\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {347, "typelist", 0, 11, states_91, - "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {347, "typelist", 11, states_91, + "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, }; static label labels[183] = { {0, "EMPTY"}, @@ -2312,8 +2312,6 @@ static label labels[183] = { {1, "True"}, {9, 0}, {1, "assert"}, - {1, "async"}, - {1, "await"}, {1, "break"}, {1, "class"}, {1, "continue"}, @@ -2336,6 +2334,8 @@ static label labels[183] = { {1, "yield"}, {25, 0}, {31, 0}, + {56, 0}, + {55, 0}, {1, 0}, {2, 0}, {3, 0}, @@ -2357,7 +2357,7 @@ static label labels[183] = { {51, 0}, {11, 0}, {306, 0}, - {56, 0}, + {58, 0}, {344, 0}, {265, 0}, {35, 0}, diff --git a/Python/hamt.c b/Python/hamt.c index aa90d37240..67af04c437 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -2005,7 +2005,7 @@ hamt_node_array_dump(PyHamtNode_Array *node, goto error; } - if (_hamt_dump_format(writer, "%d::\n", i)) { + if (_hamt_dump_format(writer, "%zd::\n", i)) { goto error; } diff --git a/Python/import.c b/Python/import.c index 898321ac3b..c00c3aa640 100644 --- a/Python/import.c +++ b/Python/import.c @@ -966,11 +966,10 @@ exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object Py_DECREF(v); m = PyImport_GetModule(name); - if (m == NULL) { + if (m == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_ImportError, "Loaded module %R not found in sys.modules", name); - return NULL; } return m; @@ -1735,6 +1734,10 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, } mod = PyImport_GetModule(abs_name); + if (mod == NULL && PyErr_Occurred()) { + goto error; + } + if (mod != NULL && mod != Py_None) { _Py_IDENTIFIER(__spec__); _Py_IDENTIFIER(_lock_unlock_module); @@ -1810,9 +1813,11 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, final_mod = PyImport_GetModule(to_return); Py_DECREF(to_return); if (final_mod == NULL) { - PyErr_Format(PyExc_KeyError, - "%R not in sys.modules as expected", - to_return); + if (!PyErr_Occurred()) { + PyErr_Format(PyExc_KeyError, + "%R not in sys.modules as expected", + to_return); + } goto error; } } @@ -1875,6 +1880,10 @@ PyImport_ReloadModule(PyObject *m) PyObject *reloaded_module = NULL; PyObject *imp = _PyImport_GetModuleId(&PyId_imp); if (imp == NULL) { + if (PyErr_Occurred()) { + return NULL; + } + imp = PyImport_ImportModule("imp"); if (imp == NULL) { return NULL; @@ -1983,13 +1992,14 @@ _imp_extension_suffixes_impl(PyObject *module) /*[clinic end generated code: output=0bf346e25a8f0cd3 input=ecdeeecfcb6f839e]*/ { PyObject *list; - const char *suffix; - unsigned int index = 0; list = PyList_New(0); if (list == NULL) return NULL; #ifdef HAVE_DYNAMIC_LOADING + const char *suffix; + unsigned int index = 0; + while ((suffix = _PyImport_DynLoadFiletab[index])) { PyObject *item = PyUnicode_FromString(suffix); if (item == NULL) { diff --git a/Python/importlib_external.h b/Python/importlib_external.h index ca83eb575c..ea4d895349 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -1771,883 +1771,892 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,22,0,0,0,8,2,4,6,8,4,8,4,8,3, 8,8,8,6,8,6,8,4,8,4,2,1,114,15,1,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,2,0, - 0,0,64,0,0,0,115,96,0,0,0,101,0,90,1,100, + 0,0,64,0,0,0,115,104,0,0,0,101,0,90,1,100, 0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100, 4,100,5,132,0,90,5,100,6,100,7,132,0,90,6,100, 8,100,9,132,0,90,7,100,10,100,11,132,0,90,8,100, 12,100,13,132,0,90,9,100,14,100,15,132,0,90,10,100, 16,100,17,132,0,90,11,100,18,100,19,132,0,90,12,100, - 20,100,21,132,0,90,13,100,22,83,0,41,23,218,14,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,97,38,1, - 0,0,82,101,112,114,101,115,101,110,116,115,32,97,32,110, - 97,109,101,115,112,97,99,101,32,112,97,99,107,97,103,101, - 39,115,32,112,97,116,104,46,32,32,73,116,32,117,115,101, - 115,32,116,104,101,32,109,111,100,117,108,101,32,110,97,109, - 101,10,32,32,32,32,116,111,32,102,105,110,100,32,105,116, - 115,32,112,97,114,101,110,116,32,109,111,100,117,108,101,44, - 32,97,110,100,32,102,114,111,109,32,116,104,101,114,101,32, - 105,116,32,108,111,111,107,115,32,117,112,32,116,104,101,32, - 112,97,114,101,110,116,39,115,10,32,32,32,32,95,95,112, - 97,116,104,95,95,46,32,32,87,104,101,110,32,116,104,105, - 115,32,99,104,97,110,103,101,115,44,32,116,104,101,32,109, - 111,100,117,108,101,39,115,32,111,119,110,32,112,97,116,104, - 32,105,115,32,114,101,99,111,109,112,117,116,101,100,44,10, - 32,32,32,32,117,115,105,110,103,32,112,97,116,104,95,102, - 105,110,100,101,114,46,32,32,70,111,114,32,116,111,112,45, - 108,101,118,101,108,32,109,111,100,117,108,101,115,44,32,116, - 104,101,32,112,97,114,101,110,116,32,109,111,100,117,108,101, - 39,115,32,112,97,116,104,10,32,32,32,32,105,115,32,115, - 121,115,46,112,97,116,104,46,99,4,0,0,0,0,0,0, - 0,4,0,0,0,3,0,0,0,67,0,0,0,115,36,0, - 0,0,124,1,124,0,95,0,124,2,124,0,95,1,116,2, - 124,0,160,3,161,0,131,1,124,0,95,4,124,3,124,0, - 95,5,100,0,83,0,114,110,0,0,0,41,6,218,5,95, - 110,97,109,101,218,5,95,112,97,116,104,114,112,0,0,0, - 218,16,95,103,101,116,95,112,97,114,101,110,116,95,112,97, - 116,104,218,17,95,108,97,115,116,95,112,97,114,101,110,116, - 95,112,97,116,104,218,12,95,112,97,116,104,95,102,105,110, - 100,101,114,169,4,114,119,0,0,0,114,117,0,0,0,114, - 44,0,0,0,90,11,112,97,116,104,95,102,105,110,100,101, - 114,114,3,0,0,0,114,3,0,0,0,114,6,0,0,0, - 114,209,0,0,0,106,4,0,0,115,8,0,0,0,0,1, - 6,1,6,1,14,1,122,23,95,78,97,109,101,115,112,97, - 99,101,80,97,116,104,46,95,95,105,110,105,116,95,95,99, - 1,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, - 67,0,0,0,115,38,0,0,0,124,0,106,0,160,1,100, - 1,161,1,92,3,125,1,125,2,125,3,124,2,100,2,107, - 2,114,30,100,3,83,0,124,1,100,4,102,2,83,0,41, - 5,122,62,82,101,116,117,114,110,115,32,97,32,116,117,112, - 108,101,32,111,102,32,40,112,97,114,101,110,116,45,109,111, - 100,117,108,101,45,110,97,109,101,44,32,112,97,114,101,110, - 116,45,112,97,116,104,45,97,116,116,114,45,110,97,109,101, - 41,114,71,0,0,0,114,40,0,0,0,41,2,114,8,0, - 0,0,114,44,0,0,0,90,8,95,95,112,97,116,104,95, - 95,41,2,114,23,1,0,0,114,41,0,0,0,41,4,114, - 119,0,0,0,114,13,1,0,0,218,3,100,111,116,90,2, - 109,101,114,3,0,0,0,114,3,0,0,0,114,6,0,0, - 0,218,23,95,102,105,110,100,95,112,97,114,101,110,116,95, - 112,97,116,104,95,110,97,109,101,115,112,4,0,0,115,8, - 0,0,0,0,2,18,1,8,2,4,3,122,38,95,78,97, - 109,101,115,112,97,99,101,80,97,116,104,46,95,102,105,110, - 100,95,112,97,114,101,110,116,95,112,97,116,104,95,110,97, - 109,101,115,99,1,0,0,0,0,0,0,0,3,0,0,0, - 3,0,0,0,67,0,0,0,115,28,0,0,0,124,0,160, - 0,161,0,92,2,125,1,125,2,116,1,116,2,106,3,124, - 1,25,0,124,2,131,2,83,0,114,110,0,0,0,41,4, - 114,30,1,0,0,114,130,0,0,0,114,8,0,0,0,218, - 7,109,111,100,117,108,101,115,41,3,114,119,0,0,0,90, - 18,112,97,114,101,110,116,95,109,111,100,117,108,101,95,110, - 97,109,101,90,14,112,97,116,104,95,97,116,116,114,95,110, - 97,109,101,114,3,0,0,0,114,3,0,0,0,114,6,0, - 0,0,114,25,1,0,0,122,4,0,0,115,4,0,0,0, - 0,1,12,1,122,31,95,78,97,109,101,115,112,97,99,101, - 80,97,116,104,46,95,103,101,116,95,112,97,114,101,110,116, - 95,112,97,116,104,99,1,0,0,0,0,0,0,0,3,0, - 0,0,4,0,0,0,67,0,0,0,115,80,0,0,0,116, - 0,124,0,160,1,161,0,131,1,125,1,124,1,124,0,106, - 2,107,3,114,74,124,0,160,3,124,0,106,4,124,1,161, - 2,125,2,124,2,100,0,107,9,114,68,124,2,106,5,100, - 0,107,8,114,68,124,2,106,6,114,68,124,2,106,6,124, - 0,95,7,124,1,124,0,95,2,124,0,106,7,83,0,114, - 110,0,0,0,41,8,114,112,0,0,0,114,25,1,0,0, - 114,26,1,0,0,114,27,1,0,0,114,23,1,0,0,114, - 140,0,0,0,114,178,0,0,0,114,24,1,0,0,41,3, - 114,119,0,0,0,90,11,112,97,114,101,110,116,95,112,97, - 116,104,114,187,0,0,0,114,3,0,0,0,114,3,0,0, - 0,114,6,0,0,0,218,12,95,114,101,99,97,108,99,117, - 108,97,116,101,126,4,0,0,115,16,0,0,0,0,2,12, - 1,10,1,14,3,18,1,6,1,8,1,6,1,122,27,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,114, - 101,99,97,108,99,117,108,97,116,101,99,1,0,0,0,0, - 0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115, - 12,0,0,0,116,0,124,0,160,1,161,0,131,1,83,0, - 114,110,0,0,0,41,2,114,5,1,0,0,114,32,1,0, - 0,114,246,0,0,0,114,3,0,0,0,114,3,0,0,0, - 114,6,0,0,0,218,8,95,95,105,116,101,114,95,95,139, - 4,0,0,115,2,0,0,0,0,1,122,23,95,78,97,109, - 101,115,112,97,99,101,80,97,116,104,46,95,95,105,116,101, - 114,95,95,99,3,0,0,0,0,0,0,0,3,0,0,0, - 3,0,0,0,67,0,0,0,115,14,0,0,0,124,2,124, - 0,106,0,124,1,60,0,100,0,83,0,114,110,0,0,0, - 41,1,114,24,1,0,0,41,3,114,119,0,0,0,218,5, - 105,110,100,101,120,114,44,0,0,0,114,3,0,0,0,114, - 3,0,0,0,114,6,0,0,0,218,11,95,95,115,101,116, - 105,116,101,109,95,95,142,4,0,0,115,2,0,0,0,0, - 1,122,26,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,95,115,101,116,105,116,101,109,95,95,99,1,0, + 20,100,21,132,0,90,13,100,22,100,23,132,0,90,14,100, + 24,83,0,41,25,218,14,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,97,38,1,0,0,82,101,112,114,101,115, + 101,110,116,115,32,97,32,110,97,109,101,115,112,97,99,101, + 32,112,97,99,107,97,103,101,39,115,32,112,97,116,104,46, + 32,32,73,116,32,117,115,101,115,32,116,104,101,32,109,111, + 100,117,108,101,32,110,97,109,101,10,32,32,32,32,116,111, + 32,102,105,110,100,32,105,116,115,32,112,97,114,101,110,116, + 32,109,111,100,117,108,101,44,32,97,110,100,32,102,114,111, + 109,32,116,104,101,114,101,32,105,116,32,108,111,111,107,115, + 32,117,112,32,116,104,101,32,112,97,114,101,110,116,39,115, + 10,32,32,32,32,95,95,112,97,116,104,95,95,46,32,32, + 87,104,101,110,32,116,104,105,115,32,99,104,97,110,103,101, + 115,44,32,116,104,101,32,109,111,100,117,108,101,39,115,32, + 111,119,110,32,112,97,116,104,32,105,115,32,114,101,99,111, + 109,112,117,116,101,100,44,10,32,32,32,32,117,115,105,110, + 103,32,112,97,116,104,95,102,105,110,100,101,114,46,32,32, + 70,111,114,32,116,111,112,45,108,101,118,101,108,32,109,111, + 100,117,108,101,115,44,32,116,104,101,32,112,97,114,101,110, + 116,32,109,111,100,117,108,101,39,115,32,112,97,116,104,10, + 32,32,32,32,105,115,32,115,121,115,46,112,97,116,104,46, + 99,4,0,0,0,0,0,0,0,4,0,0,0,3,0,0, + 0,67,0,0,0,115,36,0,0,0,124,1,124,0,95,0, + 124,2,124,0,95,1,116,2,124,0,160,3,161,0,131,1, + 124,0,95,4,124,3,124,0,95,5,100,0,83,0,114,110, + 0,0,0,41,6,218,5,95,110,97,109,101,218,5,95,112, + 97,116,104,114,112,0,0,0,218,16,95,103,101,116,95,112, + 97,114,101,110,116,95,112,97,116,104,218,17,95,108,97,115, + 116,95,112,97,114,101,110,116,95,112,97,116,104,218,12,95, + 112,97,116,104,95,102,105,110,100,101,114,169,4,114,119,0, + 0,0,114,117,0,0,0,114,44,0,0,0,90,11,112,97, + 116,104,95,102,105,110,100,101,114,114,3,0,0,0,114,3, + 0,0,0,114,6,0,0,0,114,209,0,0,0,106,4,0, + 0,115,8,0,0,0,0,1,6,1,6,1,14,1,122,23, + 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, + 95,105,110,105,116,95,95,99,1,0,0,0,0,0,0,0, + 4,0,0,0,3,0,0,0,67,0,0,0,115,38,0,0, + 0,124,0,106,0,160,1,100,1,161,1,92,3,125,1,125, + 2,125,3,124,2,100,2,107,2,114,30,100,3,83,0,124, + 1,100,4,102,2,83,0,41,5,122,62,82,101,116,117,114, + 110,115,32,97,32,116,117,112,108,101,32,111,102,32,40,112, + 97,114,101,110,116,45,109,111,100,117,108,101,45,110,97,109, + 101,44,32,112,97,114,101,110,116,45,112,97,116,104,45,97, + 116,116,114,45,110,97,109,101,41,114,71,0,0,0,114,40, + 0,0,0,41,2,114,8,0,0,0,114,44,0,0,0,90, + 8,95,95,112,97,116,104,95,95,41,2,114,23,1,0,0, + 114,41,0,0,0,41,4,114,119,0,0,0,114,13,1,0, + 0,218,3,100,111,116,90,2,109,101,114,3,0,0,0,114, + 3,0,0,0,114,6,0,0,0,218,23,95,102,105,110,100, + 95,112,97,114,101,110,116,95,112,97,116,104,95,110,97,109, + 101,115,112,4,0,0,115,8,0,0,0,0,2,18,1,8, + 2,4,3,122,38,95,78,97,109,101,115,112,97,99,101,80, + 97,116,104,46,95,102,105,110,100,95,112,97,114,101,110,116, + 95,112,97,116,104,95,110,97,109,101,115,99,1,0,0,0, + 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, + 115,28,0,0,0,124,0,160,0,161,0,92,2,125,1,125, + 2,116,1,116,2,106,3,124,1,25,0,124,2,131,2,83, + 0,114,110,0,0,0,41,4,114,30,1,0,0,114,130,0, + 0,0,114,8,0,0,0,218,7,109,111,100,117,108,101,115, + 41,3,114,119,0,0,0,90,18,112,97,114,101,110,116,95, + 109,111,100,117,108,101,95,110,97,109,101,90,14,112,97,116, + 104,95,97,116,116,114,95,110,97,109,101,114,3,0,0,0, + 114,3,0,0,0,114,6,0,0,0,114,25,1,0,0,122, + 4,0,0,115,4,0,0,0,0,1,12,1,122,31,95,78, + 97,109,101,115,112,97,99,101,80,97,116,104,46,95,103,101, + 116,95,112,97,114,101,110,116,95,112,97,116,104,99,1,0, + 0,0,0,0,0,0,3,0,0,0,4,0,0,0,67,0, + 0,0,115,80,0,0,0,116,0,124,0,160,1,161,0,131, + 1,125,1,124,1,124,0,106,2,107,3,114,74,124,0,160, + 3,124,0,106,4,124,1,161,2,125,2,124,2,100,0,107, + 9,114,68,124,2,106,5,100,0,107,8,114,68,124,2,106, + 6,114,68,124,2,106,6,124,0,95,7,124,1,124,0,95, + 2,124,0,106,7,83,0,114,110,0,0,0,41,8,114,112, + 0,0,0,114,25,1,0,0,114,26,1,0,0,114,27,1, + 0,0,114,23,1,0,0,114,140,0,0,0,114,178,0,0, + 0,114,24,1,0,0,41,3,114,119,0,0,0,90,11,112, + 97,114,101,110,116,95,112,97,116,104,114,187,0,0,0,114, + 3,0,0,0,114,3,0,0,0,114,6,0,0,0,218,12, + 95,114,101,99,97,108,99,117,108,97,116,101,126,4,0,0, + 115,16,0,0,0,0,2,12,1,10,1,14,3,18,1,6, + 1,8,1,6,1,122,27,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,46,95,114,101,99,97,108,99,117,108,97, + 116,101,99,1,0,0,0,0,0,0,0,1,0,0,0,3, + 0,0,0,67,0,0,0,115,12,0,0,0,116,0,124,0, + 160,1,161,0,131,1,83,0,114,110,0,0,0,41,2,114, + 5,1,0,0,114,32,1,0,0,114,246,0,0,0,114,3, + 0,0,0,114,3,0,0,0,114,6,0,0,0,218,8,95, + 95,105,116,101,114,95,95,139,4,0,0,115,2,0,0,0, + 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,105,116,101,114,95,95,99,2,0,0,0, + 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, + 115,12,0,0,0,124,0,160,0,161,0,124,1,25,0,83, + 0,114,110,0,0,0,169,1,114,32,1,0,0,41,2,114, + 119,0,0,0,218,5,105,110,100,101,120,114,3,0,0,0, + 114,3,0,0,0,114,6,0,0,0,218,11,95,95,103,101, + 116,105,116,101,109,95,95,142,4,0,0,115,2,0,0,0, + 0,1,122,26,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,103,101,116,105,116,101,109,95,95,99,3, + 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, + 0,0,0,115,14,0,0,0,124,2,124,0,106,0,124,1, + 60,0,100,0,83,0,114,110,0,0,0,41,1,114,24,1, + 0,0,41,3,114,119,0,0,0,114,35,1,0,0,114,44, + 0,0,0,114,3,0,0,0,114,3,0,0,0,114,6,0, + 0,0,218,11,95,95,115,101,116,105,116,101,109,95,95,145, + 4,0,0,115,2,0,0,0,0,1,122,26,95,78,97,109, + 101,115,112,97,99,101,80,97,116,104,46,95,95,115,101,116, + 105,116,101,109,95,95,99,1,0,0,0,0,0,0,0,1, + 0,0,0,3,0,0,0,67,0,0,0,115,12,0,0,0, + 116,0,124,0,160,1,161,0,131,1,83,0,114,110,0,0, + 0,41,2,114,22,0,0,0,114,32,1,0,0,114,246,0, + 0,0,114,3,0,0,0,114,3,0,0,0,114,6,0,0, + 0,218,7,95,95,108,101,110,95,95,148,4,0,0,115,2, + 0,0,0,0,1,122,22,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,46,95,95,108,101,110,95,95,99,1,0, 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, - 0,0,115,12,0,0,0,116,0,124,0,160,1,161,0,131, - 1,83,0,114,110,0,0,0,41,2,114,22,0,0,0,114, - 32,1,0,0,114,246,0,0,0,114,3,0,0,0,114,3, - 0,0,0,114,6,0,0,0,218,7,95,95,108,101,110,95, - 95,145,4,0,0,115,2,0,0,0,0,1,122,22,95,78, - 97,109,101,115,112,97,99,101,80,97,116,104,46,95,95,108, - 101,110,95,95,99,1,0,0,0,0,0,0,0,1,0,0, - 0,3,0,0,0,67,0,0,0,115,12,0,0,0,100,1, - 160,0,124,0,106,1,161,1,83,0,41,2,78,122,20,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,40,123,33, - 114,125,41,41,2,114,62,0,0,0,114,24,1,0,0,114, - 246,0,0,0,114,3,0,0,0,114,3,0,0,0,114,6, - 0,0,0,218,8,95,95,114,101,112,114,95,95,148,4,0, - 0,115,2,0,0,0,0,1,122,23,95,78,97,109,101,115, - 112,97,99,101,80,97,116,104,46,95,95,114,101,112,114,95, - 95,99,2,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,67,0,0,0,115,12,0,0,0,124,1,124,0,160, - 0,161,0,107,6,83,0,114,110,0,0,0,41,1,114,32, - 1,0,0,169,2,114,119,0,0,0,218,4,105,116,101,109, - 114,3,0,0,0,114,3,0,0,0,114,6,0,0,0,218, - 12,95,95,99,111,110,116,97,105,110,115,95,95,151,4,0, - 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, - 112,97,99,101,80,97,116,104,46,95,95,99,111,110,116,97, - 105,110,115,95,95,99,2,0,0,0,0,0,0,0,2,0, - 0,0,3,0,0,0,67,0,0,0,115,16,0,0,0,124, - 0,106,0,160,1,124,1,161,1,1,0,100,0,83,0,114, - 110,0,0,0,41,2,114,24,1,0,0,114,186,0,0,0, - 114,38,1,0,0,114,3,0,0,0,114,3,0,0,0,114, - 6,0,0,0,114,186,0,0,0,154,4,0,0,115,2,0, - 0,0,0,1,122,21,95,78,97,109,101,115,112,97,99,101, - 80,97,116,104,46,97,112,112,101,110,100,78,41,14,114,125, - 0,0,0,114,124,0,0,0,114,126,0,0,0,114,127,0, - 0,0,114,209,0,0,0,114,30,1,0,0,114,25,1,0, - 0,114,32,1,0,0,114,33,1,0,0,114,35,1,0,0, - 114,36,1,0,0,114,37,1,0,0,114,40,1,0,0,114, - 186,0,0,0,114,3,0,0,0,114,3,0,0,0,114,3, - 0,0,0,114,6,0,0,0,114,22,1,0,0,99,4,0, - 0,115,22,0,0,0,8,1,4,6,8,6,8,10,8,4, - 8,13,8,3,8,3,8,3,8,3,8,3,114,22,1,0, - 0,99,0,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,64,0,0,0,115,80,0,0,0,101,0,90,1,100, - 0,90,2,100,1,100,2,132,0,90,3,101,4,100,3,100, - 4,132,0,131,1,90,5,100,5,100,6,132,0,90,6,100, - 7,100,8,132,0,90,7,100,9,100,10,132,0,90,8,100, - 11,100,12,132,0,90,9,100,13,100,14,132,0,90,10,100, - 15,100,16,132,0,90,11,100,17,83,0,41,18,218,16,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,99, - 4,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0, - 67,0,0,0,115,18,0,0,0,116,0,124,1,124,2,124, - 3,131,3,124,0,95,1,100,0,83,0,114,110,0,0,0, - 41,2,114,22,1,0,0,114,24,1,0,0,114,28,1,0, - 0,114,3,0,0,0,114,3,0,0,0,114,6,0,0,0, - 114,209,0,0,0,160,4,0,0,115,2,0,0,0,0,1, - 122,25,95,78,97,109,101,115,112,97,99,101,76,111,97,100, - 101,114,46,95,95,105,110,105,116,95,95,99,2,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, - 115,12,0,0,0,100,1,160,0,124,1,106,1,161,1,83, - 0,41,2,122,115,82,101,116,117,114,110,32,114,101,112,114, - 32,102,111,114,32,116,104,101,32,109,111,100,117,108,101,46, - 10,10,32,32,32,32,32,32,32,32,84,104,101,32,109,101, - 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,84,104,101,32,105,109,112,111,114,116,32, - 109,97,99,104,105,110,101,114,121,32,100,111,101,115,32,116, - 104,101,32,106,111,98,32,105,116,115,101,108,102,46,10,10, - 32,32,32,32,32,32,32,32,122,25,60,109,111,100,117,108, - 101,32,123,33,114,125,32,40,110,97,109,101,115,112,97,99, - 101,41,62,41,2,114,62,0,0,0,114,125,0,0,0,41, - 2,114,193,0,0,0,114,216,0,0,0,114,3,0,0,0, - 114,3,0,0,0,114,6,0,0,0,218,11,109,111,100,117, - 108,101,95,114,101,112,114,163,4,0,0,115,2,0,0,0, - 0,7,122,28,95,78,97,109,101,115,112,97,99,101,76,111, - 97,100,101,114,46,109,111,100,117,108,101,95,114,101,112,114, - 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, - 0,67,0,0,0,115,4,0,0,0,100,1,83,0,41,2, - 78,84,114,3,0,0,0,114,219,0,0,0,114,3,0,0, - 0,114,3,0,0,0,114,6,0,0,0,114,182,0,0,0, - 172,4,0,0,115,2,0,0,0,0,1,122,27,95,78,97, - 109,101,115,112,97,99,101,76,111,97,100,101,114,46,105,115, - 95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0, - 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, - 0,0,100,1,83,0,41,2,78,114,40,0,0,0,114,3, - 0,0,0,114,219,0,0,0,114,3,0,0,0,114,3,0, - 0,0,114,6,0,0,0,114,229,0,0,0,175,4,0,0, - 115,2,0,0,0,0,1,122,27,95,78,97,109,101,115,112, - 97,99,101,76,111,97,100,101,114,46,103,101,116,95,115,111, - 117,114,99,101,99,2,0,0,0,0,0,0,0,2,0,0, - 0,6,0,0,0,67,0,0,0,115,16,0,0,0,116,0, - 100,1,100,2,100,3,100,4,100,5,141,4,83,0,41,6, - 78,114,40,0,0,0,122,8,60,115,116,114,105,110,103,62, - 114,215,0,0,0,84,41,1,114,231,0,0,0,41,1,114, - 232,0,0,0,114,219,0,0,0,114,3,0,0,0,114,3, - 0,0,0,114,6,0,0,0,114,213,0,0,0,178,4,0, - 0,115,2,0,0,0,0,1,122,25,95,78,97,109,101,115, - 112,97,99,101,76,111,97,100,101,114,46,103,101,116,95,99, - 111,100,101,99,2,0,0,0,0,0,0,0,2,0,0,0, - 1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,83, - 0,114,210,0,0,0,114,3,0,0,0,114,211,0,0,0, - 114,3,0,0,0,114,3,0,0,0,114,6,0,0,0,114, - 212,0,0,0,181,4,0,0,115,2,0,0,0,0,1,122, - 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, - 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, - 67,0,0,0,115,4,0,0,0,100,0,83,0,114,110,0, - 0,0,114,3,0,0,0,114,252,0,0,0,114,3,0,0, - 0,114,3,0,0,0,114,6,0,0,0,114,217,0,0,0, - 184,4,0,0,115,2,0,0,0,0,1,122,28,95,78,97, - 109,101,115,112,97,99,101,76,111,97,100,101,114,46,101,120, - 101,99,95,109,111,100,117,108,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,4,0,0,0,67,0,0,0,115,26, - 0,0,0,116,0,160,1,100,1,124,0,106,2,161,2,1, - 0,116,0,160,3,124,0,124,1,161,2,83,0,41,2,122, - 98,76,111,97,100,32,97,32,110,97,109,101,115,112,97,99, - 101,32,109,111,100,117,108,101,46,10,10,32,32,32,32,32, - 32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,105, - 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,85, - 115,101,32,101,120,101,99,95,109,111,100,117,108,101,40,41, - 32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,32, - 32,32,32,122,38,110,97,109,101,115,112,97,99,101,32,109, - 111,100,117,108,101,32,108,111,97,100,101,100,32,119,105,116, - 104,32,112,97,116,104,32,123,33,114,125,41,4,114,134,0, - 0,0,114,149,0,0,0,114,24,1,0,0,114,218,0,0, + 0,0,115,12,0,0,0,100,1,160,0,124,0,106,1,161, + 1,83,0,41,2,78,122,20,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,40,123,33,114,125,41,41,2,114,62, + 0,0,0,114,24,1,0,0,114,246,0,0,0,114,3,0, + 0,0,114,3,0,0,0,114,6,0,0,0,218,8,95,95, + 114,101,112,114,95,95,151,4,0,0,115,2,0,0,0,0, + 1,122,23,95,78,97,109,101,115,112,97,99,101,80,97,116, + 104,46,95,95,114,101,112,114,95,95,99,2,0,0,0,0, + 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, + 12,0,0,0,124,1,124,0,160,0,161,0,107,6,83,0, + 114,110,0,0,0,114,34,1,0,0,169,2,114,119,0,0, + 0,218,4,105,116,101,109,114,3,0,0,0,114,3,0,0, + 0,114,6,0,0,0,218,12,95,95,99,111,110,116,97,105, + 110,115,95,95,154,4,0,0,115,2,0,0,0,0,1,122, + 27,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, + 95,95,99,111,110,116,97,105,110,115,95,95,99,2,0,0, + 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, + 0,115,16,0,0,0,124,0,106,0,160,1,124,1,161,1, + 1,0,100,0,83,0,114,110,0,0,0,41,2,114,24,1, + 0,0,114,186,0,0,0,114,40,1,0,0,114,3,0,0, + 0,114,3,0,0,0,114,6,0,0,0,114,186,0,0,0, + 157,4,0,0,115,2,0,0,0,0,1,122,21,95,78,97, + 109,101,115,112,97,99,101,80,97,116,104,46,97,112,112,101, + 110,100,78,41,15,114,125,0,0,0,114,124,0,0,0,114, + 126,0,0,0,114,127,0,0,0,114,209,0,0,0,114,30, + 1,0,0,114,25,1,0,0,114,32,1,0,0,114,33,1, + 0,0,114,36,1,0,0,114,37,1,0,0,114,38,1,0, + 0,114,39,1,0,0,114,42,1,0,0,114,186,0,0,0, + 114,3,0,0,0,114,3,0,0,0,114,3,0,0,0,114, + 6,0,0,0,114,22,1,0,0,99,4,0,0,115,24,0, + 0,0,8,1,4,6,8,6,8,10,8,4,8,13,8,3, + 8,3,8,3,8,3,8,3,8,3,114,22,1,0,0,99, + 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 64,0,0,0,115,80,0,0,0,101,0,90,1,100,0,90, + 2,100,1,100,2,132,0,90,3,101,4,100,3,100,4,132, + 0,131,1,90,5,100,5,100,6,132,0,90,6,100,7,100, + 8,132,0,90,7,100,9,100,10,132,0,90,8,100,11,100, + 12,132,0,90,9,100,13,100,14,132,0,90,10,100,15,100, + 16,132,0,90,11,100,17,83,0,41,18,218,16,95,78,97, + 109,101,115,112,97,99,101,76,111,97,100,101,114,99,4,0, + 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, + 0,0,115,18,0,0,0,116,0,124,1,124,2,124,3,131, + 3,124,0,95,1,100,0,83,0,114,110,0,0,0,41,2, + 114,22,1,0,0,114,24,1,0,0,114,28,1,0,0,114, + 3,0,0,0,114,3,0,0,0,114,6,0,0,0,114,209, + 0,0,0,163,4,0,0,115,2,0,0,0,0,1,122,25, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,0, + 0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,12, + 0,0,0,100,1,160,0,124,1,106,1,161,1,83,0,41, + 2,122,115,82,101,116,117,114,110,32,114,101,112,114,32,102, + 111,114,32,116,104,101,32,109,111,100,117,108,101,46,10,10, + 32,32,32,32,32,32,32,32,84,104,101,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,84,104,101,32,105,109,112,111,114,116,32,109,97, + 99,104,105,110,101,114,121,32,100,111,101,115,32,116,104,101, + 32,106,111,98,32,105,116,115,101,108,102,46,10,10,32,32, + 32,32,32,32,32,32,122,25,60,109,111,100,117,108,101,32, + 123,33,114,125,32,40,110,97,109,101,115,112,97,99,101,41, + 62,41,2,114,62,0,0,0,114,125,0,0,0,41,2,114, + 193,0,0,0,114,216,0,0,0,114,3,0,0,0,114,3, + 0,0,0,114,6,0,0,0,218,11,109,111,100,117,108,101, + 95,114,101,112,114,166,4,0,0,115,2,0,0,0,0,7, + 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, + 101,114,46,109,111,100,117,108,101,95,114,101,112,114,99,2, + 0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67, + 0,0,0,115,4,0,0,0,100,1,83,0,41,2,78,84, + 114,3,0,0,0,114,219,0,0,0,114,3,0,0,0,114, + 3,0,0,0,114,6,0,0,0,114,182,0,0,0,175,4, + 0,0,115,2,0,0,0,0,1,122,27,95,78,97,109,101, + 115,112,97,99,101,76,111,97,100,101,114,46,105,115,95,112, + 97,99,107,97,103,101,99,2,0,0,0,0,0,0,0,2, + 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, + 100,1,83,0,41,2,78,114,40,0,0,0,114,3,0,0, 0,114,219,0,0,0,114,3,0,0,0,114,3,0,0,0, - 114,6,0,0,0,114,220,0,0,0,187,4,0,0,115,8, - 0,0,0,0,7,6,1,4,255,4,2,122,28,95,78,97, - 109,101,115,112,97,99,101,76,111,97,100,101,114,46,108,111, - 97,100,95,109,111,100,117,108,101,78,41,12,114,125,0,0, - 0,114,124,0,0,0,114,126,0,0,0,114,209,0,0,0, - 114,207,0,0,0,114,42,1,0,0,114,182,0,0,0,114, - 229,0,0,0,114,213,0,0,0,114,212,0,0,0,114,217, - 0,0,0,114,220,0,0,0,114,3,0,0,0,114,3,0, - 0,0,114,3,0,0,0,114,6,0,0,0,114,41,1,0, - 0,159,4,0,0,115,18,0,0,0,8,1,8,3,2,1, - 10,8,8,3,8,3,8,3,8,3,8,3,114,41,1,0, - 0,99,0,0,0,0,0,0,0,0,0,0,0,0,4,0, - 0,0,64,0,0,0,115,106,0,0,0,101,0,90,1,100, - 0,90,2,100,1,90,3,101,4,100,2,100,3,132,0,131, - 1,90,5,101,4,100,4,100,5,132,0,131,1,90,6,101, - 4,100,6,100,7,132,0,131,1,90,7,101,4,100,8,100, - 9,132,0,131,1,90,8,101,4,100,17,100,11,100,12,132, - 1,131,1,90,9,101,4,100,18,100,13,100,14,132,1,131, - 1,90,10,101,4,100,19,100,15,100,16,132,1,131,1,90, - 11,100,10,83,0,41,20,218,10,80,97,116,104,70,105,110, - 100,101,114,122,62,77,101,116,97,32,112,97,116,104,32,102, - 105,110,100,101,114,32,102,111,114,32,115,121,115,46,112,97, - 116,104,32,97,110,100,32,112,97,99,107,97,103,101,32,95, - 95,112,97,116,104,95,95,32,97,116,116,114,105,98,117,116, - 101,115,46,99,1,0,0,0,0,0,0,0,3,0,0,0, - 4,0,0,0,67,0,0,0,115,64,0,0,0,116,0,116, - 1,106,2,160,3,161,0,131,1,68,0,93,44,92,2,125, - 1,125,2,124,2,100,1,107,8,114,40,116,1,106,2,124, - 1,61,0,113,14,116,4,124,2,100,2,131,2,114,14,124, - 2,160,5,161,0,1,0,113,14,100,1,83,0,41,3,122, - 125,67,97,108,108,32,116,104,101,32,105,110,118,97,108,105, - 100,97,116,101,95,99,97,99,104,101,115,40,41,32,109,101, - 116,104,111,100,32,111,110,32,97,108,108,32,112,97,116,104, - 32,101,110,116,114,121,32,102,105,110,100,101,114,115,10,32, - 32,32,32,32,32,32,32,115,116,111,114,101,100,32,105,110, - 32,115,121,115,46,112,97,116,104,95,105,109,112,111,114,116, - 101,114,95,99,97,99,104,101,115,32,40,119,104,101,114,101, - 32,105,109,112,108,101,109,101,110,116,101,100,41,46,78,218, - 17,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, - 101,115,41,6,218,4,108,105,115,116,114,8,0,0,0,218, - 19,112,97,116,104,95,105,109,112,111,114,116,101,114,95,99, - 97,99,104,101,218,5,105,116,101,109,115,114,128,0,0,0, - 114,44,1,0,0,41,3,114,193,0,0,0,114,117,0,0, - 0,218,6,102,105,110,100,101,114,114,3,0,0,0,114,3, - 0,0,0,114,6,0,0,0,114,44,1,0,0,205,4,0, - 0,115,10,0,0,0,0,4,22,1,8,1,10,1,10,1, - 122,28,80,97,116,104,70,105,110,100,101,114,46,105,110,118, - 97,108,105,100,97,116,101,95,99,97,99,104,101,115,99,2, - 0,0,0,0,0,0,0,3,0,0,0,9,0,0,0,67, - 0,0,0,115,84,0,0,0,116,0,106,1,100,1,107,9, - 114,28,116,0,106,1,115,28,116,2,160,3,100,2,116,4, - 161,2,1,0,116,0,106,1,68,0,93,44,125,2,122,14, - 124,2,124,1,131,1,87,0,2,0,1,0,83,0,4,0, - 116,5,107,10,114,76,1,0,1,0,1,0,89,0,113,34, - 89,0,113,34,88,0,113,34,100,1,83,0,41,3,122,46, - 83,101,97,114,99,104,32,115,121,115,46,112,97,116,104,95, - 104,111,111,107,115,32,102,111,114,32,97,32,102,105,110,100, - 101,114,32,102,111,114,32,39,112,97,116,104,39,46,78,122, - 23,115,121,115,46,112,97,116,104,95,104,111,111,107,115,32, - 105,115,32,101,109,112,116,121,41,6,114,8,0,0,0,218, - 10,112,97,116,104,95,104,111,111,107,115,114,75,0,0,0, - 114,76,0,0,0,114,138,0,0,0,114,118,0,0,0,41, - 3,114,193,0,0,0,114,44,0,0,0,90,4,104,111,111, - 107,114,3,0,0,0,114,3,0,0,0,114,6,0,0,0, - 218,11,95,112,97,116,104,95,104,111,111,107,115,215,4,0, - 0,115,16,0,0,0,0,3,16,1,12,1,10,1,2,1, - 14,1,14,1,12,2,122,22,80,97,116,104,70,105,110,100, - 101,114,46,95,112,97,116,104,95,104,111,111,107,115,99,2, - 0,0,0,0,0,0,0,3,0,0,0,8,0,0,0,67, - 0,0,0,115,104,0,0,0,124,1,100,1,107,2,114,44, - 122,12,116,0,160,1,161,0,125,1,87,0,110,22,4,0, - 116,2,107,10,114,42,1,0,1,0,1,0,89,0,100,2, - 83,0,88,0,122,14,116,3,106,4,124,1,25,0,125,2, - 87,0,110,40,4,0,116,5,107,10,114,98,1,0,1,0, - 1,0,124,0,160,6,124,1,161,1,125,2,124,2,116,3, - 106,4,124,1,60,0,89,0,110,2,88,0,124,2,83,0, - 41,3,122,210,71,101,116,32,116,104,101,32,102,105,110,100, - 101,114,32,102,111,114,32,116,104,101,32,112,97,116,104,32, - 101,110,116,114,121,32,102,114,111,109,32,115,121,115,46,112, + 114,6,0,0,0,114,229,0,0,0,178,4,0,0,115,2, + 0,0,0,0,1,122,27,95,78,97,109,101,115,112,97,99, + 101,76,111,97,100,101,114,46,103,101,116,95,115,111,117,114, + 99,101,99,2,0,0,0,0,0,0,0,2,0,0,0,6, + 0,0,0,67,0,0,0,115,16,0,0,0,116,0,100,1, + 100,2,100,3,100,4,100,5,141,4,83,0,41,6,78,114, + 40,0,0,0,122,8,60,115,116,114,105,110,103,62,114,215, + 0,0,0,84,41,1,114,231,0,0,0,41,1,114,232,0, + 0,0,114,219,0,0,0,114,3,0,0,0,114,3,0,0, + 0,114,6,0,0,0,114,213,0,0,0,181,4,0,0,115, + 2,0,0,0,0,1,122,25,95,78,97,109,101,115,112,97, + 99,101,76,111,97,100,101,114,46,103,101,116,95,99,111,100, + 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, + 0,0,67,0,0,0,115,4,0,0,0,100,1,83,0,114, + 210,0,0,0,114,3,0,0,0,114,211,0,0,0,114,3, + 0,0,0,114,3,0,0,0,114,6,0,0,0,114,212,0, + 0,0,184,4,0,0,115,2,0,0,0,0,1,122,30,95, + 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, + 99,114,101,97,116,101,95,109,111,100,117,108,101,99,2,0, + 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, + 0,0,115,4,0,0,0,100,0,83,0,114,110,0,0,0, + 114,3,0,0,0,114,252,0,0,0,114,3,0,0,0,114, + 3,0,0,0,114,6,0,0,0,114,217,0,0,0,187,4, + 0,0,115,2,0,0,0,0,1,122,28,95,78,97,109,101, + 115,112,97,99,101,76,111,97,100,101,114,46,101,120,101,99, + 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, + 2,0,0,0,4,0,0,0,67,0,0,0,115,26,0,0, + 0,116,0,160,1,100,1,124,0,106,2,161,2,1,0,116, + 0,160,3,124,0,124,1,161,2,83,0,41,2,122,98,76, + 111,97,100,32,97,32,110,97,109,101,115,112,97,99,101,32, + 109,111,100,117,108,101,46,10,10,32,32,32,32,32,32,32, + 32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32, + 100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101, + 32,101,120,101,99,95,109,111,100,117,108,101,40,41,32,105, + 110,115,116,101,97,100,46,10,10,32,32,32,32,32,32,32, + 32,122,38,110,97,109,101,115,112,97,99,101,32,109,111,100, + 117,108,101,32,108,111,97,100,101,100,32,119,105,116,104,32, + 112,97,116,104,32,123,33,114,125,41,4,114,134,0,0,0, + 114,149,0,0,0,114,24,1,0,0,114,218,0,0,0,114, + 219,0,0,0,114,3,0,0,0,114,3,0,0,0,114,6, + 0,0,0,114,220,0,0,0,190,4,0,0,115,8,0,0, + 0,0,7,6,1,4,255,4,2,122,28,95,78,97,109,101, + 115,112,97,99,101,76,111,97,100,101,114,46,108,111,97,100, + 95,109,111,100,117,108,101,78,41,12,114,125,0,0,0,114, + 124,0,0,0,114,126,0,0,0,114,209,0,0,0,114,207, + 0,0,0,114,44,1,0,0,114,182,0,0,0,114,229,0, + 0,0,114,213,0,0,0,114,212,0,0,0,114,217,0,0, + 0,114,220,0,0,0,114,3,0,0,0,114,3,0,0,0, + 114,3,0,0,0,114,6,0,0,0,114,43,1,0,0,162, + 4,0,0,115,18,0,0,0,8,1,8,3,2,1,10,8, + 8,3,8,3,8,3,8,3,8,3,114,43,1,0,0,99, + 0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0, + 64,0,0,0,115,106,0,0,0,101,0,90,1,100,0,90, + 2,100,1,90,3,101,4,100,2,100,3,132,0,131,1,90, + 5,101,4,100,4,100,5,132,0,131,1,90,6,101,4,100, + 6,100,7,132,0,131,1,90,7,101,4,100,8,100,9,132, + 0,131,1,90,8,101,4,100,17,100,11,100,12,132,1,131, + 1,90,9,101,4,100,18,100,13,100,14,132,1,131,1,90, + 10,101,4,100,19,100,15,100,16,132,1,131,1,90,11,100, + 10,83,0,41,20,218,10,80,97,116,104,70,105,110,100,101, + 114,122,62,77,101,116,97,32,112,97,116,104,32,102,105,110, + 100,101,114,32,102,111,114,32,115,121,115,46,112,97,116,104, + 32,97,110,100,32,112,97,99,107,97,103,101,32,95,95,112, + 97,116,104,95,95,32,97,116,116,114,105,98,117,116,101,115, + 46,99,1,0,0,0,0,0,0,0,3,0,0,0,4,0, + 0,0,67,0,0,0,115,64,0,0,0,116,0,116,1,106, + 2,160,3,161,0,131,1,68,0,93,44,92,2,125,1,125, + 2,124,2,100,1,107,8,114,40,116,1,106,2,124,1,61, + 0,113,14,116,4,124,2,100,2,131,2,114,14,124,2,160, + 5,161,0,1,0,113,14,100,1,83,0,41,3,122,125,67, + 97,108,108,32,116,104,101,32,105,110,118,97,108,105,100,97, + 116,101,95,99,97,99,104,101,115,40,41,32,109,101,116,104, + 111,100,32,111,110,32,97,108,108,32,112,97,116,104,32,101, + 110,116,114,121,32,102,105,110,100,101,114,115,10,32,32,32, + 32,32,32,32,32,115,116,111,114,101,100,32,105,110,32,115, + 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, + 95,99,97,99,104,101,115,32,40,119,104,101,114,101,32,105, + 109,112,108,101,109,101,110,116,101,100,41,46,78,218,17,105, + 110,118,97,108,105,100,97,116,101,95,99,97,99,104,101,115, + 41,6,218,4,108,105,115,116,114,8,0,0,0,218,19,112, 97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,99, - 104,101,46,10,10,32,32,32,32,32,32,32,32,73,102,32, - 116,104,101,32,112,97,116,104,32,101,110,116,114,121,32,105, - 115,32,110,111,116,32,105,110,32,116,104,101,32,99,97,99, - 104,101,44,32,102,105,110,100,32,116,104,101,32,97,112,112, - 114,111,112,114,105,97,116,101,32,102,105,110,100,101,114,10, - 32,32,32,32,32,32,32,32,97,110,100,32,99,97,99,104, - 101,32,105,116,46,32,73,102,32,110,111,32,102,105,110,100, - 101,114,32,105,115,32,97,118,97,105,108,97,98,108,101,44, - 32,115,116,111,114,101,32,78,111,110,101,46,10,10,32,32, - 32,32,32,32,32,32,114,40,0,0,0,78,41,7,114,2, - 0,0,0,114,55,0,0,0,114,2,1,0,0,114,8,0, - 0,0,114,46,1,0,0,218,8,75,101,121,69,114,114,111, - 114,114,50,1,0,0,41,3,114,193,0,0,0,114,44,0, - 0,0,114,48,1,0,0,114,3,0,0,0,114,3,0,0, - 0,114,6,0,0,0,218,20,95,112,97,116,104,95,105,109, - 112,111,114,116,101,114,95,99,97,99,104,101,228,4,0,0, - 115,22,0,0,0,0,8,8,1,2,1,12,1,14,3,8, - 1,2,1,14,1,14,1,10,1,16,1,122,31,80,97,116, - 104,70,105,110,100,101,114,46,95,112,97,116,104,95,105,109, - 112,111,114,116,101,114,95,99,97,99,104,101,99,3,0,0, - 0,0,0,0,0,6,0,0,0,4,0,0,0,67,0,0, - 0,115,82,0,0,0,116,0,124,2,100,1,131,2,114,26, - 124,2,160,1,124,1,161,1,92,2,125,3,125,4,110,14, - 124,2,160,2,124,1,161,1,125,3,103,0,125,4,124,3, - 100,0,107,9,114,60,116,3,160,4,124,1,124,3,161,2, - 83,0,116,3,160,5,124,1,100,0,161,2,125,5,124,4, - 124,5,95,6,124,5,83,0,41,2,78,114,137,0,0,0, - 41,7,114,128,0,0,0,114,137,0,0,0,114,206,0,0, - 0,114,134,0,0,0,114,201,0,0,0,114,183,0,0,0, - 114,178,0,0,0,41,6,114,193,0,0,0,114,139,0,0, - 0,114,48,1,0,0,114,140,0,0,0,114,141,0,0,0, - 114,187,0,0,0,114,3,0,0,0,114,3,0,0,0,114, - 6,0,0,0,218,16,95,108,101,103,97,99,121,95,103,101, - 116,95,115,112,101,99,250,4,0,0,115,18,0,0,0,0, - 4,10,1,16,2,10,1,4,1,8,1,12,1,12,1,6, - 1,122,27,80,97,116,104,70,105,110,100,101,114,46,95,108, - 101,103,97,99,121,95,103,101,116,95,115,112,101,99,78,99, - 4,0,0,0,0,0,0,0,9,0,0,0,5,0,0,0, - 67,0,0,0,115,166,0,0,0,103,0,125,4,124,2,68, - 0,93,134,125,5,116,0,124,5,116,1,116,2,102,2,131, - 2,115,28,113,8,124,0,160,3,124,5,161,1,125,6,124, - 6,100,1,107,9,114,8,116,4,124,6,100,2,131,2,114, - 70,124,6,160,5,124,1,124,3,161,2,125,7,110,12,124, - 0,160,6,124,1,124,6,161,2,125,7,124,7,100,1,107, - 8,114,92,113,8,124,7,106,7,100,1,107,9,114,110,124, - 7,2,0,1,0,83,0,124,7,106,8,125,8,124,8,100, - 1,107,8,114,132,116,9,100,3,131,1,130,1,124,4,160, - 10,124,8,161,1,1,0,113,8,116,11,160,12,124,1,100, - 1,161,2,125,7,124,4,124,7,95,8,124,7,83,0,41, - 4,122,63,70,105,110,100,32,116,104,101,32,108,111,97,100, - 101,114,32,111,114,32,110,97,109,101,115,112,97,99,101,95, - 112,97,116,104,32,102,111,114,32,116,104,105,115,32,109,111, - 100,117,108,101,47,112,97,99,107,97,103,101,32,110,97,109, - 101,46,78,114,203,0,0,0,122,19,115,112,101,99,32,109, - 105,115,115,105,110,103,32,108,111,97,100,101,114,41,13,114, - 161,0,0,0,114,85,0,0,0,218,5,98,121,116,101,115, - 114,52,1,0,0,114,128,0,0,0,114,203,0,0,0,114, - 53,1,0,0,114,140,0,0,0,114,178,0,0,0,114,118, - 0,0,0,114,167,0,0,0,114,134,0,0,0,114,183,0, - 0,0,41,9,114,193,0,0,0,114,139,0,0,0,114,44, - 0,0,0,114,202,0,0,0,218,14,110,97,109,101,115,112, - 97,99,101,95,112,97,116,104,90,5,101,110,116,114,121,114, - 48,1,0,0,114,187,0,0,0,114,141,0,0,0,114,3, - 0,0,0,114,3,0,0,0,114,6,0,0,0,218,9,95, - 103,101,116,95,115,112,101,99,9,5,0,0,115,40,0,0, - 0,0,5,4,1,8,1,14,1,2,1,10,1,8,1,10, - 1,14,2,12,1,8,1,2,1,10,1,8,1,6,1,8, - 1,8,5,12,2,12,1,6,1,122,20,80,97,116,104,70, - 105,110,100,101,114,46,95,103,101,116,95,115,112,101,99,99, - 4,0,0,0,0,0,0,0,6,0,0,0,5,0,0,0, - 67,0,0,0,115,100,0,0,0,124,2,100,1,107,8,114, - 14,116,0,106,1,125,2,124,0,160,2,124,1,124,2,124, - 3,161,3,125,4,124,4,100,1,107,8,114,40,100,1,83, - 0,124,4,106,3,100,1,107,8,114,92,124,4,106,4,125, - 5,124,5,114,86,100,1,124,4,95,5,116,6,124,1,124, - 5,124,0,106,2,131,3,124,4,95,4,124,4,83,0,100, - 1,83,0,110,4,124,4,83,0,100,1,83,0,41,2,122, - 141,84,114,121,32,116,111,32,102,105,110,100,32,97,32,115, - 112,101,99,32,102,111,114,32,39,102,117,108,108,110,97,109, - 101,39,32,111,110,32,115,121,115,46,112,97,116,104,32,111, - 114,32,39,112,97,116,104,39,46,10,10,32,32,32,32,32, - 32,32,32,84,104,101,32,115,101,97,114,99,104,32,105,115, - 32,98,97,115,101,100,32,111,110,32,115,121,115,46,112,97, - 116,104,95,104,111,111,107,115,32,97,110,100,32,115,121,115, - 46,112,97,116,104,95,105,109,112,111,114,116,101,114,95,99, - 97,99,104,101,46,10,32,32,32,32,32,32,32,32,78,41, - 7,114,8,0,0,0,114,44,0,0,0,114,56,1,0,0, - 114,140,0,0,0,114,178,0,0,0,114,181,0,0,0,114, - 22,1,0,0,41,6,114,193,0,0,0,114,139,0,0,0, - 114,44,0,0,0,114,202,0,0,0,114,187,0,0,0,114, - 55,1,0,0,114,3,0,0,0,114,3,0,0,0,114,6, - 0,0,0,114,203,0,0,0,41,5,0,0,115,26,0,0, - 0,0,6,8,1,6,1,14,1,8,1,4,1,10,1,6, - 1,4,3,6,1,16,1,4,2,6,2,122,20,80,97,116, - 104,70,105,110,100,101,114,46,102,105,110,100,95,115,112,101, - 99,99,3,0,0,0,0,0,0,0,4,0,0,0,4,0, - 0,0,67,0,0,0,115,30,0,0,0,124,0,160,0,124, - 1,124,2,161,2,125,3,124,3,100,1,107,8,114,24,100, - 1,83,0,124,3,106,1,83,0,41,2,122,170,102,105,110, - 100,32,116,104,101,32,109,111,100,117,108,101,32,111,110,32, - 115,121,115,46,112,97,116,104,32,111,114,32,39,112,97,116, - 104,39,32,98,97,115,101,100,32,111,110,32,115,121,115,46, - 112,97,116,104,95,104,111,111,107,115,32,97,110,100,10,32, - 32,32,32,32,32,32,32,115,121,115,46,112,97,116,104,95, - 105,109,112,111,114,116,101,114,95,99,97,99,104,101,46,10, - 10,32,32,32,32,32,32,32,32,84,104,105,115,32,109,101, - 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,85,115,101,32,102,105,110,100,95,115,112, - 101,99,40,41,32,105,110,115,116,101,97,100,46,10,10,32, - 32,32,32,32,32,32,32,78,114,204,0,0,0,114,205,0, - 0,0,114,3,0,0,0,114,3,0,0,0,114,6,0,0, - 0,114,206,0,0,0,65,5,0,0,115,8,0,0,0,0, - 8,12,1,8,1,4,1,122,22,80,97,116,104,70,105,110, - 100,101,114,46,102,105,110,100,95,109,111,100,117,108,101,41, - 1,78,41,2,78,78,41,1,78,41,12,114,125,0,0,0, - 114,124,0,0,0,114,126,0,0,0,114,127,0,0,0,114, - 207,0,0,0,114,44,1,0,0,114,50,1,0,0,114,52, - 1,0,0,114,53,1,0,0,114,56,1,0,0,114,203,0, - 0,0,114,206,0,0,0,114,3,0,0,0,114,3,0,0, - 0,114,3,0,0,0,114,6,0,0,0,114,43,1,0,0, - 201,4,0,0,115,30,0,0,0,8,2,4,2,2,1,10, - 9,2,1,10,12,2,1,10,21,2,1,10,14,2,1,12, - 31,2,1,12,23,2,1,114,43,1,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, - 0,115,90,0,0,0,101,0,90,1,100,0,90,2,100,1, - 90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0, - 90,5,101,6,90,7,100,6,100,7,132,0,90,8,100,8, - 100,9,132,0,90,9,100,19,100,11,100,12,132,1,90,10, - 100,13,100,14,132,0,90,11,101,12,100,15,100,16,132,0, - 131,1,90,13,100,17,100,18,132,0,90,14,100,10,83,0, - 41,20,218,10,70,105,108,101,70,105,110,100,101,114,122,172, - 70,105,108,101,45,98,97,115,101,100,32,102,105,110,100,101, - 114,46,10,10,32,32,32,32,73,110,116,101,114,97,99,116, - 105,111,110,115,32,119,105,116,104,32,116,104,101,32,102,105, - 108,101,32,115,121,115,116,101,109,32,97,114,101,32,99,97, - 99,104,101,100,32,102,111,114,32,112,101,114,102,111,114,109, - 97,110,99,101,44,32,98,101,105,110,103,10,32,32,32,32, - 114,101,102,114,101,115,104,101,100,32,119,104,101,110,32,116, - 104,101,32,100,105,114,101,99,116,111,114,121,32,116,104,101, - 32,102,105,110,100,101,114,32,105,115,32,104,97,110,100,108, - 105,110,103,32,104,97,115,32,98,101,101,110,32,109,111,100, - 105,102,105,101,100,46,10,10,32,32,32,32,99,2,0,0, - 0,0,0,0,0,5,0,0,0,6,0,0,0,7,0,0, - 0,115,84,0,0,0,103,0,125,3,124,2,68,0,93,32, - 92,2,137,0,125,4,124,3,160,0,135,0,102,1,100,1, - 100,2,132,8,124,4,68,0,131,1,161,1,1,0,113,8, - 124,3,124,0,95,1,124,1,112,54,100,3,124,0,95,2, - 100,4,124,0,95,3,116,4,131,0,124,0,95,5,116,4, - 131,0,124,0,95,6,100,5,83,0,41,6,122,154,73,110, - 105,116,105,97,108,105,122,101,32,119,105,116,104,32,116,104, - 101,32,112,97,116,104,32,116,111,32,115,101,97,114,99,104, - 32,111,110,32,97,110,100,32,97,32,118,97,114,105,97,98, - 108,101,32,110,117,109,98,101,114,32,111,102,10,32,32,32, - 32,32,32,32,32,50,45,116,117,112,108,101,115,32,99,111, - 110,116,97,105,110,105,110,103,32,116,104,101,32,108,111,97, - 100,101,114,32,97,110,100,32,116,104,101,32,102,105,108,101, - 32,115,117,102,102,105,120,101,115,32,116,104,101,32,108,111, - 97,100,101,114,10,32,32,32,32,32,32,32,32,114,101,99, - 111,103,110,105,122,101,115,46,99,1,0,0,0,0,0,0, - 0,2,0,0,0,3,0,0,0,51,0,0,0,115,22,0, - 0,0,124,0,93,14,125,1,124,1,136,0,102,2,86,0, - 1,0,113,2,100,0,83,0,114,110,0,0,0,114,3,0, - 0,0,114,16,1,0,0,169,1,114,140,0,0,0,114,3, - 0,0,0,114,6,0,0,0,114,19,1,0,0,94,5,0, - 0,115,4,0,0,0,4,0,2,0,122,38,70,105,108,101, - 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,46, - 60,108,111,99,97,108,115,62,46,60,103,101,110,101,120,112, - 114,62,114,71,0,0,0,114,105,0,0,0,78,41,7,114, - 167,0,0,0,218,8,95,108,111,97,100,101,114,115,114,44, - 0,0,0,218,11,95,112,97,116,104,95,109,116,105,109,101, - 218,3,115,101,116,218,11,95,112,97,116,104,95,99,97,99, - 104,101,218,19,95,114,101,108,97,120,101,100,95,112,97,116, - 104,95,99,97,99,104,101,41,5,114,119,0,0,0,114,44, - 0,0,0,218,14,108,111,97,100,101,114,95,100,101,116,97, - 105,108,115,90,7,108,111,97,100,101,114,115,114,189,0,0, - 0,114,3,0,0,0,114,58,1,0,0,114,6,0,0,0, - 114,209,0,0,0,88,5,0,0,115,16,0,0,0,0,4, - 4,1,12,1,26,1,6,2,10,1,6,1,8,1,122,19, - 70,105,108,101,70,105,110,100,101,114,46,95,95,105,110,105, - 116,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0, - 2,0,0,0,67,0,0,0,115,10,0,0,0,100,1,124, - 0,95,0,100,2,83,0,41,3,122,31,73,110,118,97,108, - 105,100,97,116,101,32,116,104,101,32,100,105,114,101,99,116, - 111,114,121,32,109,116,105,109,101,46,114,105,0,0,0,78, - 41,1,114,60,1,0,0,114,246,0,0,0,114,3,0,0, - 0,114,3,0,0,0,114,6,0,0,0,114,44,1,0,0, - 102,5,0,0,115,2,0,0,0,0,2,122,28,70,105,108, - 101,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97, - 116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0, - 0,0,3,0,0,0,3,0,0,0,67,0,0,0,115,42, - 0,0,0,124,0,160,0,124,1,161,1,125,2,124,2,100, - 1,107,8,114,26,100,1,103,0,102,2,83,0,124,2,106, - 1,124,2,106,2,112,38,103,0,102,2,83,0,41,2,122, - 197,84,114,121,32,116,111,32,102,105,110,100,32,97,32,108, - 111,97,100,101,114,32,102,111,114,32,116,104,101,32,115,112, - 101,99,105,102,105,101,100,32,109,111,100,117,108,101,44,32, - 111,114,32,116,104,101,32,110,97,109,101,115,112,97,99,101, - 10,32,32,32,32,32,32,32,32,112,97,99,107,97,103,101, - 32,112,111,114,116,105,111,110,115,46,32,82,101,116,117,114, - 110,115,32,40,108,111,97,100,101,114,44,32,108,105,115,116, - 45,111,102,45,112,111,114,116,105,111,110,115,41,46,10,10, - 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116, - 104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101, - 100,46,32,32,85,115,101,32,102,105,110,100,95,115,112,101, - 99,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,32,32,32,32,78,41,3,114,203,0,0,0,114,140, - 0,0,0,114,178,0,0,0,41,3,114,119,0,0,0,114, - 139,0,0,0,114,187,0,0,0,114,3,0,0,0,114,3, - 0,0,0,114,6,0,0,0,114,137,0,0,0,108,5,0, - 0,115,8,0,0,0,0,7,10,1,8,1,8,1,122,22, - 70,105,108,101,70,105,110,100,101,114,46,102,105,110,100,95, - 108,111,97,100,101,114,99,6,0,0,0,0,0,0,0,7, - 0,0,0,6,0,0,0,67,0,0,0,115,26,0,0,0, - 124,1,124,2,124,3,131,2,125,6,116,0,124,2,124,3, - 124,6,124,4,100,1,141,4,83,0,41,2,78,114,177,0, - 0,0,41,1,114,190,0,0,0,41,7,114,119,0,0,0, - 114,188,0,0,0,114,139,0,0,0,114,44,0,0,0,90, - 4,115,109,115,108,114,202,0,0,0,114,140,0,0,0,114, - 3,0,0,0,114,3,0,0,0,114,6,0,0,0,114,56, - 1,0,0,120,5,0,0,115,8,0,0,0,0,1,10,1, - 8,1,2,255,122,20,70,105,108,101,70,105,110,100,101,114, - 46,95,103,101,116,95,115,112,101,99,78,99,3,0,0,0, - 0,0,0,0,14,0,0,0,8,0,0,0,67,0,0,0, - 115,102,1,0,0,100,1,125,3,124,1,160,0,100,2,161, - 1,100,3,25,0,125,4,122,24,116,1,124,0,106,2,112, - 34,116,3,160,4,161,0,131,1,106,5,125,5,87,0,110, - 24,4,0,116,6,107,10,114,66,1,0,1,0,1,0,100, - 4,125,5,89,0,110,2,88,0,124,5,124,0,106,7,107, - 3,114,92,124,0,160,8,161,0,1,0,124,5,124,0,95, - 7,116,9,131,0,114,114,124,0,106,10,125,6,124,4,160, - 11,161,0,125,7,110,10,124,0,106,12,125,6,124,4,125, - 7,124,7,124,6,107,6,114,218,116,13,124,0,106,2,124, - 4,131,2,125,8,124,0,106,14,68,0,93,58,92,2,125, - 9,125,10,100,5,124,9,23,0,125,11,116,13,124,8,124, - 11,131,2,125,12,116,15,124,12,131,1,114,208,124,0,160, - 16,124,10,124,1,124,12,124,8,103,1,124,2,161,5,2, - 0,1,0,83,0,113,150,116,17,124,8,131,1,125,3,124, - 0,106,14,68,0,93,86,92,2,125,9,125,10,116,13,124, - 0,106,2,124,4,124,9,23,0,131,2,125,12,116,18,106, - 19,100,6,124,12,100,3,100,7,141,3,1,0,124,7,124, - 9,23,0,124,6,107,6,144,1,114,54,116,15,124,12,131, - 1,144,1,114,54,124,0,160,16,124,10,124,1,124,12,100, - 8,124,2,161,5,2,0,1,0,83,0,113,224,124,3,144, - 1,114,98,116,18,160,19,100,9,124,8,161,2,1,0,116, - 18,160,20,124,1,100,8,161,2,125,13,124,8,103,1,124, - 13,95,21,124,13,83,0,100,8,83,0,41,10,122,111,84, + 104,101,218,5,105,116,101,109,115,114,128,0,0,0,114,46, + 1,0,0,41,3,114,193,0,0,0,114,117,0,0,0,218, + 6,102,105,110,100,101,114,114,3,0,0,0,114,3,0,0, + 0,114,6,0,0,0,114,46,1,0,0,208,4,0,0,115, + 10,0,0,0,0,4,22,1,8,1,10,1,10,1,122,28, + 80,97,116,104,70,105,110,100,101,114,46,105,110,118,97,108, + 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, + 0,0,0,0,0,3,0,0,0,9,0,0,0,67,0,0, + 0,115,84,0,0,0,116,0,106,1,100,1,107,9,114,28, + 116,0,106,1,115,28,116,2,160,3,100,2,116,4,161,2, + 1,0,116,0,106,1,68,0,93,44,125,2,122,14,124,2, + 124,1,131,1,87,0,2,0,1,0,83,0,4,0,116,5, + 107,10,114,76,1,0,1,0,1,0,89,0,113,34,89,0, + 113,34,88,0,113,34,100,1,83,0,41,3,122,46,83,101, + 97,114,99,104,32,115,121,115,46,112,97,116,104,95,104,111, + 111,107,115,32,102,111,114,32,97,32,102,105,110,100,101,114, + 32,102,111,114,32,39,112,97,116,104,39,46,78,122,23,115, + 121,115,46,112,97,116,104,95,104,111,111,107,115,32,105,115, + 32,101,109,112,116,121,41,6,114,8,0,0,0,218,10,112, + 97,116,104,95,104,111,111,107,115,114,75,0,0,0,114,76, + 0,0,0,114,138,0,0,0,114,118,0,0,0,41,3,114, + 193,0,0,0,114,44,0,0,0,90,4,104,111,111,107,114, + 3,0,0,0,114,3,0,0,0,114,6,0,0,0,218,11, + 95,112,97,116,104,95,104,111,111,107,115,218,4,0,0,115, + 16,0,0,0,0,3,16,1,12,1,10,1,2,1,14,1, + 14,1,12,2,122,22,80,97,116,104,70,105,110,100,101,114, + 46,95,112,97,116,104,95,104,111,111,107,115,99,2,0,0, + 0,0,0,0,0,3,0,0,0,8,0,0,0,67,0,0, + 0,115,104,0,0,0,124,1,100,1,107,2,114,44,122,12, + 116,0,160,1,161,0,125,1,87,0,110,22,4,0,116,2, + 107,10,114,42,1,0,1,0,1,0,89,0,100,2,83,0, + 88,0,122,14,116,3,106,4,124,1,25,0,125,2,87,0, + 110,40,4,0,116,5,107,10,114,98,1,0,1,0,1,0, + 124,0,160,6,124,1,161,1,125,2,124,2,116,3,106,4, + 124,1,60,0,89,0,110,2,88,0,124,2,83,0,41,3, + 122,210,71,101,116,32,116,104,101,32,102,105,110,100,101,114, + 32,102,111,114,32,116,104,101,32,112,97,116,104,32,101,110, + 116,114,121,32,102,114,111,109,32,115,121,115,46,112,97,116, + 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, + 46,10,10,32,32,32,32,32,32,32,32,73,102,32,116,104, + 101,32,112,97,116,104,32,101,110,116,114,121,32,105,115,32, + 110,111,116,32,105,110,32,116,104,101,32,99,97,99,104,101, + 44,32,102,105,110,100,32,116,104,101,32,97,112,112,114,111, + 112,114,105,97,116,101,32,102,105,110,100,101,114,10,32,32, + 32,32,32,32,32,32,97,110,100,32,99,97,99,104,101,32, + 105,116,46,32,73,102,32,110,111,32,102,105,110,100,101,114, + 32,105,115,32,97,118,97,105,108,97,98,108,101,44,32,115, + 116,111,114,101,32,78,111,110,101,46,10,10,32,32,32,32, + 32,32,32,32,114,40,0,0,0,78,41,7,114,2,0,0, + 0,114,55,0,0,0,114,2,1,0,0,114,8,0,0,0, + 114,48,1,0,0,218,8,75,101,121,69,114,114,111,114,114, + 52,1,0,0,41,3,114,193,0,0,0,114,44,0,0,0, + 114,50,1,0,0,114,3,0,0,0,114,3,0,0,0,114, + 6,0,0,0,218,20,95,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,231,4,0,0,115,22, + 0,0,0,0,8,8,1,2,1,12,1,14,3,8,1,2, + 1,14,1,14,1,10,1,16,1,122,31,80,97,116,104,70, + 105,110,100,101,114,46,95,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,99,3,0,0,0,0, + 0,0,0,6,0,0,0,4,0,0,0,67,0,0,0,115, + 82,0,0,0,116,0,124,2,100,1,131,2,114,26,124,2, + 160,1,124,1,161,1,92,2,125,3,125,4,110,14,124,2, + 160,2,124,1,161,1,125,3,103,0,125,4,124,3,100,0, + 107,9,114,60,116,3,160,4,124,1,124,3,161,2,83,0, + 116,3,160,5,124,1,100,0,161,2,125,5,124,4,124,5, + 95,6,124,5,83,0,41,2,78,114,137,0,0,0,41,7, + 114,128,0,0,0,114,137,0,0,0,114,206,0,0,0,114, + 134,0,0,0,114,201,0,0,0,114,183,0,0,0,114,178, + 0,0,0,41,6,114,193,0,0,0,114,139,0,0,0,114, + 50,1,0,0,114,140,0,0,0,114,141,0,0,0,114,187, + 0,0,0,114,3,0,0,0,114,3,0,0,0,114,6,0, + 0,0,218,16,95,108,101,103,97,99,121,95,103,101,116,95, + 115,112,101,99,253,4,0,0,115,18,0,0,0,0,4,10, + 1,16,2,10,1,4,1,8,1,12,1,12,1,6,1,122, + 27,80,97,116,104,70,105,110,100,101,114,46,95,108,101,103, + 97,99,121,95,103,101,116,95,115,112,101,99,78,99,4,0, + 0,0,0,0,0,0,9,0,0,0,5,0,0,0,67,0, + 0,0,115,166,0,0,0,103,0,125,4,124,2,68,0,93, + 134,125,5,116,0,124,5,116,1,116,2,102,2,131,2,115, + 28,113,8,124,0,160,3,124,5,161,1,125,6,124,6,100, + 1,107,9,114,8,116,4,124,6,100,2,131,2,114,70,124, + 6,160,5,124,1,124,3,161,2,125,7,110,12,124,0,160, + 6,124,1,124,6,161,2,125,7,124,7,100,1,107,8,114, + 92,113,8,124,7,106,7,100,1,107,9,114,110,124,7,2, + 0,1,0,83,0,124,7,106,8,125,8,124,8,100,1,107, + 8,114,132,116,9,100,3,131,1,130,1,124,4,160,10,124, + 8,161,1,1,0,113,8,116,11,160,12,124,1,100,1,161, + 2,125,7,124,4,124,7,95,8,124,7,83,0,41,4,122, + 63,70,105,110,100,32,116,104,101,32,108,111,97,100,101,114, + 32,111,114,32,110,97,109,101,115,112,97,99,101,95,112,97, + 116,104,32,102,111,114,32,116,104,105,115,32,109,111,100,117, + 108,101,47,112,97,99,107,97,103,101,32,110,97,109,101,46, + 78,114,203,0,0,0,122,19,115,112,101,99,32,109,105,115, + 115,105,110,103,32,108,111,97,100,101,114,41,13,114,161,0, + 0,0,114,85,0,0,0,218,5,98,121,116,101,115,114,54, + 1,0,0,114,128,0,0,0,114,203,0,0,0,114,55,1, + 0,0,114,140,0,0,0,114,178,0,0,0,114,118,0,0, + 0,114,167,0,0,0,114,134,0,0,0,114,183,0,0,0, + 41,9,114,193,0,0,0,114,139,0,0,0,114,44,0,0, + 0,114,202,0,0,0,218,14,110,97,109,101,115,112,97,99, + 101,95,112,97,116,104,90,5,101,110,116,114,121,114,50,1, + 0,0,114,187,0,0,0,114,141,0,0,0,114,3,0,0, + 0,114,3,0,0,0,114,6,0,0,0,218,9,95,103,101, + 116,95,115,112,101,99,12,5,0,0,115,40,0,0,0,0, + 5,4,1,8,1,14,1,2,1,10,1,8,1,10,1,14, + 2,12,1,8,1,2,1,10,1,8,1,6,1,8,1,8, + 5,12,2,12,1,6,1,122,20,80,97,116,104,70,105,110, + 100,101,114,46,95,103,101,116,95,115,112,101,99,99,4,0, + 0,0,0,0,0,0,6,0,0,0,5,0,0,0,67,0, + 0,0,115,100,0,0,0,124,2,100,1,107,8,114,14,116, + 0,106,1,125,2,124,0,160,2,124,1,124,2,124,3,161, + 3,125,4,124,4,100,1,107,8,114,40,100,1,83,0,124, + 4,106,3,100,1,107,8,114,92,124,4,106,4,125,5,124, + 5,114,86,100,1,124,4,95,5,116,6,124,1,124,5,124, + 0,106,2,131,3,124,4,95,4,124,4,83,0,100,1,83, + 0,110,4,124,4,83,0,100,1,83,0,41,2,122,141,84, 114,121,32,116,111,32,102,105,110,100,32,97,32,115,112,101, - 99,32,102,111,114,32,116,104,101,32,115,112,101,99,105,102, - 105,101,100,32,109,111,100,117,108,101,46,10,10,32,32,32, - 32,32,32,32,32,82,101,116,117,114,110,115,32,116,104,101, - 32,109,97,116,99,104,105,110,103,32,115,112,101,99,44,32, - 111,114,32,78,111,110,101,32,105,102,32,110,111,116,32,102, - 111,117,110,100,46,10,32,32,32,32,32,32,32,32,70,114, - 71,0,0,0,114,28,0,0,0,114,105,0,0,0,114,209, - 0,0,0,122,9,116,114,121,105,110,103,32,123,125,41,1, - 90,9,118,101,114,98,111,115,105,116,121,78,122,25,112,111, - 115,115,105,98,108,101,32,110,97,109,101,115,112,97,99,101, - 32,102,111,114,32,123,125,41,22,114,41,0,0,0,114,49, - 0,0,0,114,44,0,0,0,114,2,0,0,0,114,55,0, - 0,0,114,9,1,0,0,114,50,0,0,0,114,60,1,0, - 0,218,11,95,102,105,108,108,95,99,97,99,104,101,114,7, - 0,0,0,114,63,1,0,0,114,106,0,0,0,114,62,1, - 0,0,114,38,0,0,0,114,59,1,0,0,114,54,0,0, - 0,114,56,1,0,0,114,56,0,0,0,114,134,0,0,0, - 114,149,0,0,0,114,183,0,0,0,114,178,0,0,0,41, - 14,114,119,0,0,0,114,139,0,0,0,114,202,0,0,0, - 90,12,105,115,95,110,97,109,101,115,112,97,99,101,90,11, - 116,97,105,108,95,109,111,100,117,108,101,114,169,0,0,0, - 90,5,99,97,99,104,101,90,12,99,97,99,104,101,95,109, - 111,100,117,108,101,90,9,98,97,115,101,95,112,97,116,104, - 114,17,1,0,0,114,188,0,0,0,90,13,105,110,105,116, - 95,102,105,108,101,110,97,109,101,90,9,102,117,108,108,95, - 112,97,116,104,114,187,0,0,0,114,3,0,0,0,114,3, - 0,0,0,114,6,0,0,0,114,203,0,0,0,125,5,0, - 0,115,74,0,0,0,0,5,4,1,14,1,2,1,24,1, - 14,1,10,1,10,1,8,1,6,2,6,1,6,1,10,2, - 6,1,4,2,8,1,12,1,14,1,8,1,10,1,8,1, - 26,4,8,2,14,1,16,1,16,1,14,1,10,1,10,1, - 2,0,2,255,10,2,6,1,12,1,12,1,8,1,4,1, - 122,20,70,105,108,101,70,105,110,100,101,114,46,102,105,110, - 100,95,115,112,101,99,99,1,0,0,0,0,0,0,0,9, - 0,0,0,10,0,0,0,67,0,0,0,115,190,0,0,0, - 124,0,106,0,125,1,122,22,116,1,160,2,124,1,112,22, - 116,1,160,3,161,0,161,1,125,2,87,0,110,30,4,0, - 116,4,116,5,116,6,102,3,107,10,114,58,1,0,1,0, - 1,0,103,0,125,2,89,0,110,2,88,0,116,7,106,8, - 160,9,100,1,161,1,115,84,116,10,124,2,131,1,124,0, - 95,11,110,74,116,10,131,0,125,3,124,2,68,0,93,56, - 125,4,124,4,160,12,100,2,161,1,92,3,125,5,125,6, - 125,7,124,6,114,136,100,3,160,13,124,5,124,7,160,14, - 161,0,161,2,125,8,110,4,124,5,125,8,124,3,160,15, - 124,8,161,1,1,0,113,94,124,3,124,0,95,11,116,7, - 106,8,160,9,116,16,161,1,114,186,100,4,100,5,132,0, - 124,2,68,0,131,1,124,0,95,17,100,6,83,0,41,7, - 122,68,70,105,108,108,32,116,104,101,32,99,97,99,104,101, - 32,111,102,32,112,111,116,101,110,116,105,97,108,32,109,111, - 100,117,108,101,115,32,97,110,100,32,112,97,99,107,97,103, - 101,115,32,102,111,114,32,116,104,105,115,32,100,105,114,101, - 99,116,111,114,121,46,114,0,0,0,0,114,71,0,0,0, - 114,61,0,0,0,99,1,0,0,0,0,0,0,0,2,0, - 0,0,4,0,0,0,83,0,0,0,115,20,0,0,0,104, - 0,124,0,93,12,125,1,124,1,160,0,161,0,146,2,113, - 4,83,0,114,3,0,0,0,41,1,114,106,0,0,0,41, - 2,114,32,0,0,0,90,2,102,110,114,3,0,0,0,114, - 3,0,0,0,114,6,0,0,0,218,9,60,115,101,116,99, - 111,109,112,62,202,5,0,0,115,4,0,0,0,6,0,2, - 0,122,41,70,105,108,101,70,105,110,100,101,114,46,95,102, - 105,108,108,95,99,97,99,104,101,46,60,108,111,99,97,108, - 115,62,46,60,115,101,116,99,111,109,112,62,78,41,18,114, - 44,0,0,0,114,2,0,0,0,114,6,1,0,0,114,55, - 0,0,0,114,2,1,0,0,218,15,80,101,114,109,105,115, - 115,105,111,110,69,114,114,111,114,218,18,78,111,116,65,68, - 105,114,101,99,116,111,114,121,69,114,114,111,114,114,8,0, - 0,0,114,9,0,0,0,114,10,0,0,0,114,61,1,0, - 0,114,62,1,0,0,114,101,0,0,0,114,62,0,0,0, - 114,106,0,0,0,218,3,97,100,100,114,11,0,0,0,114, - 63,1,0,0,41,9,114,119,0,0,0,114,44,0,0,0, - 114,7,1,0,0,90,21,108,111,119,101,114,95,115,117,102, - 102,105,120,95,99,111,110,116,101,110,116,115,114,39,1,0, - 0,114,117,0,0,0,114,29,1,0,0,114,17,1,0,0, - 90,8,110,101,119,95,110,97,109,101,114,3,0,0,0,114, - 3,0,0,0,114,6,0,0,0,114,65,1,0,0,173,5, - 0,0,115,34,0,0,0,0,2,6,1,2,1,22,1,20, - 3,10,3,12,1,12,7,6,1,8,1,16,1,4,1,18, - 2,4,1,12,1,6,1,12,1,122,22,70,105,108,101,70, - 105,110,100,101,114,46,95,102,105,108,108,95,99,97,99,104, - 101,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,7,0,0,0,115,18,0,0,0,135,0,135,1,102, - 2,100,1,100,2,132,8,125,2,124,2,83,0,41,3,97, - 20,1,0,0,65,32,99,108,97,115,115,32,109,101,116,104, - 111,100,32,119,104,105,99,104,32,114,101,116,117,114,110,115, - 32,97,32,99,108,111,115,117,114,101,32,116,111,32,117,115, - 101,32,111,110,32,115,121,115,46,112,97,116,104,95,104,111, - 111,107,10,32,32,32,32,32,32,32,32,119,104,105,99,104, - 32,119,105,108,108,32,114,101,116,117,114,110,32,97,110,32, - 105,110,115,116,97,110,99,101,32,117,115,105,110,103,32,116, - 104,101,32,115,112,101,99,105,102,105,101,100,32,108,111,97, - 100,101,114,115,32,97,110,100,32,116,104,101,32,112,97,116, - 104,10,32,32,32,32,32,32,32,32,99,97,108,108,101,100, - 32,111,110,32,116,104,101,32,99,108,111,115,117,114,101,46, - 10,10,32,32,32,32,32,32,32,32,73,102,32,116,104,101, - 32,112,97,116,104,32,99,97,108,108,101,100,32,111,110,32, - 116,104,101,32,99,108,111,115,117,114,101,32,105,115,32,110, - 111,116,32,97,32,100,105,114,101,99,116,111,114,121,44,32, - 73,109,112,111,114,116,69,114,114,111,114,32,105,115,10,32, - 32,32,32,32,32,32,32,114,97,105,115,101,100,46,10,10, - 32,32,32,32,32,32,32,32,99,1,0,0,0,0,0,0, - 0,1,0,0,0,4,0,0,0,19,0,0,0,115,34,0, - 0,0,116,0,124,0,131,1,115,20,116,1,100,1,124,0, - 100,2,141,2,130,1,136,0,124,0,102,1,136,1,158,2, - 142,0,83,0,41,3,122,45,80,97,116,104,32,104,111,111, - 107,32,102,111,114,32,105,109,112,111,114,116,108,105,98,46, - 109,97,99,104,105,110,101,114,121,46,70,105,108,101,70,105, - 110,100,101,114,46,122,30,111,110,108,121,32,100,105,114,101, - 99,116,111,114,105,101,115,32,97,114,101,32,115,117,112,112, - 111,114,116,101,100,114,48,0,0,0,41,2,114,56,0,0, - 0,114,118,0,0,0,114,48,0,0,0,169,2,114,193,0, - 0,0,114,64,1,0,0,114,3,0,0,0,114,6,0,0, - 0,218,24,112,97,116,104,95,104,111,111,107,95,102,111,114, - 95,70,105,108,101,70,105,110,100,101,114,214,5,0,0,115, - 6,0,0,0,0,2,8,1,12,1,122,54,70,105,108,101, - 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, - 46,60,108,111,99,97,108,115,62,46,112,97,116,104,95,104, - 111,111,107,95,102,111,114,95,70,105,108,101,70,105,110,100, - 101,114,114,3,0,0,0,41,3,114,193,0,0,0,114,64, - 1,0,0,114,71,1,0,0,114,3,0,0,0,114,70,1, - 0,0,114,6,0,0,0,218,9,112,97,116,104,95,104,111, - 111,107,204,5,0,0,115,4,0,0,0,0,10,14,6,122, - 20,70,105,108,101,70,105,110,100,101,114,46,112,97,116,104, - 95,104,111,111,107,99,1,0,0,0,0,0,0,0,1,0, - 0,0,3,0,0,0,67,0,0,0,115,12,0,0,0,100, - 1,160,0,124,0,106,1,161,1,83,0,41,2,78,122,16, - 70,105,108,101,70,105,110,100,101,114,40,123,33,114,125,41, - 41,2,114,62,0,0,0,114,44,0,0,0,114,246,0,0, - 0,114,3,0,0,0,114,3,0,0,0,114,6,0,0,0, - 114,37,1,0,0,222,5,0,0,115,2,0,0,0,0,1, - 122,19,70,105,108,101,70,105,110,100,101,114,46,95,95,114, - 101,112,114,95,95,41,1,78,41,15,114,125,0,0,0,114, - 124,0,0,0,114,126,0,0,0,114,127,0,0,0,114,209, - 0,0,0,114,44,1,0,0,114,143,0,0,0,114,206,0, - 0,0,114,137,0,0,0,114,56,1,0,0,114,203,0,0, - 0,114,65,1,0,0,114,207,0,0,0,114,72,1,0,0, - 114,37,1,0,0,114,3,0,0,0,114,3,0,0,0,114, - 3,0,0,0,114,6,0,0,0,114,57,1,0,0,79,5, - 0,0,115,22,0,0,0,8,2,4,7,8,14,8,4,4, - 2,8,12,8,5,10,48,8,31,2,1,10,17,114,57,1, - 0,0,99,4,0,0,0,0,0,0,0,6,0,0,0,8, - 0,0,0,67,0,0,0,115,146,0,0,0,124,0,160,0, - 100,1,161,1,125,4,124,0,160,0,100,2,161,1,125,5, - 124,4,115,66,124,5,114,36,124,5,106,1,125,4,110,30, - 124,2,124,3,107,2,114,56,116,2,124,1,124,2,131,2, - 125,4,110,10,116,3,124,1,124,2,131,2,125,4,124,5, - 115,84,116,4,124,1,124,2,124,4,100,3,141,3,125,5, - 122,36,124,5,124,0,100,2,60,0,124,4,124,0,100,1, - 60,0,124,2,124,0,100,4,60,0,124,3,124,0,100,5, - 60,0,87,0,110,20,4,0,116,5,107,10,114,140,1,0, - 1,0,1,0,89,0,110,2,88,0,100,0,83,0,41,6, - 78,218,10,95,95,108,111,97,100,101,114,95,95,218,8,95, - 95,115,112,101,99,95,95,114,58,1,0,0,90,8,95,95, - 102,105,108,101,95,95,90,10,95,95,99,97,99,104,101,100, - 95,95,41,6,218,3,103,101,116,114,140,0,0,0,114,14, - 1,0,0,114,8,1,0,0,114,190,0,0,0,218,9,69, - 120,99,101,112,116,105,111,110,41,6,90,2,110,115,114,117, - 0,0,0,90,8,112,97,116,104,110,97,109,101,90,9,99, - 112,97,116,104,110,97,109,101,114,140,0,0,0,114,187,0, + 99,32,102,111,114,32,39,102,117,108,108,110,97,109,101,39, + 32,111,110,32,115,121,115,46,112,97,116,104,32,111,114,32, + 39,112,97,116,104,39,46,10,10,32,32,32,32,32,32,32, + 32,84,104,101,32,115,101,97,114,99,104,32,105,115,32,98, + 97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,104, + 95,104,111,111,107,115,32,97,110,100,32,115,121,115,46,112, + 97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,99, + 104,101,46,10,32,32,32,32,32,32,32,32,78,41,7,114, + 8,0,0,0,114,44,0,0,0,114,58,1,0,0,114,140, + 0,0,0,114,178,0,0,0,114,181,0,0,0,114,22,1, + 0,0,41,6,114,193,0,0,0,114,139,0,0,0,114,44, + 0,0,0,114,202,0,0,0,114,187,0,0,0,114,57,1, 0,0,114,3,0,0,0,114,3,0,0,0,114,6,0,0, - 0,218,14,95,102,105,120,95,117,112,95,109,111,100,117,108, - 101,228,5,0,0,115,34,0,0,0,0,2,10,1,10,1, - 4,1,4,1,8,1,8,1,12,2,10,1,4,1,14,1, - 2,1,8,1,8,1,8,1,12,1,14,2,114,77,1,0, - 0,99,0,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,67,0,0,0,115,38,0,0,0,116,0,116,1,160, - 2,161,0,102,2,125,0,116,3,116,4,102,2,125,1,116, - 5,116,6,102,2,125,2,124,0,124,1,124,2,103,3,83, - 0,41,1,122,95,82,101,116,117,114,110,115,32,97,32,108, - 105,115,116,32,111,102,32,102,105,108,101,45,98,97,115,101, - 100,32,109,111,100,117,108,101,32,108,111,97,100,101,114,115, - 46,10,10,32,32,32,32,69,97,99,104,32,105,116,101,109, - 32,105,115,32,97,32,116,117,112,108,101,32,40,108,111,97, - 100,101,114,44,32,115,117,102,102,105,120,101,115,41,46,10, - 32,32,32,32,41,7,114,15,1,0,0,114,163,0,0,0, - 218,18,101,120,116,101,110,115,105,111,110,95,115,117,102,102, - 105,120,101,115,114,8,1,0,0,114,102,0,0,0,114,14, - 1,0,0,114,89,0,0,0,41,3,90,10,101,120,116,101, - 110,115,105,111,110,115,90,6,115,111,117,114,99,101,90,8, - 98,121,116,101,99,111,100,101,114,3,0,0,0,114,3,0, - 0,0,114,6,0,0,0,114,184,0,0,0,251,5,0,0, - 115,8,0,0,0,0,5,12,1,8,1,8,1,114,184,0, - 0,0,99,1,0,0,0,0,0,0,0,12,0,0,0,9, - 0,0,0,67,0,0,0,115,178,1,0,0,124,0,97,0, - 116,0,106,1,97,1,116,0,106,2,97,2,116,1,106,3, - 116,4,25,0,125,1,100,1,68,0,93,48,125,2,124,2, - 116,1,106,3,107,7,114,56,116,0,160,5,124,2,161,1, - 125,3,110,10,116,1,106,3,124,2,25,0,125,3,116,6, - 124,1,124,2,124,3,131,3,1,0,113,30,100,2,100,3, - 103,1,102,2,100,4,100,5,100,3,103,2,102,2,102,2, - 125,4,124,4,68,0,93,110,92,2,125,5,125,6,116,7, - 100,6,100,7,132,0,124,6,68,0,131,1,131,1,115,136, - 116,8,130,1,124,6,100,8,25,0,125,7,124,5,116,1, - 106,3,107,6,114,170,116,1,106,3,124,5,25,0,125,8, - 1,0,113,226,113,106,122,20,116,0,160,5,124,5,161,1, - 125,8,87,0,1,0,113,226,87,0,113,106,4,0,116,9, - 107,10,114,214,1,0,1,0,1,0,89,0,113,106,89,0, - 113,106,88,0,113,106,116,9,100,9,131,1,130,1,116,6, - 124,1,100,10,124,8,131,3,1,0,116,6,124,1,100,11, - 124,7,131,3,1,0,116,6,124,1,100,12,100,13,160,10, - 124,6,161,1,131,3,1,0,116,6,124,1,100,14,100,15, - 100,16,132,0,124,6,68,0,131,1,131,3,1,0,116,0, - 160,5,100,17,161,1,125,9,116,6,124,1,100,17,124,9, - 131,3,1,0,116,0,160,5,100,18,161,1,125,10,116,6, - 124,1,100,18,124,10,131,3,1,0,124,5,100,4,107,2, - 144,1,114,110,116,0,160,5,100,19,161,1,125,11,116,6, - 124,1,100,20,124,11,131,3,1,0,116,6,124,1,100,21, - 116,11,131,0,131,3,1,0,116,12,160,13,116,2,160,14, - 161,0,161,1,1,0,124,5,100,4,107,2,144,1,114,174, - 116,15,160,16,100,22,161,1,1,0,100,23,116,12,107,6, - 144,1,114,174,100,24,116,17,95,18,100,25,83,0,41,26, - 122,205,83,101,116,117,112,32,116,104,101,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,101,114,115, - 32,102,111,114,32,105,109,112,111,114,116,108,105,98,32,98, - 121,32,105,109,112,111,114,116,105,110,103,32,110,101,101,100, - 101,100,10,32,32,32,32,98,117,105,108,116,45,105,110,32, - 109,111,100,117,108,101,115,32,97,110,100,32,105,110,106,101, - 99,116,105,110,103,32,116,104,101,109,32,105,110,116,111,32, - 116,104,101,32,103,108,111,98,97,108,32,110,97,109,101,115, - 112,97,99,101,46,10,10,32,32,32,32,79,116,104,101,114, - 32,99,111,109,112,111,110,101,110,116,115,32,97,114,101,32, - 101,120,116,114,97,99,116,101,100,32,102,114,111,109,32,116, - 104,101,32,99,111,114,101,32,98,111,111,116,115,116,114,97, - 112,32,109,111,100,117,108,101,46,10,10,32,32,32,32,41, - 4,114,64,0,0,0,114,75,0,0,0,218,8,98,117,105, - 108,116,105,110,115,114,160,0,0,0,90,5,112,111,115,105, - 120,250,1,47,90,2,110,116,250,1,92,99,1,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,115,0,0,0, - 115,26,0,0,0,124,0,93,18,125,1,116,0,124,1,131, - 1,100,0,107,2,86,0,1,0,113,2,100,1,83,0,41, - 2,114,39,0,0,0,78,41,1,114,22,0,0,0,41,2, - 114,32,0,0,0,114,95,0,0,0,114,3,0,0,0,114, - 3,0,0,0,114,6,0,0,0,114,19,1,0,0,31,6, - 0,0,115,4,0,0,0,4,0,2,0,122,25,95,115,101, - 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, - 110,101,120,112,114,62,114,73,0,0,0,122,30,105,109,112, - 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, - 112,111,115,105,120,32,111,114,32,110,116,114,2,0,0,0, - 114,35,0,0,0,114,31,0,0,0,114,40,0,0,0,114, - 58,0,0,0,99,1,0,0,0,0,0,0,0,2,0,0, - 0,4,0,0,0,83,0,0,0,115,22,0,0,0,104,0, - 124,0,93,14,125,1,100,0,124,1,155,0,157,2,146,2, - 113,4,83,0,41,1,114,74,0,0,0,114,3,0,0,0, - 41,2,114,32,0,0,0,218,1,115,114,3,0,0,0,114, - 3,0,0,0,114,6,0,0,0,114,66,1,0,0,47,6, - 0,0,115,4,0,0,0,6,0,2,0,122,25,95,115,101, - 116,117,112,46,60,108,111,99,97,108,115,62,46,60,115,101, - 116,99,111,109,112,62,90,7,95,116,104,114,101,97,100,90, - 8,95,119,101,97,107,114,101,102,90,6,119,105,110,114,101, - 103,114,192,0,0,0,114,7,0,0,0,122,4,46,112,121, - 119,122,6,95,100,46,112,121,100,84,78,41,19,114,134,0, - 0,0,114,8,0,0,0,114,163,0,0,0,114,31,1,0, - 0,114,125,0,0,0,90,18,95,98,117,105,108,116,105,110, - 95,102,114,111,109,95,110,97,109,101,114,129,0,0,0,218, - 3,97,108,108,114,23,0,0,0,114,118,0,0,0,114,36, - 0,0,0,114,13,0,0,0,114,21,1,0,0,114,167,0, - 0,0,114,78,1,0,0,114,102,0,0,0,114,186,0,0, - 0,114,191,0,0,0,114,195,0,0,0,41,12,218,17,95, - 98,111,111,116,115,116,114,97,112,95,109,111,100,117,108,101, - 90,11,115,101,108,102,95,109,111,100,117,108,101,90,12,98, - 117,105,108,116,105,110,95,110,97,109,101,90,14,98,117,105, - 108,116,105,110,95,109,111,100,117,108,101,90,10,111,115,95, - 100,101,116,97,105,108,115,90,10,98,117,105,108,116,105,110, - 95,111,115,114,31,0,0,0,114,35,0,0,0,90,9,111, - 115,95,109,111,100,117,108,101,90,13,116,104,114,101,97,100, - 95,109,111,100,117,108,101,90,14,119,101,97,107,114,101,102, - 95,109,111,100,117,108,101,90,13,119,105,110,114,101,103,95, - 109,111,100,117,108,101,114,3,0,0,0,114,3,0,0,0, - 114,6,0,0,0,218,6,95,115,101,116,117,112,6,6,0, - 0,115,78,0,0,0,0,8,4,1,6,1,6,3,10,1, - 8,1,10,1,12,2,10,1,14,3,22,1,12,2,22,1, - 8,1,10,1,10,1,6,2,2,1,10,1,10,1,14,1, - 12,2,8,1,12,1,12,1,18,1,22,3,10,1,12,3, - 10,1,12,3,10,1,10,1,12,3,14,1,14,1,10,1, - 10,1,10,1,114,85,1,0,0,99,1,0,0,0,0,0, - 0,0,2,0,0,0,4,0,0,0,67,0,0,0,115,50, - 0,0,0,116,0,124,0,131,1,1,0,116,1,131,0,125, - 1,116,2,106,3,160,4,116,5,106,6,124,1,142,0,103, - 1,161,1,1,0,116,2,106,7,160,8,116,9,161,1,1, - 0,100,1,83,0,41,2,122,41,73,110,115,116,97,108,108, - 32,116,104,101,32,112,97,116,104,45,98,97,115,101,100,32, - 105,109,112,111,114,116,32,99,111,109,112,111,110,101,110,116, - 115,46,78,41,10,114,85,1,0,0,114,184,0,0,0,114, - 8,0,0,0,114,49,1,0,0,114,167,0,0,0,114,57, - 1,0,0,114,72,1,0,0,218,9,109,101,116,97,95,112, - 97,116,104,114,186,0,0,0,114,43,1,0,0,41,2,114, - 84,1,0,0,90,17,115,117,112,112,111,114,116,101,100,95, - 108,111,97,100,101,114,115,114,3,0,0,0,114,3,0,0, - 0,114,6,0,0,0,218,8,95,105,110,115,116,97,108,108, - 71,6,0,0,115,8,0,0,0,0,2,8,1,6,1,20, - 1,114,87,1,0,0,41,63,114,127,0,0,0,114,12,0, - 0,0,90,37,95,67,65,83,69,95,73,78,83,69,78,83, - 73,84,73,86,69,95,80,76,65,84,70,79,82,77,83,95, - 66,89,84,69,83,95,75,69,89,114,11,0,0,0,114,13, - 0,0,0,114,20,0,0,0,114,27,0,0,0,114,29,0, - 0,0,114,38,0,0,0,114,47,0,0,0,114,49,0,0, - 0,114,53,0,0,0,114,54,0,0,0,114,56,0,0,0, - 114,59,0,0,0,114,69,0,0,0,218,4,116,121,112,101, - 218,8,95,95,99,111,100,101,95,95,114,162,0,0,0,114, - 18,0,0,0,114,148,0,0,0,114,17,0,0,0,114,24, - 0,0,0,114,236,0,0,0,114,92,0,0,0,114,88,0, - 0,0,114,102,0,0,0,114,89,0,0,0,90,23,68,69, - 66,85,71,95,66,89,84,69,67,79,68,69,95,83,85,70, - 70,73,88,69,83,90,27,79,80,84,73,77,73,90,69,68, - 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, - 69,83,114,98,0,0,0,114,103,0,0,0,114,109,0,0, - 0,114,113,0,0,0,114,115,0,0,0,114,136,0,0,0, - 114,143,0,0,0,114,152,0,0,0,114,156,0,0,0,114, - 158,0,0,0,114,165,0,0,0,114,170,0,0,0,114,171, - 0,0,0,114,176,0,0,0,218,6,111,98,106,101,99,116, - 114,185,0,0,0,114,190,0,0,0,114,191,0,0,0,114, - 208,0,0,0,114,221,0,0,0,114,239,0,0,0,114,8, - 1,0,0,114,14,1,0,0,114,21,1,0,0,114,15,1, - 0,0,114,22,1,0,0,114,41,1,0,0,114,43,1,0, - 0,114,57,1,0,0,114,77,1,0,0,114,184,0,0,0, - 114,85,1,0,0,114,87,1,0,0,114,3,0,0,0,114, - 3,0,0,0,114,3,0,0,0,114,6,0,0,0,218,8, - 60,109,111,100,117,108,101,62,1,0,0,0,115,126,0,0, - 0,4,22,4,1,4,1,2,1,2,255,4,4,8,17,8, - 5,8,5,8,6,8,6,8,12,8,10,8,9,8,5,8, - 7,8,9,12,22,10,127,0,7,16,1,12,2,4,1,4, - 2,6,2,6,2,8,2,18,71,8,40,8,19,8,12,8, - 12,8,28,8,17,8,33,8,28,8,24,16,13,14,10,12, - 11,8,14,6,3,6,1,2,255,12,68,14,64,14,29,16, - 127,0,17,14,68,18,45,18,26,4,3,18,53,14,60,14, - 42,14,127,0,7,14,127,0,22,12,23,8,11,8,65, + 0,114,203,0,0,0,44,5,0,0,115,26,0,0,0,0, + 6,8,1,6,1,14,1,8,1,4,1,10,1,6,1,4, + 3,6,1,16,1,4,2,6,2,122,20,80,97,116,104,70, + 105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,99, + 3,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0, + 67,0,0,0,115,30,0,0,0,124,0,160,0,124,1,124, + 2,161,2,125,3,124,3,100,1,107,8,114,24,100,1,83, + 0,124,3,106,1,83,0,41,2,122,170,102,105,110,100,32, + 116,104,101,32,109,111,100,117,108,101,32,111,110,32,115,121, + 115,46,112,97,116,104,32,111,114,32,39,112,97,116,104,39, + 32,98,97,115,101,100,32,111,110,32,115,121,115,46,112,97, + 116,104,95,104,111,111,107,115,32,97,110,100,10,32,32,32, + 32,32,32,32,32,115,121,115,46,112,97,116,104,95,105,109, + 112,111,114,116,101,114,95,99,97,99,104,101,46,10,10,32, + 32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,85,115,101,32,102,105,110,100,95,115,112,101,99, + 40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,32, + 32,32,32,32,32,78,114,204,0,0,0,114,205,0,0,0, + 114,3,0,0,0,114,3,0,0,0,114,6,0,0,0,114, + 206,0,0,0,68,5,0,0,115,8,0,0,0,0,8,12, + 1,8,1,4,1,122,22,80,97,116,104,70,105,110,100,101, + 114,46,102,105,110,100,95,109,111,100,117,108,101,41,1,78, + 41,2,78,78,41,1,78,41,12,114,125,0,0,0,114,124, + 0,0,0,114,126,0,0,0,114,127,0,0,0,114,207,0, + 0,0,114,46,1,0,0,114,52,1,0,0,114,54,1,0, + 0,114,55,1,0,0,114,58,1,0,0,114,203,0,0,0, + 114,206,0,0,0,114,3,0,0,0,114,3,0,0,0,114, + 3,0,0,0,114,6,0,0,0,114,45,1,0,0,204,4, + 0,0,115,30,0,0,0,8,2,4,2,2,1,10,9,2, + 1,10,12,2,1,10,21,2,1,10,14,2,1,12,31,2, + 1,12,23,2,1,114,45,1,0,0,99,0,0,0,0,0, + 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, + 90,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, + 100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5, + 101,6,90,7,100,6,100,7,132,0,90,8,100,8,100,9, + 132,0,90,9,100,19,100,11,100,12,132,1,90,10,100,13, + 100,14,132,0,90,11,101,12,100,15,100,16,132,0,131,1, + 90,13,100,17,100,18,132,0,90,14,100,10,83,0,41,20, + 218,10,70,105,108,101,70,105,110,100,101,114,122,172,70,105, + 108,101,45,98,97,115,101,100,32,102,105,110,100,101,114,46, + 10,10,32,32,32,32,73,110,116,101,114,97,99,116,105,111, + 110,115,32,119,105,116,104,32,116,104,101,32,102,105,108,101, + 32,115,121,115,116,101,109,32,97,114,101,32,99,97,99,104, + 101,100,32,102,111,114,32,112,101,114,102,111,114,109,97,110, + 99,101,44,32,98,101,105,110,103,10,32,32,32,32,114,101, + 102,114,101,115,104,101,100,32,119,104,101,110,32,116,104,101, + 32,100,105,114,101,99,116,111,114,121,32,116,104,101,32,102, + 105,110,100,101,114,32,105,115,32,104,97,110,100,108,105,110, + 103,32,104,97,115,32,98,101,101,110,32,109,111,100,105,102, + 105,101,100,46,10,10,32,32,32,32,99,2,0,0,0,0, + 0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,115, + 84,0,0,0,103,0,125,3,124,2,68,0,93,32,92,2, + 137,0,125,4,124,3,160,0,135,0,102,1,100,1,100,2, + 132,8,124,4,68,0,131,1,161,1,1,0,113,8,124,3, + 124,0,95,1,124,1,112,54,100,3,124,0,95,2,100,4, + 124,0,95,3,116,4,131,0,124,0,95,5,116,4,131,0, + 124,0,95,6,100,5,83,0,41,6,122,154,73,110,105,116, + 105,97,108,105,122,101,32,119,105,116,104,32,116,104,101,32, + 112,97,116,104,32,116,111,32,115,101,97,114,99,104,32,111, + 110,32,97,110,100,32,97,32,118,97,114,105,97,98,108,101, + 32,110,117,109,98,101,114,32,111,102,10,32,32,32,32,32, + 32,32,32,50,45,116,117,112,108,101,115,32,99,111,110,116, + 97,105,110,105,110,103,32,116,104,101,32,108,111,97,100,101, + 114,32,97,110,100,32,116,104,101,32,102,105,108,101,32,115, + 117,102,102,105,120,101,115,32,116,104,101,32,108,111,97,100, + 101,114,10,32,32,32,32,32,32,32,32,114,101,99,111,103, + 110,105,122,101,115,46,99,1,0,0,0,0,0,0,0,2, + 0,0,0,3,0,0,0,51,0,0,0,115,22,0,0,0, + 124,0,93,14,125,1,124,1,136,0,102,2,86,0,1,0, + 113,2,100,0,83,0,114,110,0,0,0,114,3,0,0,0, + 114,16,1,0,0,169,1,114,140,0,0,0,114,3,0,0, + 0,114,6,0,0,0,114,19,1,0,0,97,5,0,0,115, + 4,0,0,0,4,0,2,0,122,38,70,105,108,101,70,105, + 110,100,101,114,46,95,95,105,110,105,116,95,95,46,60,108, + 111,99,97,108,115,62,46,60,103,101,110,101,120,112,114,62, + 114,71,0,0,0,114,105,0,0,0,78,41,7,114,167,0, + 0,0,218,8,95,108,111,97,100,101,114,115,114,44,0,0, + 0,218,11,95,112,97,116,104,95,109,116,105,109,101,218,3, + 115,101,116,218,11,95,112,97,116,104,95,99,97,99,104,101, + 218,19,95,114,101,108,97,120,101,100,95,112,97,116,104,95, + 99,97,99,104,101,41,5,114,119,0,0,0,114,44,0,0, + 0,218,14,108,111,97,100,101,114,95,100,101,116,97,105,108, + 115,90,7,108,111,97,100,101,114,115,114,189,0,0,0,114, + 3,0,0,0,114,60,1,0,0,114,6,0,0,0,114,209, + 0,0,0,91,5,0,0,115,16,0,0,0,0,4,4,1, + 12,1,26,1,6,2,10,1,6,1,8,1,122,19,70,105, + 108,101,70,105,110,100,101,114,46,95,95,105,110,105,116,95, + 95,99,1,0,0,0,0,0,0,0,1,0,0,0,2,0, + 0,0,67,0,0,0,115,10,0,0,0,100,1,124,0,95, + 0,100,2,83,0,41,3,122,31,73,110,118,97,108,105,100, + 97,116,101,32,116,104,101,32,100,105,114,101,99,116,111,114, + 121,32,109,116,105,109,101,46,114,105,0,0,0,78,41,1, + 114,62,1,0,0,114,246,0,0,0,114,3,0,0,0,114, + 3,0,0,0,114,6,0,0,0,114,46,1,0,0,105,5, + 0,0,115,2,0,0,0,0,2,122,28,70,105,108,101,70, + 105,110,100,101,114,46,105,110,118,97,108,105,100,97,116,101, + 95,99,97,99,104,101,115,99,2,0,0,0,0,0,0,0, + 3,0,0,0,3,0,0,0,67,0,0,0,115,42,0,0, + 0,124,0,160,0,124,1,161,1,125,2,124,2,100,1,107, + 8,114,26,100,1,103,0,102,2,83,0,124,2,106,1,124, + 2,106,2,112,38,103,0,102,2,83,0,41,2,122,197,84, + 114,121,32,116,111,32,102,105,110,100,32,97,32,108,111,97, + 100,101,114,32,102,111,114,32,116,104,101,32,115,112,101,99, + 105,102,105,101,100,32,109,111,100,117,108,101,44,32,111,114, + 32,116,104,101,32,110,97,109,101,115,112,97,99,101,10,32, + 32,32,32,32,32,32,32,112,97,99,107,97,103,101,32,112, + 111,114,116,105,111,110,115,46,32,82,101,116,117,114,110,115, + 32,40,108,111,97,100,101,114,44,32,108,105,115,116,45,111, + 102,45,112,111,114,116,105,111,110,115,41,46,10,10,32,32, + 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, + 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, + 32,32,85,115,101,32,102,105,110,100,95,115,112,101,99,40, + 41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32, + 32,32,32,32,78,41,3,114,203,0,0,0,114,140,0,0, + 0,114,178,0,0,0,41,3,114,119,0,0,0,114,139,0, + 0,0,114,187,0,0,0,114,3,0,0,0,114,3,0,0, + 0,114,6,0,0,0,114,137,0,0,0,111,5,0,0,115, + 8,0,0,0,0,7,10,1,8,1,8,1,122,22,70,105, + 108,101,70,105,110,100,101,114,46,102,105,110,100,95,108,111, + 97,100,101,114,99,6,0,0,0,0,0,0,0,7,0,0, + 0,6,0,0,0,67,0,0,0,115,26,0,0,0,124,1, + 124,2,124,3,131,2,125,6,116,0,124,2,124,3,124,6, + 124,4,100,1,141,4,83,0,41,2,78,114,177,0,0,0, + 41,1,114,190,0,0,0,41,7,114,119,0,0,0,114,188, + 0,0,0,114,139,0,0,0,114,44,0,0,0,90,4,115, + 109,115,108,114,202,0,0,0,114,140,0,0,0,114,3,0, + 0,0,114,3,0,0,0,114,6,0,0,0,114,58,1,0, + 0,123,5,0,0,115,8,0,0,0,0,1,10,1,8,1, + 2,255,122,20,70,105,108,101,70,105,110,100,101,114,46,95, + 103,101,116,95,115,112,101,99,78,99,3,0,0,0,0,0, + 0,0,14,0,0,0,8,0,0,0,67,0,0,0,115,102, + 1,0,0,100,1,125,3,124,1,160,0,100,2,161,1,100, + 3,25,0,125,4,122,24,116,1,124,0,106,2,112,34,116, + 3,160,4,161,0,131,1,106,5,125,5,87,0,110,24,4, + 0,116,6,107,10,114,66,1,0,1,0,1,0,100,4,125, + 5,89,0,110,2,88,0,124,5,124,0,106,7,107,3,114, + 92,124,0,160,8,161,0,1,0,124,5,124,0,95,7,116, + 9,131,0,114,114,124,0,106,10,125,6,124,4,160,11,161, + 0,125,7,110,10,124,0,106,12,125,6,124,4,125,7,124, + 7,124,6,107,6,114,218,116,13,124,0,106,2,124,4,131, + 2,125,8,124,0,106,14,68,0,93,58,92,2,125,9,125, + 10,100,5,124,9,23,0,125,11,116,13,124,8,124,11,131, + 2,125,12,116,15,124,12,131,1,114,208,124,0,160,16,124, + 10,124,1,124,12,124,8,103,1,124,2,161,5,2,0,1, + 0,83,0,113,150,116,17,124,8,131,1,125,3,124,0,106, + 14,68,0,93,86,92,2,125,9,125,10,116,13,124,0,106, + 2,124,4,124,9,23,0,131,2,125,12,116,18,106,19,100, + 6,124,12,100,3,100,7,141,3,1,0,124,7,124,9,23, + 0,124,6,107,6,144,1,114,54,116,15,124,12,131,1,144, + 1,114,54,124,0,160,16,124,10,124,1,124,12,100,8,124, + 2,161,5,2,0,1,0,83,0,113,224,124,3,144,1,114, + 98,116,18,160,19,100,9,124,8,161,2,1,0,116,18,160, + 20,124,1,100,8,161,2,125,13,124,8,103,1,124,13,95, + 21,124,13,83,0,100,8,83,0,41,10,122,111,84,114,121, + 32,116,111,32,102,105,110,100,32,97,32,115,112,101,99,32, + 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101, + 100,32,109,111,100,117,108,101,46,10,10,32,32,32,32,32, + 32,32,32,82,101,116,117,114,110,115,32,116,104,101,32,109, + 97,116,99,104,105,110,103,32,115,112,101,99,44,32,111,114, + 32,78,111,110,101,32,105,102,32,110,111,116,32,102,111,117, + 110,100,46,10,32,32,32,32,32,32,32,32,70,114,71,0, + 0,0,114,28,0,0,0,114,105,0,0,0,114,209,0,0, + 0,122,9,116,114,121,105,110,103,32,123,125,41,1,90,9, + 118,101,114,98,111,115,105,116,121,78,122,25,112,111,115,115, + 105,98,108,101,32,110,97,109,101,115,112,97,99,101,32,102, + 111,114,32,123,125,41,22,114,41,0,0,0,114,49,0,0, + 0,114,44,0,0,0,114,2,0,0,0,114,55,0,0,0, + 114,9,1,0,0,114,50,0,0,0,114,62,1,0,0,218, + 11,95,102,105,108,108,95,99,97,99,104,101,114,7,0,0, + 0,114,65,1,0,0,114,106,0,0,0,114,64,1,0,0, + 114,38,0,0,0,114,61,1,0,0,114,54,0,0,0,114, + 58,1,0,0,114,56,0,0,0,114,134,0,0,0,114,149, + 0,0,0,114,183,0,0,0,114,178,0,0,0,41,14,114, + 119,0,0,0,114,139,0,0,0,114,202,0,0,0,90,12, + 105,115,95,110,97,109,101,115,112,97,99,101,90,11,116,97, + 105,108,95,109,111,100,117,108,101,114,169,0,0,0,90,5, + 99,97,99,104,101,90,12,99,97,99,104,101,95,109,111,100, + 117,108,101,90,9,98,97,115,101,95,112,97,116,104,114,17, + 1,0,0,114,188,0,0,0,90,13,105,110,105,116,95,102, + 105,108,101,110,97,109,101,90,9,102,117,108,108,95,112,97, + 116,104,114,187,0,0,0,114,3,0,0,0,114,3,0,0, + 0,114,6,0,0,0,114,203,0,0,0,128,5,0,0,115, + 74,0,0,0,0,5,4,1,14,1,2,1,24,1,14,1, + 10,1,10,1,8,1,6,2,6,1,6,1,10,2,6,1, + 4,2,8,1,12,1,14,1,8,1,10,1,8,1,26,4, + 8,2,14,1,16,1,16,1,14,1,10,1,10,1,2,0, + 2,255,10,2,6,1,12,1,12,1,8,1,4,1,122,20, + 70,105,108,101,70,105,110,100,101,114,46,102,105,110,100,95, + 115,112,101,99,99,1,0,0,0,0,0,0,0,9,0,0, + 0,10,0,0,0,67,0,0,0,115,190,0,0,0,124,0, + 106,0,125,1,122,22,116,1,160,2,124,1,112,22,116,1, + 160,3,161,0,161,1,125,2,87,0,110,30,4,0,116,4, + 116,5,116,6,102,3,107,10,114,58,1,0,1,0,1,0, + 103,0,125,2,89,0,110,2,88,0,116,7,106,8,160,9, + 100,1,161,1,115,84,116,10,124,2,131,1,124,0,95,11, + 110,74,116,10,131,0,125,3,124,2,68,0,93,56,125,4, + 124,4,160,12,100,2,161,1,92,3,125,5,125,6,125,7, + 124,6,114,136,100,3,160,13,124,5,124,7,160,14,161,0, + 161,2,125,8,110,4,124,5,125,8,124,3,160,15,124,8, + 161,1,1,0,113,94,124,3,124,0,95,11,116,7,106,8, + 160,9,116,16,161,1,114,186,100,4,100,5,132,0,124,2, + 68,0,131,1,124,0,95,17,100,6,83,0,41,7,122,68, + 70,105,108,108,32,116,104,101,32,99,97,99,104,101,32,111, + 102,32,112,111,116,101,110,116,105,97,108,32,109,111,100,117, + 108,101,115,32,97,110,100,32,112,97,99,107,97,103,101,115, + 32,102,111,114,32,116,104,105,115,32,100,105,114,101,99,116, + 111,114,121,46,114,0,0,0,0,114,71,0,0,0,114,61, + 0,0,0,99,1,0,0,0,0,0,0,0,2,0,0,0, + 4,0,0,0,83,0,0,0,115,20,0,0,0,104,0,124, + 0,93,12,125,1,124,1,160,0,161,0,146,2,113,4,83, + 0,114,3,0,0,0,41,1,114,106,0,0,0,41,2,114, + 32,0,0,0,90,2,102,110,114,3,0,0,0,114,3,0, + 0,0,114,6,0,0,0,218,9,60,115,101,116,99,111,109, + 112,62,205,5,0,0,115,4,0,0,0,6,0,2,0,122, + 41,70,105,108,101,70,105,110,100,101,114,46,95,102,105,108, + 108,95,99,97,99,104,101,46,60,108,111,99,97,108,115,62, + 46,60,115,101,116,99,111,109,112,62,78,41,18,114,44,0, + 0,0,114,2,0,0,0,114,6,1,0,0,114,55,0,0, + 0,114,2,1,0,0,218,15,80,101,114,109,105,115,115,105, + 111,110,69,114,114,111,114,218,18,78,111,116,65,68,105,114, + 101,99,116,111,114,121,69,114,114,111,114,114,8,0,0,0, + 114,9,0,0,0,114,10,0,0,0,114,63,1,0,0,114, + 64,1,0,0,114,101,0,0,0,114,62,0,0,0,114,106, + 0,0,0,218,3,97,100,100,114,11,0,0,0,114,65,1, + 0,0,41,9,114,119,0,0,0,114,44,0,0,0,114,7, + 1,0,0,90,21,108,111,119,101,114,95,115,117,102,102,105, + 120,95,99,111,110,116,101,110,116,115,114,41,1,0,0,114, + 117,0,0,0,114,29,1,0,0,114,17,1,0,0,90,8, + 110,101,119,95,110,97,109,101,114,3,0,0,0,114,3,0, + 0,0,114,6,0,0,0,114,67,1,0,0,176,5,0,0, + 115,34,0,0,0,0,2,6,1,2,1,22,1,20,3,10, + 3,12,1,12,7,6,1,8,1,16,1,4,1,18,2,4, + 1,12,1,6,1,12,1,122,22,70,105,108,101,70,105,110, + 100,101,114,46,95,102,105,108,108,95,99,97,99,104,101,99, + 1,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, + 7,0,0,0,115,18,0,0,0,135,0,135,1,102,2,100, + 1,100,2,132,8,125,2,124,2,83,0,41,3,97,20,1, + 0,0,65,32,99,108,97,115,115,32,109,101,116,104,111,100, + 32,119,104,105,99,104,32,114,101,116,117,114,110,115,32,97, + 32,99,108,111,115,117,114,101,32,116,111,32,117,115,101,32, + 111,110,32,115,121,115,46,112,97,116,104,95,104,111,111,107, + 10,32,32,32,32,32,32,32,32,119,104,105,99,104,32,119, + 105,108,108,32,114,101,116,117,114,110,32,97,110,32,105,110, + 115,116,97,110,99,101,32,117,115,105,110,103,32,116,104,101, + 32,115,112,101,99,105,102,105,101,100,32,108,111,97,100,101, + 114,115,32,97,110,100,32,116,104,101,32,112,97,116,104,10, + 32,32,32,32,32,32,32,32,99,97,108,108,101,100,32,111, + 110,32,116,104,101,32,99,108,111,115,117,114,101,46,10,10, + 32,32,32,32,32,32,32,32,73,102,32,116,104,101,32,112, + 97,116,104,32,99,97,108,108,101,100,32,111,110,32,116,104, + 101,32,99,108,111,115,117,114,101,32,105,115,32,110,111,116, + 32,97,32,100,105,114,101,99,116,111,114,121,44,32,73,109, + 112,111,114,116,69,114,114,111,114,32,105,115,10,32,32,32, + 32,32,32,32,32,114,97,105,115,101,100,46,10,10,32,32, + 32,32,32,32,32,32,99,1,0,0,0,0,0,0,0,1, + 0,0,0,4,0,0,0,19,0,0,0,115,34,0,0,0, + 116,0,124,0,131,1,115,20,116,1,100,1,124,0,100,2, + 141,2,130,1,136,0,124,0,102,1,136,1,158,2,142,0, + 83,0,41,3,122,45,80,97,116,104,32,104,111,111,107,32, + 102,111,114,32,105,109,112,111,114,116,108,105,98,46,109,97, + 99,104,105,110,101,114,121,46,70,105,108,101,70,105,110,100, + 101,114,46,122,30,111,110,108,121,32,100,105,114,101,99,116, + 111,114,105,101,115,32,97,114,101,32,115,117,112,112,111,114, + 116,101,100,114,48,0,0,0,41,2,114,56,0,0,0,114, + 118,0,0,0,114,48,0,0,0,169,2,114,193,0,0,0, + 114,66,1,0,0,114,3,0,0,0,114,6,0,0,0,218, + 24,112,97,116,104,95,104,111,111,107,95,102,111,114,95,70, + 105,108,101,70,105,110,100,101,114,217,5,0,0,115,6,0, + 0,0,0,2,8,1,12,1,122,54,70,105,108,101,70,105, + 110,100,101,114,46,112,97,116,104,95,104,111,111,107,46,60, + 108,111,99,97,108,115,62,46,112,97,116,104,95,104,111,111, + 107,95,102,111,114,95,70,105,108,101,70,105,110,100,101,114, + 114,3,0,0,0,41,3,114,193,0,0,0,114,66,1,0, + 0,114,73,1,0,0,114,3,0,0,0,114,72,1,0,0, + 114,6,0,0,0,218,9,112,97,116,104,95,104,111,111,107, + 207,5,0,0,115,4,0,0,0,0,10,14,6,122,20,70, + 105,108,101,70,105,110,100,101,114,46,112,97,116,104,95,104, + 111,111,107,99,1,0,0,0,0,0,0,0,1,0,0,0, + 3,0,0,0,67,0,0,0,115,12,0,0,0,100,1,160, + 0,124,0,106,1,161,1,83,0,41,2,78,122,16,70,105, + 108,101,70,105,110,100,101,114,40,123,33,114,125,41,41,2, + 114,62,0,0,0,114,44,0,0,0,114,246,0,0,0,114, + 3,0,0,0,114,3,0,0,0,114,6,0,0,0,114,39, + 1,0,0,225,5,0,0,115,2,0,0,0,0,1,122,19, + 70,105,108,101,70,105,110,100,101,114,46,95,95,114,101,112, + 114,95,95,41,1,78,41,15,114,125,0,0,0,114,124,0, + 0,0,114,126,0,0,0,114,127,0,0,0,114,209,0,0, + 0,114,46,1,0,0,114,143,0,0,0,114,206,0,0,0, + 114,137,0,0,0,114,58,1,0,0,114,203,0,0,0,114, + 67,1,0,0,114,207,0,0,0,114,74,1,0,0,114,39, + 1,0,0,114,3,0,0,0,114,3,0,0,0,114,3,0, + 0,0,114,6,0,0,0,114,59,1,0,0,82,5,0,0, + 115,22,0,0,0,8,2,4,7,8,14,8,4,4,2,8, + 12,8,5,10,48,8,31,2,1,10,17,114,59,1,0,0, + 99,4,0,0,0,0,0,0,0,6,0,0,0,8,0,0, + 0,67,0,0,0,115,146,0,0,0,124,0,160,0,100,1, + 161,1,125,4,124,0,160,0,100,2,161,1,125,5,124,4, + 115,66,124,5,114,36,124,5,106,1,125,4,110,30,124,2, + 124,3,107,2,114,56,116,2,124,1,124,2,131,2,125,4, + 110,10,116,3,124,1,124,2,131,2,125,4,124,5,115,84, + 116,4,124,1,124,2,124,4,100,3,141,3,125,5,122,36, + 124,5,124,0,100,2,60,0,124,4,124,0,100,1,60,0, + 124,2,124,0,100,4,60,0,124,3,124,0,100,5,60,0, + 87,0,110,20,4,0,116,5,107,10,114,140,1,0,1,0, + 1,0,89,0,110,2,88,0,100,0,83,0,41,6,78,218, + 10,95,95,108,111,97,100,101,114,95,95,218,8,95,95,115, + 112,101,99,95,95,114,60,1,0,0,90,8,95,95,102,105, + 108,101,95,95,90,10,95,95,99,97,99,104,101,100,95,95, + 41,6,218,3,103,101,116,114,140,0,0,0,114,14,1,0, + 0,114,8,1,0,0,114,190,0,0,0,218,9,69,120,99, + 101,112,116,105,111,110,41,6,90,2,110,115,114,117,0,0, + 0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,97, + 116,104,110,97,109,101,114,140,0,0,0,114,187,0,0,0, + 114,3,0,0,0,114,3,0,0,0,114,6,0,0,0,218, + 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,231, + 5,0,0,115,34,0,0,0,0,2,10,1,10,1,4,1, + 4,1,8,1,8,1,12,2,10,1,4,1,14,1,2,1, + 8,1,8,1,8,1,12,1,14,2,114,79,1,0,0,99, + 0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, + 67,0,0,0,115,38,0,0,0,116,0,116,1,160,2,161, + 0,102,2,125,0,116,3,116,4,102,2,125,1,116,5,116, + 6,102,2,125,2,124,0,124,1,124,2,103,3,83,0,41, + 1,122,95,82,101,116,117,114,110,115,32,97,32,108,105,115, + 116,32,111,102,32,102,105,108,101,45,98,97,115,101,100,32, + 109,111,100,117,108,101,32,108,111,97,100,101,114,115,46,10, + 10,32,32,32,32,69,97,99,104,32,105,116,101,109,32,105, + 115,32,97,32,116,117,112,108,101,32,40,108,111,97,100,101, + 114,44,32,115,117,102,102,105,120,101,115,41,46,10,32,32, + 32,32,41,7,114,15,1,0,0,114,163,0,0,0,218,18, + 101,120,116,101,110,115,105,111,110,95,115,117,102,102,105,120, + 101,115,114,8,1,0,0,114,102,0,0,0,114,14,1,0, + 0,114,89,0,0,0,41,3,90,10,101,120,116,101,110,115, + 105,111,110,115,90,6,115,111,117,114,99,101,90,8,98,121, + 116,101,99,111,100,101,114,3,0,0,0,114,3,0,0,0, + 114,6,0,0,0,114,184,0,0,0,254,5,0,0,115,8, + 0,0,0,0,5,12,1,8,1,8,1,114,184,0,0,0, + 99,1,0,0,0,0,0,0,0,12,0,0,0,9,0,0, + 0,67,0,0,0,115,178,1,0,0,124,0,97,0,116,0, + 106,1,97,1,116,0,106,2,97,2,116,1,106,3,116,4, + 25,0,125,1,100,1,68,0,93,48,125,2,124,2,116,1, + 106,3,107,7,114,56,116,0,160,5,124,2,161,1,125,3, + 110,10,116,1,106,3,124,2,25,0,125,3,116,6,124,1, + 124,2,124,3,131,3,1,0,113,30,100,2,100,3,103,1, + 102,2,100,4,100,5,100,3,103,2,102,2,102,2,125,4, + 124,4,68,0,93,110,92,2,125,5,125,6,116,7,100,6, + 100,7,132,0,124,6,68,0,131,1,131,1,115,136,116,8, + 130,1,124,6,100,8,25,0,125,7,124,5,116,1,106,3, + 107,6,114,170,116,1,106,3,124,5,25,0,125,8,1,0, + 113,226,113,106,122,20,116,0,160,5,124,5,161,1,125,8, + 87,0,1,0,113,226,87,0,113,106,4,0,116,9,107,10, + 114,214,1,0,1,0,1,0,89,0,113,106,89,0,113,106, + 88,0,113,106,116,9,100,9,131,1,130,1,116,6,124,1, + 100,10,124,8,131,3,1,0,116,6,124,1,100,11,124,7, + 131,3,1,0,116,6,124,1,100,12,100,13,160,10,124,6, + 161,1,131,3,1,0,116,6,124,1,100,14,100,15,100,16, + 132,0,124,6,68,0,131,1,131,3,1,0,116,0,160,5, + 100,17,161,1,125,9,116,6,124,1,100,17,124,9,131,3, + 1,0,116,0,160,5,100,18,161,1,125,10,116,6,124,1, + 100,18,124,10,131,3,1,0,124,5,100,4,107,2,144,1, + 114,110,116,0,160,5,100,19,161,1,125,11,116,6,124,1, + 100,20,124,11,131,3,1,0,116,6,124,1,100,21,116,11, + 131,0,131,3,1,0,116,12,160,13,116,2,160,14,161,0, + 161,1,1,0,124,5,100,4,107,2,144,1,114,174,116,15, + 160,16,100,22,161,1,1,0,100,23,116,12,107,6,144,1, + 114,174,100,24,116,17,95,18,100,25,83,0,41,26,122,205, + 83,101,116,117,112,32,116,104,101,32,112,97,116,104,45,98, + 97,115,101,100,32,105,109,112,111,114,116,101,114,115,32,102, + 111,114,32,105,109,112,111,114,116,108,105,98,32,98,121,32, + 105,109,112,111,114,116,105,110,103,32,110,101,101,100,101,100, + 10,32,32,32,32,98,117,105,108,116,45,105,110,32,109,111, + 100,117,108,101,115,32,97,110,100,32,105,110,106,101,99,116, + 105,110,103,32,116,104,101,109,32,105,110,116,111,32,116,104, + 101,32,103,108,111,98,97,108,32,110,97,109,101,115,112,97, + 99,101,46,10,10,32,32,32,32,79,116,104,101,114,32,99, + 111,109,112,111,110,101,110,116,115,32,97,114,101,32,101,120, + 116,114,97,99,116,101,100,32,102,114,111,109,32,116,104,101, + 32,99,111,114,101,32,98,111,111,116,115,116,114,97,112,32, + 109,111,100,117,108,101,46,10,10,32,32,32,32,41,4,114, + 64,0,0,0,114,75,0,0,0,218,8,98,117,105,108,116, + 105,110,115,114,160,0,0,0,90,5,112,111,115,105,120,250, + 1,47,90,2,110,116,250,1,92,99,1,0,0,0,0,0, + 0,0,2,0,0,0,3,0,0,0,115,0,0,0,115,26, + 0,0,0,124,0,93,18,125,1,116,0,124,1,131,1,100, + 0,107,2,86,0,1,0,113,2,100,1,83,0,41,2,114, + 39,0,0,0,78,41,1,114,22,0,0,0,41,2,114,32, + 0,0,0,114,95,0,0,0,114,3,0,0,0,114,3,0, + 0,0,114,6,0,0,0,114,19,1,0,0,34,6,0,0, + 115,4,0,0,0,4,0,2,0,122,25,95,115,101,116,117, + 112,46,60,108,111,99,97,108,115,62,46,60,103,101,110,101, + 120,112,114,62,114,73,0,0,0,122,30,105,109,112,111,114, + 116,108,105,98,32,114,101,113,117,105,114,101,115,32,112,111, + 115,105,120,32,111,114,32,110,116,114,2,0,0,0,114,35, + 0,0,0,114,31,0,0,0,114,40,0,0,0,114,58,0, + 0,0,99,1,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,83,0,0,0,115,22,0,0,0,104,0,124,0, + 93,14,125,1,100,0,124,1,155,0,157,2,146,2,113,4, + 83,0,41,1,114,74,0,0,0,114,3,0,0,0,41,2, + 114,32,0,0,0,218,1,115,114,3,0,0,0,114,3,0, + 0,0,114,6,0,0,0,114,68,1,0,0,50,6,0,0, + 115,4,0,0,0,6,0,2,0,122,25,95,115,101,116,117, + 112,46,60,108,111,99,97,108,115,62,46,60,115,101,116,99, + 111,109,112,62,90,7,95,116,104,114,101,97,100,90,8,95, + 119,101,97,107,114,101,102,90,6,119,105,110,114,101,103,114, + 192,0,0,0,114,7,0,0,0,122,4,46,112,121,119,122, + 6,95,100,46,112,121,100,84,78,41,19,114,134,0,0,0, + 114,8,0,0,0,114,163,0,0,0,114,31,1,0,0,114, + 125,0,0,0,90,18,95,98,117,105,108,116,105,110,95,102, + 114,111,109,95,110,97,109,101,114,129,0,0,0,218,3,97, + 108,108,114,23,0,0,0,114,118,0,0,0,114,36,0,0, + 0,114,13,0,0,0,114,21,1,0,0,114,167,0,0,0, + 114,80,1,0,0,114,102,0,0,0,114,186,0,0,0,114, + 191,0,0,0,114,195,0,0,0,41,12,218,17,95,98,111, + 111,116,115,116,114,97,112,95,109,111,100,117,108,101,90,11, + 115,101,108,102,95,109,111,100,117,108,101,90,12,98,117,105, + 108,116,105,110,95,110,97,109,101,90,14,98,117,105,108,116, + 105,110,95,109,111,100,117,108,101,90,10,111,115,95,100,101, + 116,97,105,108,115,90,10,98,117,105,108,116,105,110,95,111, + 115,114,31,0,0,0,114,35,0,0,0,90,9,111,115,95, + 109,111,100,117,108,101,90,13,116,104,114,101,97,100,95,109, + 111,100,117,108,101,90,14,119,101,97,107,114,101,102,95,109, + 111,100,117,108,101,90,13,119,105,110,114,101,103,95,109,111, + 100,117,108,101,114,3,0,0,0,114,3,0,0,0,114,6, + 0,0,0,218,6,95,115,101,116,117,112,9,6,0,0,115, + 78,0,0,0,0,8,4,1,6,1,6,3,10,1,8,1, + 10,1,12,2,10,1,14,3,22,1,12,2,22,1,8,1, + 10,1,10,1,6,2,2,1,10,1,10,1,14,1,12,2, + 8,1,12,1,12,1,18,1,22,3,10,1,12,3,10,1, + 12,3,10,1,10,1,12,3,14,1,14,1,10,1,10,1, + 10,1,114,87,1,0,0,99,1,0,0,0,0,0,0,0, + 2,0,0,0,4,0,0,0,67,0,0,0,115,50,0,0, + 0,116,0,124,0,131,1,1,0,116,1,131,0,125,1,116, + 2,106,3,160,4,116,5,106,6,124,1,142,0,103,1,161, + 1,1,0,116,2,106,7,160,8,116,9,161,1,1,0,100, + 1,83,0,41,2,122,41,73,110,115,116,97,108,108,32,116, + 104,101,32,112,97,116,104,45,98,97,115,101,100,32,105,109, + 112,111,114,116,32,99,111,109,112,111,110,101,110,116,115,46, + 78,41,10,114,87,1,0,0,114,184,0,0,0,114,8,0, + 0,0,114,51,1,0,0,114,167,0,0,0,114,59,1,0, + 0,114,74,1,0,0,218,9,109,101,116,97,95,112,97,116, + 104,114,186,0,0,0,114,45,1,0,0,41,2,114,86,1, + 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, + 97,100,101,114,115,114,3,0,0,0,114,3,0,0,0,114, + 6,0,0,0,218,8,95,105,110,115,116,97,108,108,74,6, + 0,0,115,8,0,0,0,0,2,8,1,6,1,20,1,114, + 89,1,0,0,41,63,114,127,0,0,0,114,12,0,0,0, + 90,37,95,67,65,83,69,95,73,78,83,69,78,83,73,84, + 73,86,69,95,80,76,65,84,70,79,82,77,83,95,66,89, + 84,69,83,95,75,69,89,114,11,0,0,0,114,13,0,0, + 0,114,20,0,0,0,114,27,0,0,0,114,29,0,0,0, + 114,38,0,0,0,114,47,0,0,0,114,49,0,0,0,114, + 53,0,0,0,114,54,0,0,0,114,56,0,0,0,114,59, + 0,0,0,114,69,0,0,0,218,4,116,121,112,101,218,8, + 95,95,99,111,100,101,95,95,114,162,0,0,0,114,18,0, + 0,0,114,148,0,0,0,114,17,0,0,0,114,24,0,0, + 0,114,236,0,0,0,114,92,0,0,0,114,88,0,0,0, + 114,102,0,0,0,114,89,0,0,0,90,23,68,69,66,85, + 71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,73, + 88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,66, + 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, + 114,98,0,0,0,114,103,0,0,0,114,109,0,0,0,114, + 113,0,0,0,114,115,0,0,0,114,136,0,0,0,114,143, + 0,0,0,114,152,0,0,0,114,156,0,0,0,114,158,0, + 0,0,114,165,0,0,0,114,170,0,0,0,114,171,0,0, + 0,114,176,0,0,0,218,6,111,98,106,101,99,116,114,185, + 0,0,0,114,190,0,0,0,114,191,0,0,0,114,208,0, + 0,0,114,221,0,0,0,114,239,0,0,0,114,8,1,0, + 0,114,14,1,0,0,114,21,1,0,0,114,15,1,0,0, + 114,22,1,0,0,114,43,1,0,0,114,45,1,0,0,114, + 59,1,0,0,114,79,1,0,0,114,184,0,0,0,114,87, + 1,0,0,114,89,1,0,0,114,3,0,0,0,114,3,0, + 0,0,114,3,0,0,0,114,6,0,0,0,218,8,60,109, + 111,100,117,108,101,62,1,0,0,0,115,126,0,0,0,4, + 22,4,1,4,1,2,1,2,255,4,4,8,17,8,5,8, + 5,8,6,8,6,8,12,8,10,8,9,8,5,8,7,8, + 9,12,22,10,127,0,7,16,1,12,2,4,1,4,2,6, + 2,6,2,8,2,18,71,8,40,8,19,8,12,8,12,8, + 28,8,17,8,33,8,28,8,24,16,13,14,10,12,11,8, + 14,6,3,6,1,2,255,12,68,14,64,14,29,16,127,0, + 17,14,68,18,45,18,26,4,3,18,53,14,63,14,42,14, + 127,0,7,14,127,0,22,12,23,8,11,8,65, }; diff --git a/Python/modsupport.c b/Python/modsupport.c index 8a77a7b06d..6255822107 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -342,8 +342,13 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) ++*p_format; if (flags & FLAG_SIZE_T) n = va_arg(*p_va, Py_ssize_t); - else + else { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { + return NULL; + } n = va_arg(*p_va, int); + } } else n = -1; @@ -390,8 +395,13 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) ++*p_format; if (flags & FLAG_SIZE_T) n = va_arg(*p_va, Py_ssize_t); - else + else { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { + return NULL; + } n = va_arg(*p_va, int); + } } else n = -1; @@ -423,8 +433,13 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) ++*p_format; if (flags & FLAG_SIZE_T) n = va_arg(*p_va, Py_ssize_t); - else + else { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { + return NULL; + } n = va_arg(*p_va, int); + } } else n = -1; diff --git a/Python/pathconfig.c b/Python/pathconfig.c index 14dbba78af..10e141a47d 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -149,19 +149,24 @@ done: void _PyPathConfig_ClearGlobal(void) { + PyMemAllocatorEx old_alloc; + _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + _PyPathConfig_Clear(&_Py_path_config); + + PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } static wchar_t* -wstrlist_join(wchar_t sep, int count, wchar_t **list) +_PyWstrList_Join(const _PyWstrList *list, wchar_t sep) { size_t len = 1; /* NUL terminator */ - for (int i=0; i < count; i++) { + for (Py_ssize_t i=0; i < list->length; i++) { if (i != 0) { len++; } - len += wcslen(list[i]); + len += wcslen(list->items[i]); } wchar_t *text = PyMem_RawMalloc(len * sizeof(wchar_t)); @@ -169,8 +174,8 @@ wstrlist_join(wchar_t sep, int count, wchar_t **list) return NULL; } wchar_t *str = text; - for (int i=0; i < count; i++) { - wchar_t *path = list[i]; + for (Py_ssize_t i=0; i < list->length; i++) { + wchar_t *path = list->items[i]; if (i != 0) { *str++ = SEP; } @@ -194,9 +199,7 @@ _PyCoreConfig_SetPathConfig(const _PyCoreConfig *core_config) _PyInitError err; _PyPathConfig path_config = _PyPathConfig_INIT; - path_config.module_search_path = wstrlist_join(DELIM, - core_config->nmodule_search_path, - core_config->module_search_paths); + path_config.module_search_path = _PyWstrList_Join(&core_config->module_search_paths, DELIM); if (path_config.module_search_path == NULL) { goto no_memory; } @@ -244,10 +247,9 @@ static _PyInitError core_config_init_module_search_paths(_PyCoreConfig *config, _PyPathConfig *path_config) { - assert(config->module_search_paths == NULL); - assert(config->nmodule_search_path < 0); + assert(!config->use_module_search_paths); - config->nmodule_search_path = 0; + _PyWstrList_Clear(&config->module_search_paths); const wchar_t *sys_path = path_config->module_search_path; const wchar_t delim = DELIM; @@ -266,12 +268,10 @@ core_config_init_module_search_paths(_PyCoreConfig *config, memcpy(path, sys_path, path_len * sizeof(wchar_t)); path[path_len] = L'\0'; - _PyInitError err = _Py_wstrlist_append(&config->nmodule_search_path, - &config->module_search_paths, - path); + int res = _PyWstrList_Append(&config->module_search_paths, path); PyMem_RawFree(path); - if (_Py_INIT_FAILED(err)) { - return err; + if (res < 0) { + return _Py_INIT_NO_MEMORY(); } if (*p == '\0') { @@ -279,6 +279,7 @@ core_config_init_module_search_paths(_PyCoreConfig *config, } sys_path = p + 1; } + config->use_module_search_paths = 1; return _Py_INIT_OK(); } @@ -294,7 +295,7 @@ _PyCoreConfig_CalculatePathConfig(_PyCoreConfig *config) goto error; } - if (config->nmodule_search_path < 0) { + if (!config->use_module_search_paths) { err = core_config_init_module_search_paths(config, &path_config); if (_Py_INIT_FAILED(err)) { goto error; @@ -330,7 +331,7 @@ _PyCoreConfig_CalculatePathConfig(_PyCoreConfig *config) #endif if (path_config.isolated != -1) { - config->preconfig.isolated = path_config.isolated; + config->isolated = path_config.isolated; } if (path_config.site_import != -1) { config->site_import = path_config.site_import; @@ -352,7 +353,7 @@ _PyInitError _PyCoreConfig_InitPathConfig(_PyCoreConfig *config) { /* Do we need to calculate the path? */ - if ((config->nmodule_search_path < 0) + if (!config->use_module_search_paths || (config->executable == NULL) || (config->prefix == NULL) #ifdef MS_WINDOWS @@ -565,70 +566,91 @@ Py_GetProgramName(void) return _Py_path_config.program_name; } -/* Compute argv[0] which will be prepended to sys.argv */ -PyObject* -_PyPathConfig_ComputeArgv0(int argc, wchar_t **argv) +/* Compute module search path from argv[0] or the current working + directory ("-m module" case) which will be prepended to sys.argv: + sys.path[0]. + + Return 1 if the path is correctly resolved, but *path0_p can be NULL + if the Unicode object fail to be created. + + Return 0 if it fails to resolve the full path (and *path0_p will be NULL). + For example, return 0 if the current working directory has been removed + (bpo-36236) or if argv is empty. + */ +int +_PyPathConfig_ComputeSysPath0(const _PyWstrList *argv, PyObject **path0_p) { - wchar_t *argv0; - wchar_t *p = NULL; + assert(_PyWstrList_CheckConsistency(argv)); + assert(*path0_p == NULL); + + if (argv->length == 0) { + /* Leave sys.path unchanged if sys.argv is empty */ + return 0; + } + + wchar_t *argv0 = argv->items[0]; + int have_module_arg = (wcscmp(argv0, L"-m") == 0); + int have_script_arg = (!have_module_arg && (wcscmp(argv0, L"-c") != 0)); + + wchar_t *path0 = argv0; Py_ssize_t n = 0; - int have_script_arg = 0; - int have_module_arg = 0; -#ifdef HAVE_READLINK - wchar_t link[MAXPATHLEN+1]; - wchar_t argv0copy[2*MAXPATHLEN+1]; - int nr = 0; -#endif -#if defined(HAVE_REALPATH) + +#ifdef HAVE_REALPATH wchar_t fullpath[MAXPATHLEN]; #elif defined(MS_WINDOWS) wchar_t fullpath[MAX_PATH]; #endif - argv0 = argv[0]; - if (argc > 0 && argv0 != NULL) { - have_module_arg = (wcscmp(argv0, L"-m") == 0); - have_script_arg = !have_module_arg && (wcscmp(argv0, L"-c") != 0); - } - if (have_module_arg) { - #if defined(HAVE_REALPATH) || defined(MS_WINDOWS) - _Py_wgetcwd(fullpath, Py_ARRAY_LENGTH(fullpath)); - argv0 = fullpath; - n = wcslen(argv0); - #else - argv0 = L"."; - n = 1; - #endif +#if defined(HAVE_REALPATH) || defined(MS_WINDOWS) + if (!_Py_wgetcwd(fullpath, Py_ARRAY_LENGTH(fullpath))) { + return 0; + } + path0 = fullpath; +#else + path0 = L"."; +#endif + n = wcslen(path0); } #ifdef HAVE_READLINK - if (have_script_arg) - nr = _Py_wreadlink(argv0, link, MAXPATHLEN); + wchar_t link[MAXPATHLEN + 1]; + int nr = 0; + + if (have_script_arg) { + nr = _Py_wreadlink(path0, link, Py_ARRAY_LENGTH(link)); + } if (nr > 0) { /* It's a symlink */ link[nr] = '\0'; - if (link[0] == SEP) - argv0 = link; /* Link to absolute path */ - else if (wcschr(link, SEP) == NULL) - ; /* Link without path */ + if (link[0] == SEP) { + path0 = link; /* Link to absolute path */ + } + else if (wcschr(link, SEP) == NULL) { + /* Link without path */ + } else { - /* Must join(dirname(argv0), link) */ - wchar_t *q = wcsrchr(argv0, SEP); - if (q == NULL) - argv0 = link; /* argv0 without path */ + /* Must join(dirname(path0), link) */ + wchar_t *q = wcsrchr(path0, SEP); + if (q == NULL) { + /* path0 without path */ + path0 = link; + } else { - /* Must make a copy, argv0copy has room for 2 * MAXPATHLEN */ - wcsncpy(argv0copy, argv0, MAXPATHLEN); - q = wcsrchr(argv0copy, SEP); + /* Must make a copy, path0copy has room for 2 * MAXPATHLEN */ + wchar_t path0copy[2 * MAXPATHLEN + 1]; + wcsncpy(path0copy, path0, MAXPATHLEN); + q = wcsrchr(path0copy, SEP); wcsncpy(q+1, link, MAXPATHLEN); q[MAXPATHLEN + 1] = L'\0'; - argv0 = argv0copy; + path0 = path0copy; } } } #endif /* HAVE_READLINK */ + wchar_t *p = NULL; + #if SEP == '\\' /* Special case for Microsoft filename syntax */ if (have_script_arg) { @@ -636,43 +658,47 @@ _PyPathConfig_ComputeArgv0(int argc, wchar_t **argv) #if defined(MS_WINDOWS) /* Replace the first element in argv with the full path. */ wchar_t *ptemp; - if (GetFullPathNameW(argv0, + if (GetFullPathNameW(path0, Py_ARRAY_LENGTH(fullpath), fullpath, &ptemp)) { - argv0 = fullpath; + path0 = fullpath; } #endif - p = wcsrchr(argv0, SEP); + p = wcsrchr(path0, SEP); /* Test for alternate separator */ - q = wcsrchr(p ? p : argv0, '/'); + q = wcsrchr(p ? p : path0, '/'); if (q != NULL) p = q; if (p != NULL) { - n = p + 1 - argv0; + n = p + 1 - path0; if (n > 1 && p[-1] != ':') n--; /* Drop trailing separator */ } } -#else /* All other filename syntaxes */ +#else + /* All other filename syntaxes */ if (have_script_arg) { #if defined(HAVE_REALPATH) - if (_Py_wrealpath(argv0, fullpath, Py_ARRAY_LENGTH(fullpath))) { - argv0 = fullpath; + if (_Py_wrealpath(path0, fullpath, Py_ARRAY_LENGTH(fullpath))) { + path0 = fullpath; } #endif - p = wcsrchr(argv0, SEP); + p = wcsrchr(path0, SEP); } if (p != NULL) { - n = p + 1 - argv0; + n = p + 1 - path0; #if SEP == '/' /* Special case for Unix filename syntax */ - if (n > 1) - n--; /* Drop trailing separator */ + if (n > 1) { + /* Drop trailing separator */ + n--; + } #endif /* Unix */ } #endif /* All others */ - return PyUnicode_FromWideChar(argv0, n); + *path0_p = PyUnicode_FromWideChar(path0, n); + return 1; } @@ -689,11 +715,12 @@ _Py_FindEnvConfigValue(FILE *env_file, const wchar_t *key, wchar_t *value, size_t value_size) { int result = 0; /* meaning not found */ - char buffer[MAXPATHLEN*2+1]; /* allow extra for key, '=', etc. */ + char buffer[MAXPATHLEN * 2 + 1]; /* allow extra for key, '=', etc. */ + buffer[Py_ARRAY_LENGTH(buffer)-1] = '\0'; fseek(env_file, 0, SEEK_SET); while (!feof(env_file)) { - char * p = fgets(buffer, MAXPATHLEN*2, env_file); + char * p = fgets(buffer, Py_ARRAY_LENGTH(buffer) - 1, env_file); if (p == NULL) { break; @@ -709,7 +736,7 @@ _Py_FindEnvConfigValue(FILE *env_file, const wchar_t *key, continue; } - wchar_t *tmpbuffer = _Py_DecodeUTF8_surrogateescape(buffer, n); + wchar_t *tmpbuffer = _Py_DecodeUTF8_surrogateescape(buffer, n, NULL); if (tmpbuffer) { wchar_t * state; wchar_t * tok = WCSTOK(tmpbuffer, L" \t\r\n", &state); @@ -718,7 +745,8 @@ _Py_FindEnvConfigValue(FILE *env_file, const wchar_t *key, if ((tok != NULL) && !wcscmp(tok, L"=")) { tok = WCSTOK(NULL, L"\r\n", &state); if (tok != NULL) { - wcsncpy(value, tok, MAXPATHLEN); + wcsncpy(value, tok, value_size - 1); + value[value_size - 1] = L'\0'; result = 1; PyMem_RawFree(tmpbuffer); break; diff --git a/Python/preconfig.c b/Python/preconfig.c index 50d66b1249..7ac645d7f0 100644 --- a/Python/preconfig.c +++ b/Python/preconfig.c @@ -63,60 +63,195 @@ _Py_SetFileSystemEncoding(const char *encoding, const char *errors) /* --- _PyArgv ---------------------------------------------------- */ +/* Decode bytes_argv using Py_DecodeLocale() */ _PyInitError -_PyArgv_Decode(const _PyArgv *args, wchar_t*** argv_p) +_PyArgv_AsWstrList(const _PyArgv *args, _PyWstrList *list) { - wchar_t** argv; + _PyWstrList wargv = _PyWstrList_INIT; if (args->use_bytes_argv) { - /* +1 for a the NULL terminator */ - size_t size = sizeof(wchar_t*) * (args->argc + 1); - argv = (wchar_t **)PyMem_RawMalloc(size); - if (argv == NULL) { + size_t size = sizeof(wchar_t*) * args->argc; + wargv.items = (wchar_t **)PyMem_RawMalloc(size); + if (wargv.items == NULL) { return _Py_INIT_NO_MEMORY(); } - for (int i = 0; i < args->argc; i++) { + for (Py_ssize_t i = 0; i < args->argc; i++) { size_t len; wchar_t *arg = Py_DecodeLocale(args->bytes_argv[i], &len); if (arg == NULL) { - _Py_wstrlist_clear(i, argv); + _PyWstrList_Clear(&wargv); return DECODE_LOCALE_ERR("command line arguments", (Py_ssize_t)len); } - argv[i] = arg; + wargv.items[i] = arg; + wargv.length++; } - argv[args->argc] = NULL; + + _PyWstrList_Clear(list); + *list = wargv; } else { - argv = args->wchar_argv; + wargv.length = args->argc; + wargv.items = args->wchar_argv; + if (_PyWstrList_Copy(list, &wargv) < 0) { + return _Py_INIT_NO_MEMORY(); + } } - *argv_p = argv; return _Py_INIT_OK(); } /* --- _PyPreCmdline ------------------------------------------------- */ -typedef struct { - const _PyArgv *args; - int argc; - wchar_t **argv; - int nxoption; /* Number of -X options */ - wchar_t **xoptions; /* -X options */ -} _PyPreCmdline; +void +_PyPreCmdline_Clear(_PyPreCmdline *cmdline) +{ + _PyWstrList_Clear(&cmdline->argv); + _PyWstrList_Clear(&cmdline->xoptions); +} + + +_PyInitError +_PyPreCmdline_SetArgv(_PyPreCmdline *cmdline, const _PyArgv *args) +{ + return _PyArgv_AsWstrList(args, &cmdline->argv); +} static void -precmdline_clear(_PyPreCmdline *cmdline) +_PyPreCmdline_GetPreConfig(_PyPreCmdline *cmdline, const _PyPreConfig *config) +{ +#define COPY_ATTR(ATTR) \ + if (config->ATTR != -1) { \ + cmdline->ATTR = config->ATTR; \ + } + + COPY_ATTR(isolated); + COPY_ATTR(use_environment); + COPY_ATTR(dev_mode); + +#undef COPY_ATTR +} + + +static void +_PyPreCmdline_SetPreConfig(const _PyPreCmdline *cmdline, _PyPreConfig *config) +{ +#define COPY_ATTR(ATTR) \ + config->ATTR = cmdline->ATTR + + COPY_ATTR(isolated); + COPY_ATTR(use_environment); + COPY_ATTR(dev_mode); + +#undef COPY_ATTR +} + + +int +_PyPreCmdline_SetCoreConfig(const _PyPreCmdline *cmdline, _PyCoreConfig *config) { - if (cmdline->args->use_bytes_argv && cmdline->argv != NULL) { - _Py_wstrlist_clear(cmdline->args->argc, cmdline->argv); +#define COPY_ATTR(ATTR) \ + config->ATTR = cmdline->ATTR + + if (_PyWstrList_Extend(&config->xoptions, &cmdline->xoptions) < 0) { + return -1; } - cmdline->argv = NULL; - _Py_wstrlist_clear(cmdline->nxoption, cmdline->xoptions); - cmdline->nxoption = 0; - cmdline->xoptions = NULL; + COPY_ATTR(isolated); + COPY_ATTR(use_environment); + COPY_ATTR(dev_mode); + return 0; + +#undef COPY_ATTR +} + + +/* Parse the command line arguments */ +static _PyInitError +precmdline_parse_cmdline(_PyPreCmdline *cmdline) +{ + _PyWstrList *argv = &cmdline->argv; + + _PyOS_ResetGetOpt(); + /* Don't log parsing errors into stderr here: _PyCoreConfig_Read() + is responsible for that */ + _PyOS_opterr = 0; + do { + int longindex = -1; + int c = _PyOS_GetOpt(argv->length, argv->items, &longindex); + + if (c == EOF || c == 'c' || c == 'm') { + break; + } + + switch (c) { + case 'E': + cmdline->use_environment = 0; + break; + + case 'I': + cmdline->isolated = 1; + break; + + case 'X': + { + if (_PyWstrList_Append(&cmdline->xoptions, _PyOS_optarg) < 0) { + return _Py_INIT_NO_MEMORY(); + } + break; + } + + default: + /* ignore other argument: + handled by _PyCoreConfig_Read() */ + break; + } + } while (1); + + return _Py_INIT_OK(); +} + + +_PyInitError +_PyPreCmdline_Read(_PyPreCmdline *cmdline, + const _PyPreConfig *preconfig) +{ + if (preconfig) { + _PyPreCmdline_GetPreConfig(cmdline, preconfig); + } + + _PyInitError err = precmdline_parse_cmdline(cmdline); + if (_Py_INIT_FAILED(err)) { + return err; + } + + /* isolated, use_environment */ + if (cmdline->isolated < 0) { + cmdline->isolated = 0; + } + if (cmdline->isolated > 0) { + cmdline->use_environment = 0; + } + if (cmdline->use_environment < 0) { + cmdline->use_environment = 0; + } + + /* dev_mode */ + if ((cmdline && _Py_get_xoption(&cmdline->xoptions, L"dev")) + || _Py_GetEnv(cmdline->use_environment, "PYTHONDEVMODE")) + { + cmdline->dev_mode = 1; + } + if (cmdline->dev_mode < 0) { + cmdline->dev_mode = 0; + } + + assert(cmdline->use_environment >= 0); + assert(cmdline->isolated >= 0); + assert(cmdline->dev_mode >= 0); + + return _Py_INIT_OK(); } @@ -148,13 +283,13 @@ _PyPreConfig_Copy(_PyPreConfig *config, const _PyPreConfig *config2) COPY_ATTR(isolated); COPY_ATTR(use_environment); + COPY_ATTR(dev_mode); COPY_ATTR(coerce_c_locale); COPY_ATTR(coerce_c_locale_warn); #ifdef MS_WINDOWS COPY_ATTR(legacy_windows_fs_encoding); #endif COPY_ATTR(utf8_mode); - COPY_ATTR(dev_mode); COPY_STR_ATTR(allocator); #undef COPY_ATTR @@ -163,41 +298,114 @@ _PyPreConfig_Copy(_PyPreConfig *config, const _PyPreConfig *config2) } +PyObject* +_PyPreConfig_AsDict(const _PyPreConfig *config) +{ + PyObject *dict; + + dict = PyDict_New(); + if (dict == NULL) { + return NULL; + } + +#define SET_ITEM(KEY, EXPR) \ + do { \ + PyObject *obj = (EXPR); \ + if (obj == NULL) { \ + goto fail; \ + } \ + int res = PyDict_SetItemString(dict, (KEY), obj); \ + Py_DECREF(obj); \ + if (res < 0) { \ + goto fail; \ + } \ + } while (0) +#define SET_ITEM_INT(ATTR) \ + SET_ITEM(#ATTR, PyLong_FromLong(config->ATTR)) +#define FROM_STRING(STR) \ + ((STR != NULL) ? \ + PyUnicode_FromString(STR) \ + : (Py_INCREF(Py_None), Py_None)) +#define SET_ITEM_STR(ATTR) \ + SET_ITEM(#ATTR, FROM_STRING(config->ATTR)) + + SET_ITEM_INT(isolated); + SET_ITEM_INT(use_environment); + SET_ITEM_INT(coerce_c_locale); + SET_ITEM_INT(coerce_c_locale_warn); + SET_ITEM_INT(utf8_mode); +#ifdef MS_WINDOWS + SET_ITEM_INT(legacy_windows_fs_encoding); +#endif + SET_ITEM_INT(dev_mode); + SET_ITEM_STR(allocator); + return dict; + +fail: + Py_DECREF(dict); + return NULL; + +#undef FROM_STRING +#undef SET_ITEM +#undef SET_ITEM_INT +#undef SET_ITEM_STR +} + + void +_PyCoreConfig_GetCoreConfig(_PyPreConfig *config, + const _PyCoreConfig *core_config) +{ +#define COPY_ATTR(ATTR) \ + if (core_config->ATTR != -1) { \ + config->ATTR = core_config->ATTR; \ + } + + COPY_ATTR(isolated); + COPY_ATTR(use_environment); + COPY_ATTR(dev_mode); + +#undef COPY_ATTR +} + + +static void _PyPreConfig_GetGlobalConfig(_PyPreConfig *config) { #define COPY_FLAG(ATTR, VALUE) \ - if (config->ATTR == -1) { \ - config->ATTR = VALUE; \ - } + if (config->ATTR == -1) { \ + config->ATTR = VALUE; \ + } #define COPY_NOT_FLAG(ATTR, VALUE) \ - if (config->ATTR == -1) { \ - config->ATTR = !(VALUE); \ - } + if (config->ATTR == -1) { \ + config->ATTR = !(VALUE); \ + } COPY_FLAG(isolated, Py_IsolatedFlag); COPY_NOT_FLAG(use_environment, Py_IgnoreEnvironmentFlag); #ifdef MS_WINDOWS COPY_FLAG(legacy_windows_fs_encoding, Py_LegacyWindowsFSEncodingFlag); #endif - COPY_FLAG(utf8_mode, Py_UTF8Mode); + if (Py_UTF8Mode > 0) { + config->utf8_mode = 1; + } #undef COPY_FLAG #undef COPY_NOT_FLAG } -void +static void _PyPreConfig_SetGlobalConfig(const _PyPreConfig *config) { #define COPY_FLAG(ATTR, VAR) \ - if (config->ATTR != -1) { \ - VAR = config->ATTR; \ - } + if (config->ATTR != -1) { \ + VAR = config->ATTR; \ + } #define COPY_NOT_FLAG(ATTR, VAR) \ - if (config->ATTR != -1) { \ - VAR = !config->ATTR; \ - } + if (config->ATTR != -1) { \ + VAR = !config->ATTR; \ + } COPY_FLAG(isolated, Py_IsolatedFlag); COPY_NOT_FLAG(use_environment, Py_IgnoreEnvironmentFlag); @@ -212,11 +420,11 @@ _PyPreConfig_SetGlobalConfig(const _PyPreConfig *config) const char* -_PyPreConfig_GetEnv(const _PyPreConfig *config, const char *name) +_Py_GetEnv(int use_environment, const char *name) { - assert(config->use_environment >= 0); + assert(use_environment >= 0); - if (!config->use_environment) { + if (!use_environment) { return NULL; } @@ -249,9 +457,9 @@ _Py_str_to_int(const char *str, int *result) void -_Py_get_env_flag(_PyPreConfig *config, int *flag, const char *name) +_Py_get_env_flag(int use_environment, int *flag, const char *name) { - const char *var = _PyPreConfig_GetEnv(config, name); + const char *var = _Py_GetEnv(use_environment, name); if (!var) { return; } @@ -267,10 +475,10 @@ _Py_get_env_flag(_PyPreConfig *config, int *flag, const char *name) const wchar_t* -_Py_get_xoption(int nxoption, wchar_t * const *xoptions, const wchar_t *name) +_Py_get_xoption(const _PyWstrList *xoptions, const wchar_t *name) { - for (int i=0; i < nxoption; i++) { - const wchar_t *option = xoptions[i]; + for (Py_ssize_t i=0; i < xoptions->length; i++) { + const wchar_t *option = xoptions->items[i]; size_t len; wchar_t *sep = wcschr(option, L'='); if (sep != NULL) { @@ -290,9 +498,19 @@ _Py_get_xoption(int nxoption, wchar_t * const *xoptions, const wchar_t *name) static _PyInitError preconfig_init_utf8_mode(_PyPreConfig *config, const _PyPreCmdline *cmdline) { +#ifdef MS_WINDOWS + if (config->legacy_windows_fs_encoding) { + config->utf8_mode = 0; + } +#endif + + if (config->utf8_mode >= 0) { + return _Py_INIT_OK(); + } + const wchar_t *xopt; if (cmdline) { - xopt = _Py_get_xoption(cmdline->nxoption, cmdline->xoptions, L"utf8"); + xopt = _Py_get_xoption(&cmdline->xoptions, L"utf8"); } else { xopt = NULL; @@ -317,7 +535,7 @@ preconfig_init_utf8_mode(_PyPreConfig *config, const _PyPreCmdline *cmdline) return _Py_INIT_OK(); } - const char *opt = _PyPreConfig_GetEnv(config, "PYTHONUTF8"); + const char *opt = _Py_GetEnv(config->use_environment, "PYTHONUTF8"); if (opt) { if (strcmp(opt, "1") == 0) { config->utf8_mode = 1; @@ -332,84 +550,6 @@ preconfig_init_utf8_mode(_PyPreConfig *config, const _PyPreCmdline *cmdline) return _Py_INIT_OK(); } - return _Py_INIT_OK(); -} - - -static void -preconfig_init_locale(_PyPreConfig *config) -{ - /* Test also if coerce_c_locale equals 1: PYTHONCOERCECLOCALE=1 doesn't - imply that the C locale is always coerced. It is only coerced if - if the LC_CTYPE locale is "C". */ - if (config->coerce_c_locale != 0) { - /* The C locale enables the C locale coercion (PEP 538) */ - if (_Py_LegacyLocaleDetected()) { - config->coerce_c_locale = 1; - } - else { - config->coerce_c_locale = 0; - } - } -} - - -static _PyInitError -preconfig_read(_PyPreConfig *config, const _PyPreCmdline *cmdline) -{ - _PyPreConfig_GetGlobalConfig(config); - - /* isolated and use_environment */ - if (config->isolated > 0) { - config->use_environment = 0; - } - - /* Default values */ - if (config->use_environment < 0) { - config->use_environment = 0; - } - - /* legacy_windows_fs_encoding, utf8_mode, coerce_c_locale */ - if (config->use_environment) { -#ifdef MS_WINDOWS - _Py_get_env_flag(config, &config->legacy_windows_fs_encoding, - "PYTHONLEGACYWINDOWSFSENCODING"); -#endif - - const char *env = _PyPreConfig_GetEnv(config, "PYTHONCOERCECLOCALE"); - if (env) { - if (strcmp(env, "0") == 0) { - if (config->coerce_c_locale < 0) { - config->coerce_c_locale = 0; - } - } - else if (strcmp(env, "warn") == 0) { - config->coerce_c_locale_warn = 1; - } - else { - if (config->coerce_c_locale < 0) { - config->coerce_c_locale = 1; - } - } - } - } - -#ifdef MS_WINDOWS - if (config->legacy_windows_fs_encoding) { - config->utf8_mode = 0; - } -#endif - - if (config->utf8_mode < 0) { - _PyInitError err = preconfig_init_utf8_mode(config, cmdline); - if (_Py_INIT_FAILED(err)) { - return err; - } - } - - if (config->coerce_c_locale != 0) { - preconfig_init_locale(config); - } #ifndef MS_WINDOWS if (config->utf8_mode < 0) { @@ -424,33 +564,61 @@ preconfig_read(_PyPreConfig *config, const _PyPreCmdline *cmdline) } #endif - if (config->coerce_c_locale < 0) { - config->coerce_c_locale = 0; - } if (config->utf8_mode < 0) { config->utf8_mode = 0; } - if (config->coerce_c_locale < 0) { - config->coerce_c_locale = 0; + return _Py_INIT_OK(); +} + + +static void +preconfig_init_coerce_c_locale(_PyPreConfig *config) +{ + const char *env = _Py_GetEnv(config->use_environment, "PYTHONCOERCECLOCALE"); + if (env) { + if (strcmp(env, "0") == 0) { + if (config->coerce_c_locale < 0) { + config->coerce_c_locale = 0; + } + } + else if (strcmp(env, "warn") == 0) { + config->coerce_c_locale_warn = 1; + } + else { + if (config->coerce_c_locale < 0) { + config->coerce_c_locale = 1; + } + } } - /* dev_mode */ - if ((cmdline && _Py_get_xoption(cmdline->nxoption, cmdline->xoptions, L"dev")) - || _PyPreConfig_GetEnv(config, "PYTHONDEVMODE")) - { - config->dev_mode = 1; + /* Test if coerce_c_locale equals to -1 or equals to 1: + PYTHONCOERCECLOCALE=1 doesn't imply that the C locale is always coerced. + It is only coerced if if the LC_CTYPE locale is "C". */ + if (config->coerce_c_locale == 0 || config->coerce_c_locale == 2) { + return; } - if (config->dev_mode < 0) { - config->dev_mode = 0; + + /* The C locale enables the C locale coercion (PEP 538) */ + if (_Py_LegacyLocaleDetected()) { + config->coerce_c_locale = 2; + } + else { + config->coerce_c_locale = 0; } - /* allocator */ + assert(config->coerce_c_locale >= 0); +} + + +static _PyInitError +preconfig_init_allocator(_PyPreConfig *config) +{ if (config->allocator == NULL) { /* bpo-34247. The PYTHONMALLOC environment variable has the priority over PYTHONDEV env var and "-X dev" command line option. For example, PYTHONMALLOC=malloc PYTHONDEVMODE=1 sets the memory allocators to "malloc" (and not to "debug"). */ - const char *allocator = _PyPreConfig_GetEnv(config, "PYTHONMALLOC"); + const char *allocator = _Py_GetEnv(config->use_environment, "PYTHONMALLOC"); if (allocator) { config->allocator = _PyMem_RawStrdup(allocator); if (config->allocator == NULL) { @@ -465,186 +633,52 @@ preconfig_read(_PyPreConfig *config, const _PyPreCmdline *cmdline) return _Py_INIT_NO_MEMORY(); } } - - assert(config->coerce_c_locale >= 0); - assert(config->utf8_mode >= 0); - assert(config->isolated >= 0); - assert(config->use_environment >= 0); - assert(config->dev_mode >= 0); - return _Py_INIT_OK(); } static _PyInitError -get_ctype_locale(char **locale_p) -{ - const char *loc = setlocale(LC_CTYPE, NULL); - if (loc == NULL) { - return _Py_INIT_ERR("failed to LC_CTYPE locale"); - } - - char *copy = _PyMem_RawStrdup(loc); - if (copy == NULL) { - return _Py_INIT_NO_MEMORY(); - } - - *locale_p = copy; - return _Py_INIT_OK(); -} - - -/* Read the configuration from: - - - environment variables - - Py_xxx global configuration variables - - the LC_CTYPE locale - - See _PyPreConfig_ReadFromArgv() to parse also command line arguments. */ -_PyInitError -_PyPreConfig_Read(_PyPreConfig *config) +preconfig_read(_PyPreConfig *config, _PyPreCmdline *cmdline) { _PyInitError err; - char *old_loc; - err = get_ctype_locale(&old_loc); + err = _PyPreCmdline_Read(cmdline, config); if (_Py_INIT_FAILED(err)) { return err; } - /* Set LC_CTYPE to the user preferred locale */ - _Py_SetLocaleFromEnv(LC_CTYPE); - - err = preconfig_read(config, NULL); + _PyPreCmdline_SetPreConfig(cmdline, config); - setlocale(LC_CTYPE, old_loc); - - return err; -} - - -int -_PyPreConfig_AsDict(const _PyPreConfig *config, PyObject *dict) -{ -#define SET_ITEM(KEY, EXPR) \ - do { \ - PyObject *obj = (EXPR); \ - if (obj == NULL) { \ - goto fail; \ - } \ - int res = PyDict_SetItemString(dict, (KEY), obj); \ - Py_DECREF(obj); \ - if (res < 0) { \ - goto fail; \ - } \ - } while (0) -#define SET_ITEM_INT(ATTR) \ - SET_ITEM(#ATTR, PyLong_FromLong(config->ATTR)) -#define FROM_STRING(STR) \ - ((STR != NULL) ? \ - PyUnicode_FromString(STR) \ - : (Py_INCREF(Py_None), Py_None)) -#define SET_ITEM_STR(ATTR) \ - SET_ITEM(#ATTR, FROM_STRING(config->ATTR)) - - SET_ITEM_INT(isolated); - SET_ITEM_INT(use_environment); - SET_ITEM_INT(coerce_c_locale); - SET_ITEM_INT(coerce_c_locale_warn); - SET_ITEM_INT(utf8_mode); + /* legacy_windows_fs_encoding, coerce_c_locale, utf8_mode */ #ifdef MS_WINDOWS - SET_ITEM_INT(legacy_windows_fs_encoding); + _Py_get_env_flag(config->use_environment, + &config->legacy_windows_fs_encoding, + "PYTHONLEGACYWINDOWSFSENCODING"); #endif - SET_ITEM_INT(dev_mode); - SET_ITEM_STR(allocator); - return 0; - -fail: - return -1; - -#undef FROM_STRING -#undef SET_ITEM -#undef SET_ITEM_INT -#undef SET_ITEM_STR -} - - -/* Parse the command line arguments */ -static _PyInitError -preconfig_parse_cmdline(_PyPreConfig *config, _PyPreCmdline *cmdline) -{ - _PyOS_ResetGetOpt(); - /* Don't log parsing errors into stderr here: _PyCoreConfig_ReadFromArgv() - is responsible for that */ - _PyOS_opterr = 0; - do { - int longindex = -1; - int c = _PyOS_GetOpt(cmdline->args->argc, cmdline->argv, &longindex); - - if (c == EOF || c == 'c' || c == 'm') { - break; - } - - switch (c) { - case 'E': - config->use_environment = 0; - break; - - case 'I': - config->isolated++; - break; - - case 'X': - { - _PyInitError err; - err = _Py_wstrlist_append(&cmdline->nxoption, - &cmdline->xoptions, - _PyOS_optarg); - if (_Py_INIT_FAILED(err)) { - return err; - } - break; - } - - default: - /* ignore other argument: - handled by _PyCoreConfig_ReadFromArgv() */ - break; - } - } while (1); - - return _Py_INIT_OK(); -} - - -static _PyInitError -preconfig_from_argv(_PyPreConfig *config, const _PyArgv *args) -{ - _PyInitError err; - _PyPreCmdline cmdline; - memset(&cmdline, 0, sizeof(cmdline)); - cmdline.args = args; + preconfig_init_coerce_c_locale(config); - err = _PyArgv_Decode(cmdline.args, &cmdline.argv); + err = preconfig_init_utf8_mode(config, cmdline); if (_Py_INIT_FAILED(err)) { - goto done; + return err; } - err = preconfig_parse_cmdline(config, &cmdline); + /* allocator */ + err = preconfig_init_allocator(config); if (_Py_INIT_FAILED(err)) { - goto done; + return err; } - err = preconfig_read(config, &cmdline); - if (_Py_INIT_FAILED(err)) { - goto done; - } - err = _Py_INIT_OK(); + assert(config->coerce_c_locale >= 0); +#ifdef MS_WINDOWS + assert(config->legacy_windows_fs_encoding >= 0); +#endif + assert(config->utf8_mode >= 0); + assert(config->isolated >= 0); + assert(config->use_environment >= 0); + assert(config->dev_mode >= 0); -done: - precmdline_clear(&cmdline); - return err; + return _Py_INIT_OK(); } @@ -653,11 +687,9 @@ done: - command line arguments - environment variables - Py_xxx global configuration variables - - the LC_CTYPE locale - - See _PyPreConfig_ReadFromArgv() to parse also command line arguments. */ + - the LC_CTYPE locale */ _PyInitError -_PyPreConfig_ReadFromArgv(_PyPreConfig *config, const _PyArgv *args) +_PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args) { _PyInitError err; @@ -666,28 +698,42 @@ _PyPreConfig_ReadFromArgv(_PyPreConfig *config, const _PyArgv *args) return err; } - char *init_ctype_locale = NULL; - int init_utf8_mode = Py_UTF8Mode; -#ifdef MS_WINDOWS - int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag; -#endif - _PyPreConfig save_config = _PyPreConfig_INIT; - int locale_coerced = 0; - int loops = 0; + _PyPreConfig_GetGlobalConfig(config); - err = get_ctype_locale(&init_ctype_locale); - if (_Py_INIT_FAILED(err)) { - goto done; + /* Copy LC_CTYPE locale, since it's modified later */ + const char *loc = setlocale(LC_CTYPE, NULL); + if (loc == NULL) { + return _Py_INIT_ERR("failed to LC_CTYPE locale"); + } + char *init_ctype_locale = _PyMem_RawStrdup(loc); + if (init_ctype_locale == NULL) { + return _Py_INIT_NO_MEMORY(); } + /* Save the config to be able to restore it if encodings change */ + _PyPreConfig save_config = _PyPreConfig_INIT; if (_PyPreConfig_Copy(&save_config, config) < 0) { - err = _Py_INIT_NO_MEMORY(); - goto done; + return _Py_INIT_NO_MEMORY(); } /* Set LC_CTYPE to the user preferred locale */ _Py_SetLocaleFromEnv(LC_CTYPE); + _PyPreCmdline cmdline = _PyPreCmdline_INIT; + if (args) { + err = _PyPreCmdline_SetArgv(&cmdline, args); + if (_Py_INIT_FAILED(err)) { + goto done; + } + } + + int init_utf8_mode = Py_UTF8Mode; +#ifdef MS_WINDOWS + int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag; +#endif + int locale_coerced = 0; + int loops = 0; + while (1) { int utf8_mode = config->utf8_mode; @@ -706,15 +752,11 @@ _PyPreConfig_ReadFromArgv(_PyPreConfig *config, const _PyArgv *args) Py_LegacyWindowsFSEncodingFlag = config->legacy_windows_fs_encoding; #endif - err = preconfig_from_argv(config, args); + err = preconfig_read(config, &cmdline); if (_Py_INIT_FAILED(err)) { goto done; } - if (locale_coerced) { - config->coerce_c_locale = 1; - } - /* The legacy C locale assumes ASCII as the default text encoding, which * causes problems not only for the CPython runtime, but also other * components like GNU readline. @@ -767,12 +809,14 @@ _PyPreConfig_ReadFromArgv(_PyPreConfig *config, const _PyArgv *args) done: if (init_ctype_locale != NULL) { setlocale(LC_CTYPE, init_ctype_locale); + PyMem_RawFree(init_ctype_locale); } _PyPreConfig_Clear(&save_config); Py_UTF8Mode = init_utf8_mode ; #ifdef MS_WINDOWS Py_LegacyWindowsFSEncodingFlag = init_legacy_encoding; #endif + _PyPreCmdline_Clear(&cmdline); return err; } @@ -848,5 +892,14 @@ _PyPreConfig_Write(_PyPreConfig *config) /* Set LC_CTYPE to the user preferred locale */ _Py_SetLocaleFromEnv(LC_CTYPE); + /* Write the new pre-configuration into _PyRuntime */ + PyMemAllocatorEx old_alloc; + _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + int res = _PyPreConfig_Copy(&_PyRuntime.preconfig, config); + PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + if (res < 0) { + return _Py_INIT_NO_MEMORY(); + } + return _Py_INIT_OK(); } diff --git a/Python/pyarena.c b/Python/pyarena.c index abb5729c8a..aefb787e55 100644 --- a/Python/pyarena.c +++ b/Python/pyarena.c @@ -160,7 +160,7 @@ PyArena_Free(PyArena *arena) #if defined(Py_DEBUG) /* fprintf(stderr, - "alloc=%d size=%d blocks=%d block_size=%d big=%d objects=%d\n", + "alloc=%zu size=%zu blocks=%zu block_size=%zu big=%zu objects=%zu\n", arena->total_allocs, arena->total_size, arena->total_blocks, arena->total_block_size, arena->total_big_blocks, PyList_Size(arena->a_objects)); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 08107296be..ad1447256c 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -69,6 +69,7 @@ static void call_ll_exitfuncs(void); int _Py_UnhandledKeyboardInterrupt = 0; _PyRuntimeState _PyRuntime = _PyRuntimeState_INIT; +static int runtime_initialized = 0; _PyInitError _PyRuntime_Initialize(void) @@ -79,11 +80,10 @@ _PyRuntime_Initialize(void) every Py_Initialize() call, but doing so breaks the runtime. This is because the runtime state is not properly finalized currently. */ - static int initialized = 0; - if (initialized) { + if (runtime_initialized) { return _Py_INIT_OK(); } - initialized = 1; + runtime_initialized = 1; return _PyRuntimeState_Init(&_PyRuntime); } @@ -92,6 +92,7 @@ void _PyRuntime_Finalize(void) { _PyRuntimeState_Fini(&_PyRuntime); + runtime_initialized = 0; } int @@ -285,9 +286,10 @@ static const char *_C_LOCALE_WARNING = "locales is recommended.\n"; static void -_emit_stderr_warning_for_legacy_locale(const _PyCoreConfig *core_config) +_emit_stderr_warning_for_legacy_locale(void) { - if (core_config->preconfig.coerce_c_locale_warn && _Py_LegacyLocaleDetected()) { + const _PyPreConfig *preconfig = &_PyRuntime.preconfig; + if (preconfig->coerce_c_locale_warn && _Py_LegacyLocaleDetected()) { PySys_FormatStderr("%s", _C_LOCALE_WARNING); } } @@ -456,7 +458,7 @@ _Py_SetLocaleFromEnv(int category) /* Global initializations. Can be undone by Py_Finalize(). Don't call this twice without an intervening Py_Finalize() call. - Every call to _Py_InitializeCore, Py_Initialize or Py_InitializeEx + Every call to _Py_InitializeFromConfig, Py_Initialize or Py_InitializeEx must have a corresponding call to Py_Finalize. Locking: you must hold the interpreter lock while calling these APIs. @@ -480,10 +482,10 @@ _Py_Initialize_ReconfigureCore(PyInterpreterState **interp_p, } *interp_p = interp; - _PyCoreConfig_SetGlobalConfig(core_config); + _PyCoreConfig_Write(core_config); if (_PyCoreConfig_Copy(&interp->core_config, core_config) < 0) { - return _Py_INIT_ERR("failed to copy core config"); + return _Py_INIT_NO_MEMORY(); } core_config = &interp->core_config; @@ -504,7 +506,7 @@ pycore_init_runtime(const _PyCoreConfig *core_config) return _Py_INIT_ERR("main interpreter already initialized"); } - _PyCoreConfig_SetGlobalConfig(core_config); + _PyCoreConfig_Write(core_config); _PyInitError err = _PyRuntime_Initialize(); if (_Py_INIT_FAILED(err)) { @@ -546,7 +548,7 @@ pycore_create_interpreter(const _PyCoreConfig *core_config, *interp_p = interp; if (_PyCoreConfig_Copy(&interp->core_config, core_config) < 0) { - return _Py_INIT_ERR("failed to copy core config"); + return _Py_INIT_NO_MEMORY(); } core_config = &interp->core_config; @@ -674,6 +676,8 @@ _Py_InitializeCore_impl(PyInterpreterState **interp_p, { PyInterpreterState *interp; + _PyCoreConfig_Write(core_config); + _PyInitError err = pycore_init_runtime(core_config); if (_Py_INIT_FAILED(err)) { return err; @@ -714,30 +718,95 @@ _Py_InitializeCore_impl(PyInterpreterState **interp_p, static _PyInitError -pyinit_preconfig(_PyPreConfig *preconfig, const _PyPreConfig *src_preconfig) +preinit(const _PyPreConfig *src_config, const _PyArgv *args) { - if (_PyPreConfig_Copy(preconfig, src_preconfig) < 0) { - return _Py_INIT_ERR("failed to copy pre config"); - } + _PyInitError err; - _PyInitError err = _PyPreConfig_Read(preconfig); + err = _PyRuntime_Initialize(); if (_Py_INIT_FAILED(err)) { return err; } - return _PyPreConfig_Write(preconfig); + if (_PyRuntime.pre_initialized) { + /* If it's already configured: ignored the new configuration */ + return _Py_INIT_OK(); + } + + _PyPreConfig config = _PyPreConfig_INIT; + + if (src_config) { + if (_PyPreConfig_Copy(&config, src_config) < 0) { + err = _Py_INIT_NO_MEMORY(); + goto done; + } + } + + err = _PyPreConfig_Read(&config, args); + if (_Py_INIT_FAILED(err)) { + goto done; + } + + err = _PyPreConfig_Write(&config); + if (_Py_INIT_FAILED(err)) { + goto done; + } + + _PyRuntime.pre_initialized = 1; + err = _Py_INIT_OK(); + +done: + _PyPreConfig_Clear(&config); + return err; +} + +_PyInitError +_Py_PreInitializeFromArgs(const _PyPreConfig *src_config, int argc, char **argv) +{ + _PyArgv args = {.use_bytes_argv = 1, .argc = argc, .bytes_argv = argv}; + return preinit(src_config, &args); +} + + +_PyInitError +_Py_PreInitializeFromWideArgs(const _PyPreConfig *src_config, int argc, wchar_t **argv) +{ + _PyArgv args = {.use_bytes_argv = 0, .argc = argc, .wchar_argv = argv}; + return preinit(src_config, &args); +} + + +_PyInitError +_Py_PreInitialize(const _PyPreConfig *src_config) +{ + return preinit(src_config, NULL); +} + + +_PyInitError +_Py_PreInitializeFromCoreConfig(const _PyCoreConfig *coreconfig) +{ + assert(coreconfig != NULL); + _PyPreConfig config = _PyPreConfig_INIT; + _PyCoreConfig_GetCoreConfig(&config, coreconfig); + return _Py_PreInitialize(&config); + /* No need to clear config: + _PyCoreConfig_GetCoreConfig() doesn't allocate memory */ } static _PyInitError -pyinit_coreconfig(_PyCoreConfig *config, const _PyCoreConfig *src_config, +pyinit_coreconfig(_PyCoreConfig *config, + const _PyCoreConfig *src_config, + const _PyArgv *args, PyInterpreterState **interp_p) { - if (_PyCoreConfig_Copy(config, src_config) < 0) { - return _Py_INIT_ERR("failed to copy core config"); + if (src_config) { + if (_PyCoreConfig_Copy(config, src_config) < 0) { + return _Py_INIT_NO_MEMORY(); + } } - _PyInitError err = _PyCoreConfig_Read(config, NULL); + _PyInitError err = _PyCoreConfig_Read(config, args); if (_Py_INIT_FAILED(err)) { return err; } @@ -768,40 +837,47 @@ pyinit_coreconfig(_PyCoreConfig *config, const _PyCoreConfig *src_config, * to the Python C API (unless the API is explicitly listed as being * safe to call without calling Py_Initialize first) */ -_PyInitError -_Py_InitializeCore(PyInterpreterState **interp_p, - const _PyCoreConfig *src_config) +static _PyInitError +_Py_InitializeCore(const _PyCoreConfig *src_config, + const _PyArgv *args, + PyInterpreterState **interp_p) { _PyInitError err; - assert(src_config != NULL); - - _PyCoreConfig local_config = _PyCoreConfig_INIT; - - err = pyinit_preconfig(&local_config.preconfig, &src_config->preconfig); + if (src_config) { + err = _Py_PreInitializeFromCoreConfig(src_config); + } + else { + err = _Py_PreInitialize(NULL); + } if (_Py_INIT_FAILED(err)) { - goto done; + return err; } - err = pyinit_coreconfig(&local_config, src_config, interp_p); - -done: + _PyCoreConfig local_config = _PyCoreConfig_INIT; + err = pyinit_coreconfig(&local_config, src_config, args, interp_p); _PyCoreConfig_Clear(&local_config); return err; } + /* Py_Initialize() has already been called: update the main interpreter configuration. Example of bpo-34008: Py_Main() called after Py_Initialize(). */ static _PyInitError -_Py_ReconfigureMainInterpreter(PyInterpreterState *interp, - const _PyMainInterpreterConfig *config) +_Py_ReconfigureMainInterpreter(PyInterpreterState *interp) { - if (config->argv != NULL) { - int res = PyDict_SetItemString(interp->sysdict, "argv", config->argv); - if (res < 0) { - return _Py_INIT_ERR("fail to set sys.argv"); - } + _PyCoreConfig *core_config = &interp->core_config; + + PyObject *argv = _PyWstrList_AsList(&core_config->argv); + if (argv == NULL) { + return _Py_INIT_NO_MEMORY(); \ + } + + int res = PyDict_SetItemString(interp->sysdict, "argv", argv); + Py_DECREF(argv); + if (res < 0) { + return _Py_INIT_ERR("fail to set sys.argv"); } return _Py_INIT_OK(); } @@ -817,23 +893,18 @@ _Py_ReconfigureMainInterpreter(PyInterpreterState *interp, * Other errors should be reported as normal Python exceptions with a * non-zero return code. */ -_PyInitError -_Py_InitializeMainInterpreter(PyInterpreterState *interp, - const _PyMainInterpreterConfig *config) +static _PyInitError +_Py_InitializeMainInterpreter(PyInterpreterState *interp) { if (!_PyRuntime.core_initialized) { return _Py_INIT_ERR("runtime core not initialized"); } /* Configure the main interpreter */ - if (_PyMainInterpreterConfig_Copy(&interp->config, config) < 0) { - return _Py_INIT_ERR("failed to copy main interpreter config"); - } - config = &interp->config; _PyCoreConfig *core_config = &interp->core_config; if (_PyRuntime.initialized) { - return _Py_ReconfigureMainInterpreter(interp, config); + return _Py_ReconfigureMainInterpreter(interp); } if (!core_config->_install_importlib) { @@ -870,7 +941,7 @@ _Py_InitializeMainInterpreter(PyInterpreterState *interp, return err; } - if (interp->config.install_signal_handlers) { + if (core_config->install_signal_handlers) { err = initsigs(); /* Signal handling stuff, including initintr() */ if (_Py_INIT_FAILED(err)) { return err; @@ -913,7 +984,7 @@ _Py_InitializeMainInterpreter(PyInterpreterState *interp, } #ifndef MS_WINDOWS - _emit_stderr_warning_for_legacy_locale(core_config); + _emit_stderr_warning_for_legacy_locale(); #endif return _Py_INIT_OK(); @@ -921,30 +992,51 @@ _Py_InitializeMainInterpreter(PyInterpreterState *interp, #undef _INIT_DEBUG_PRINT -_PyInitError -_Py_InitializeFromConfig(const _PyCoreConfig *config) +static _PyInitError +init_python(const _PyCoreConfig *config, const _PyArgv *args) { PyInterpreterState *interp = NULL; _PyInitError err; - err = _Py_InitializeCore(&interp, config); + err = _Py_InitializeCore(config, args, &interp); if (_Py_INIT_FAILED(err)) { return err; } config = &interp->core_config; - _PyMainInterpreterConfig main_config = _PyMainInterpreterConfig_INIT; - err = _PyMainInterpreterConfig_Read(&main_config, config); - if (!_Py_INIT_FAILED(err)) { - err = _Py_InitializeMainInterpreter(interp, &main_config); - } - _PyMainInterpreterConfig_Clear(&main_config); - if (_Py_INIT_FAILED(err)) { - return err; + if (config->_init_main) { + err = _Py_InitializeMainInterpreter(interp); + if (_Py_INIT_FAILED(err)) { + return err; + } } + return _Py_INIT_OK(); } +_PyInitError +_Py_InitializeFromArgs(const _PyCoreConfig *config, int argc, char **argv) +{ + _PyArgv args = {.use_bytes_argv = 1, .argc = argc, .bytes_argv = argv}; + return init_python(config, &args); +} + + +_PyInitError +_Py_InitializeFromWideArgs(const _PyCoreConfig *config, int argc, wchar_t **argv) +{ + _PyArgv args = {.use_bytes_argv = 0, .argc = argc, .wchar_argv = argv}; + return init_python(config, &args); +} + + +_PyInitError +_Py_InitializeFromConfig(const _PyCoreConfig *config) +{ + return init_python(config, NULL); +} + + void Py_InitializeEx(int install_sigs) { @@ -953,13 +1045,10 @@ Py_InitializeEx(int install_sigs) return; } - _PyInitError err; _PyCoreConfig config = _PyCoreConfig_INIT; config.install_signal_handlers = install_sigs; - err = _Py_InitializeFromConfig(&config); - _PyCoreConfig_Clear(&config); - + _PyInitError err = _Py_InitializeFromConfig(&config); if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); } @@ -1049,17 +1138,21 @@ Py_FinalizeEx(void) if (!_PyRuntime.initialized) return status; + // Wrap up existing "threading"-module-created, non-daemon threads. wait_for_thread_shutdown(); /* Get current thread state and interpreter pointer */ tstate = _PyThreadState_GET(); interp = tstate->interp; + // Make any remaining pending calls. + _Py_FinishPendingCalls(); + /* The interpreter is still entirely intact at this point, and the * exit funcs may be relying on that. In particular, if some thread * or exit func is still waiting to do an import, the import machinery * expects Py_IsInitialized() to return true. So don't say the - * interpreter is uninitialized until after the exit funcs have run. + * runtime is uninitialized until after the exit funcs have run. * Note that Threading.py uses an exit func to do a join on all the * threads created thru it, so this also protects pending imports in * the threads created via Threading. @@ -1301,24 +1394,18 @@ new_interpreter(PyThreadState **tstate_p) /* Copy the current interpreter config into the new interpreter */ _PyCoreConfig *core_config; - _PyMainInterpreterConfig *config; if (save_tstate != NULL) { core_config = &save_tstate->interp->core_config; - config = &save_tstate->interp->config; } else { /* No current thread state, copy from the main interpreter */ PyInterpreterState *main_interp = PyInterpreterState_Main(); core_config = &main_interp->core_config; - config = &main_interp->config; } if (_PyCoreConfig_Copy(&interp->core_config, core_config) < 0) { - return _Py_INIT_ERR("failed to copy core config"); + return _Py_INIT_NO_MEMORY(); } core_config = &interp->core_config; - if (_PyMainInterpreterConfig_Copy(&interp->config, config) < 0) { - return _Py_INIT_ERR("failed to copy main interpreter config"); - } err = _PyExc_Init(); if (_Py_INIT_FAILED(err)) { @@ -1430,7 +1517,7 @@ handle_error: PyThreadState * Py_NewInterpreter(void) { - PyThreadState *tstate; + PyThreadState *tstate = NULL; _PyInitError err = new_interpreter(&tstate); if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); @@ -1460,7 +1547,9 @@ Py_EndInterpreter(PyThreadState *tstate) Py_FatalError("Py_EndInterpreter: thread is not current"); if (tstate->frame != NULL) Py_FatalError("Py_EndInterpreter: thread still has a frame"); + interp->finalizing = 1; + // Wrap up existing "threading"-module-created, non-daemon threads. wait_for_thread_shutdown(); call_py_exitfuncs(interp); @@ -2100,8 +2189,10 @@ wait_for_thread_shutdown(void) PyObject *result; PyObject *threading = _PyImport_GetModuleId(&PyId_threading); if (threading == NULL) { - /* threading not imported */ - PyErr_Clear(); + if (PyErr_Occurred()) { + PyErr_WriteUnraisable(NULL); + } + /* else: threading not imported */ return; } result = _PyObject_CallMethodId(threading, &PyId__shutdown, NULL); diff --git a/Python/pystate.c b/Python/pystate.c index 49497b7c37..a2464b6cf5 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -41,6 +41,7 @@ _PyRuntimeState_Init_impl(_PyRuntimeState *runtime) _PyGC_Initialize(&runtime->gc); _PyEval_Initialize(&runtime->ceval); + runtime->preconfig = _PyPreConfig_INIT; runtime->gilstate.check_enabled = 1; @@ -60,6 +61,9 @@ _PyRuntimeState_Init_impl(_PyRuntimeState *runtime) return _Py_INIT_ERR("Can't initialize threads for cross-interpreter data registry"); } + // Set it to the ID of the main thread of the main interpreter. + runtime->main_thread = PyThread_get_thread_ident(); + return _Py_INIT_OK(); } @@ -89,9 +93,42 @@ _PyRuntimeState_Fini(_PyRuntimeState *runtime) runtime->interpreters.mutex = NULL; } + if (runtime->xidregistry.mutex != NULL) { + PyThread_free_lock(runtime->xidregistry.mutex); + runtime->xidregistry.mutex = NULL; + } + + _PyPreConfig_Clear(&runtime->preconfig); + PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } +/* This function is called from PyOS_AfterFork_Child to ensure that + * newly created child processes do not share locks with the parent. + */ + +void +_PyRuntimeState_ReInitThreads(void) +{ + // This was initially set in _PyRuntimeState_Init(). + _PyRuntime.main_thread = PyThread_get_thread_ident(); + + _PyRuntime.interpreters.mutex = PyThread_allocate_lock(); + if (_PyRuntime.interpreters.mutex == NULL) { + Py_FatalError("Can't initialize lock for runtime interpreters"); + } + + _PyRuntime.interpreters.main->id_mutex = PyThread_allocate_lock(); + if (_PyRuntime.interpreters.main->id_mutex == NULL) { + Py_FatalError("Can't initialize ID lock for main interpreter"); + } + + _PyRuntime.xidregistry.mutex = PyThread_allocate_lock(); + if (_PyRuntime.xidregistry.mutex == NULL) { + Py_FatalError("Can't initialize lock for cross-interpreter data registry"); + } +} + #define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \ WAIT_LOCK) #define HEAD_UNLOCK() PyThread_release_lock(_PyRuntime.interpreters.mutex) @@ -133,28 +170,11 @@ PyInterpreterState_New(void) return NULL; } + memset(interp, 0, sizeof(*interp)); interp->id_refcount = -1; - interp->id_mutex = NULL; - interp->modules = NULL; - interp->modules_by_index = NULL; - interp->sysdict = NULL; - interp->builtins = NULL; - interp->builtins_copy = NULL; - interp->tstate_head = NULL; interp->check_interval = 100; - interp->num_threads = 0; - interp->pythread_stacksize = 0; - interp->codec_search_path = NULL; - interp->codec_search_cache = NULL; - interp->codec_error_registry = NULL; - interp->codecs_initialized = 0; - interp->fscodec_initialized = 0; interp->core_config = _PyCoreConfig_INIT; - interp->config = _PyMainInterpreterConfig_INIT; - interp->importlib = NULL; - interp->import_func = NULL; interp->eval_frame = _PyEval_EvalFrameDefault; - interp->co_extra_user_count = 0; #ifdef HAVE_DLOPEN #if HAVE_DECL_RTLD_NOW interp->dlopenflags = RTLD_NOW; @@ -162,13 +182,6 @@ PyInterpreterState_New(void) interp->dlopenflags = RTLD_LAZY; #endif #endif -#ifdef HAVE_FORK - interp->before_forkers = NULL; - interp->after_forkers_parent = NULL; - interp->after_forkers_child = NULL; -#endif - interp->pyexitfunc = NULL; - interp->pyexitmodule = NULL; HEAD_LOCK(); if (_PyRuntime.interpreters.next_id < 0) { @@ -207,7 +220,6 @@ PyInterpreterState_Clear(PyInterpreterState *interp) PyThreadState_Clear(p); HEAD_UNLOCK(); _PyCoreConfig_Clear(&interp->core_config); - _PyMainInterpreterConfig_Clear(&interp->config); Py_CLEAR(interp->codec_search_path); Py_CLEAR(interp->codec_search_cache); Py_CLEAR(interp->codec_error_registry); @@ -218,11 +230,15 @@ PyInterpreterState_Clear(PyInterpreterState *interp) Py_CLEAR(interp->builtins_copy); Py_CLEAR(interp->importlib); Py_CLEAR(interp->import_func); + Py_CLEAR(interp->dict); #ifdef HAVE_FORK Py_CLEAR(interp->before_forkers); Py_CLEAR(interp->after_forkers_parent); Py_CLEAR(interp->after_forkers_child); #endif + // XXX Once we have one allocator per interpreter (i.e. + // per-interpreter GC) we must ensure that all of the interpreter's + // objects have been cleaned up at the point. } @@ -334,28 +350,39 @@ PyInterpreterState_GetID(PyInterpreterState *interp) } -PyInterpreterState * -_PyInterpreterState_LookUpID(PY_INT64_T requested_id) +static PyInterpreterState * +interp_look_up_id(PY_INT64_T requested_id) { - if (requested_id < 0) - goto error; - PyInterpreterState *interp = PyInterpreterState_Head(); while (interp != NULL) { PY_INT64_T id = PyInterpreterState_GetID(interp); - if (id < 0) + if (id < 0) { return NULL; - if (requested_id == id) + } + if (requested_id == id) { return interp; + } interp = PyInterpreterState_Next(interp); } - -error: - PyErr_Format(PyExc_RuntimeError, - "unrecognized interpreter ID %lld", requested_id); return NULL; } +PyInterpreterState * +_PyInterpreterState_LookUpID(PY_INT64_T requested_id) +{ + PyInterpreterState *interp = NULL; + if (requested_id >= 0) { + HEAD_LOCK(); + interp = interp_look_up_id(requested_id); + HEAD_UNLOCK(); + } + if (interp == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_RuntimeError, + "unrecognized interpreter ID %lld", requested_id); + } + return interp; +} + int _PyInterpreterState_IDInitref(PyInterpreterState *interp) @@ -398,7 +425,7 @@ _PyInterpreterState_IDDecref(PyInterpreterState *interp) int64_t refcount = interp->id_refcount; PyThread_release_lock(interp->id_mutex); - if (refcount == 0) { + if (refcount == 0 && interp->requires_idref) { // XXX Using the "head" thread isn't strictly correct. PyThreadState *tstate = PyInterpreterState_ThreadHead(interp); // XXX Possible GILState issues? @@ -408,16 +435,45 @@ _PyInterpreterState_IDDecref(PyInterpreterState *interp) } } +int +_PyInterpreterState_RequiresIDRef(PyInterpreterState *interp) +{ + return interp->requires_idref; +} + +void +_PyInterpreterState_RequireIDRef(PyInterpreterState *interp, int required) +{ + interp->requires_idref = required ? 1 : 0; +} + _PyCoreConfig * _PyInterpreterState_GetCoreConfig(PyInterpreterState *interp) { return &interp->core_config; } -_PyMainInterpreterConfig * -_PyInterpreterState_GetMainConfig(PyInterpreterState *interp) +PyObject * +_PyInterpreterState_GetMainModule(PyInterpreterState *interp) { - return &interp->config; + if (interp->modules == NULL) { + PyErr_SetString(PyExc_RuntimeError, "interpreter not initialized"); + return NULL; + } + return PyMapping_GetItemString(interp->modules, "__main__"); +} + +PyObject * +PyInterpreterState_GetDict(PyInterpreterState *interp) +{ + if (interp->dict == NULL) { + interp->dict = PyDict_New(); + if (interp->dict == NULL) { + PyErr_Clear(); + } + } + /* Returning NULL means no per-interpreter dict is available. */ + return interp->dict; } /* Default implementation for _PyThreadState_GetFrame */ @@ -1372,7 +1428,7 @@ _register_xidata(PyTypeObject *cls, crossinterpdatafunc getdata) static void _register_builtins_for_crossinterpreter_data(void); int -_PyCrossInterpreterData_Register_Class(PyTypeObject *cls, +_PyCrossInterpreterData_RegisterClass(PyTypeObject *cls, crossinterpdatafunc getdata) { if (!PyType_Check(cls)) { diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 906877a0a8..199ea82434 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -105,6 +105,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags * if (flags == NULL) { flags = &local_flags; local_flags.cf_flags = 0; + local_flags.cf_feature_version = PY_MINOR_VERSION; } v = _PySys_GetObjectId(&PyId_ps1); if (v == NULL) { @@ -1165,6 +1166,7 @@ Py_SymtableStringObject(const char *str, PyObject *filename, int start) return NULL; flags.cf_flags = 0; + flags.cf_feature_version = PY_MINOR_VERSION; mod = PyParser_ASTFromStringObject(str, filename, start, &flags, arena); if (mod == NULL) { PyArena_Free(arena); @@ -1198,12 +1200,15 @@ PyParser_ASTFromStringObject(const char *s, PyObject *filename, int start, PyCompilerFlags localflags; perrdetail err; int iflags = PARSER_FLAGS(flags); + if (flags && flags->cf_feature_version < 7) + iflags |= PyPARSE_ASYNC_HACKS; node *n = PyParser_ParseStringObject(s, filename, &_PyParser_Grammar, start, &err, &iflags); if (flags == NULL) { localflags.cf_flags = 0; + localflags.cf_feature_version = PY_MINOR_VERSION; flags = &localflags; } if (n) { @@ -1249,6 +1254,7 @@ PyParser_ASTFromFileObject(FILE *fp, PyObject *filename, const char* enc, start, ps1, ps2, &err, &iflags); if (flags == NULL) { localflags.cf_flags = 0; + localflags.cf_feature_version = PY_MINOR_VERSION; flags = &localflags; } if (n) { diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 99fd460ff5..3de94e8468 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -17,6 +17,7 @@ Data members: #include "Python.h" #include "code.h" #include "frameobject.h" +#include "pycore_coreconfig.h" #include "pycore_pylifecycle.h" #include "pycore_pymem.h" #include "pycore_pathconfig.h" @@ -283,7 +284,9 @@ sys_displayhook(PyObject *module, PyObject *o) builtins = _PyImport_GetModuleId(&PyId_builtins); if (builtins == NULL) { - PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); + if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); + } return NULL; } Py_DECREF(builtins); @@ -2156,6 +2159,7 @@ make_flags(void) { int pos = 0; PyObject *seq; + const _PyPreConfig *preconfig = &_PyRuntime.preconfig; const _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config; seq = PyStructSequence_New(&FlagsType); @@ -2172,16 +2176,16 @@ make_flags(void) SetFlag(!config->write_bytecode); SetFlag(!config->user_site_directory); SetFlag(!config->site_import); - SetFlag(!config->preconfig.use_environment); + SetFlag(!config->use_environment); SetFlag(config->verbose); /* SetFlag(saw_unbuffered_flag); */ /* SetFlag(skipfirstline); */ SetFlag(config->bytes_warning); SetFlag(config->quiet); SetFlag(config->use_hash_seed == 0 || config->hash_seed != 0); - SetFlag(config->preconfig.isolated); - PyStructSequence_SET_ITEM(seq, pos++, PyBool_FromLong(config->preconfig.dev_mode)); - SetFlag(config->preconfig.utf8_mode); + SetFlag(config->isolated); + PyStructSequence_SET_ITEM(seq, pos++, PyBool_FromLong(config->dev_mode)); + SetFlag(preconfig->utf8_mode); #undef SetFlag if (PyErr_Occurred()) { @@ -2527,26 +2531,71 @@ err_occurred: } \ } while (0) + +static int +sys_add_xoption(PyObject *opts, const wchar_t *s) +{ + PyObject *name, *value; + + const wchar_t *name_end = wcschr(s, L'='); + if (!name_end) { + name = PyUnicode_FromWideChar(s, -1); + value = Py_True; + Py_INCREF(value); + } + else { + name = PyUnicode_FromWideChar(s, name_end - s); + value = PyUnicode_FromWideChar(name_end + 1, -1); + } + if (name == NULL || value == NULL) { + goto error; + } + if (PyDict_SetItem(opts, name, value) < 0) { + goto error; + } + Py_DECREF(name); + Py_DECREF(value); + return 0; + +error: + Py_XDECREF(name); + Py_XDECREF(value); + return -1; +} + + +static PyObject* +sys_create_xoptions_dict(const _PyCoreConfig *config) +{ + Py_ssize_t nxoption = config->xoptions.length; + wchar_t * const * xoptions = config->xoptions.items; + PyObject *dict = PyDict_New(); + if (dict == NULL) { + return NULL; + } + + for (Py_ssize_t i=0; i < nxoption; i++) { + const wchar_t *option = xoptions[i]; + if (sys_add_xoption(dict, option) < 0) { + Py_DECREF(dict); + return NULL; + } + } + + return dict; +} + + int _PySys_InitMain(PyInterpreterState *interp) { PyObject *sysdict = interp->sysdict; - const _PyCoreConfig *core_config = &interp->core_config; - const _PyMainInterpreterConfig *config = &interp->config; + const _PyCoreConfig *config = &interp->core_config; int res; - /* _PyMainInterpreterConfig_Read() must set all these variables */ - assert(config->module_search_path != NULL); - assert(config->executable != NULL); - assert(config->prefix != NULL); - assert(config->base_prefix != NULL); - assert(config->exec_prefix != NULL); - assert(config->base_exec_prefix != NULL); - -#define COPY_LIST(KEY, ATTR) \ +#define COPY_LIST(KEY, VALUE) \ do { \ - assert(PyList_Check(ATTR)); \ - PyObject *list = PyList_GetSlice(ATTR, 0, PyList_GET_SIZE(ATTR)); \ + PyObject *list = _PyWstrList_AsList(&(VALUE)); \ if (list == NULL) { \ return -1; \ } \ @@ -2554,36 +2603,42 @@ _PySys_InitMain(PyInterpreterState *interp) Py_DECREF(list); \ } while (0) - COPY_LIST("path", config->module_search_path); +#define SET_SYS_FROM_WSTR(KEY, VALUE) \ + do { \ + PyObject *str = PyUnicode_FromWideChar(VALUE, -1); \ + if (str == NULL) { \ + return -1; \ + } \ + SET_SYS_FROM_STRING_BORROW(KEY, str); \ + Py_DECREF(str); \ + } while (0) - SET_SYS_FROM_STRING_BORROW("executable", config->executable); - SET_SYS_FROM_STRING_BORROW("prefix", config->prefix); - SET_SYS_FROM_STRING_BORROW("base_prefix", config->base_prefix); - SET_SYS_FROM_STRING_BORROW("exec_prefix", config->exec_prefix); - SET_SYS_FROM_STRING_BORROW("base_exec_prefix", config->base_exec_prefix); + COPY_LIST("path", config->module_search_paths); + + SET_SYS_FROM_WSTR("executable", config->executable); + SET_SYS_FROM_WSTR("prefix", config->prefix); + SET_SYS_FROM_WSTR("base_prefix", config->base_prefix); + SET_SYS_FROM_WSTR("exec_prefix", config->exec_prefix); + SET_SYS_FROM_WSTR("base_exec_prefix", config->base_exec_prefix); if (config->pycache_prefix != NULL) { - SET_SYS_FROM_STRING_BORROW("pycache_prefix", config->pycache_prefix); + SET_SYS_FROM_WSTR("pycache_prefix", config->pycache_prefix); } else { PyDict_SetItemString(sysdict, "pycache_prefix", Py_None); } - if (config->argv != NULL) { - SET_SYS_FROM_STRING_BORROW("argv", config->argv); - } - if (config->warnoptions != NULL) { - COPY_LIST("warnoptions", config->warnoptions); - } - if (config->xoptions != NULL) { - PyObject *dict = PyDict_Copy(config->xoptions); - if (dict == NULL) { - return -1; - } - SET_SYS_FROM_STRING_BORROW("_xoptions", dict); - Py_DECREF(dict); + COPY_LIST("argv", config->argv); + COPY_LIST("warnoptions", config->warnoptions); + + PyObject *xoptions = sys_create_xoptions_dict(config); + if (xoptions == NULL) { + return -1; } + SET_SYS_FROM_STRING_BORROW("_xoptions", xoptions); + Py_DECREF(xoptions); #undef COPY_LIST +#undef SET_SYS_FROM_WSTR /* Set flags to their final values */ SET_SYS_FROM_STRING_INT_RESULT("flags", make_flags()); @@ -2599,7 +2654,7 @@ _PySys_InitMain(PyInterpreterState *interp) } SET_SYS_FROM_STRING_INT_RESULT("dont_write_bytecode", - PyBool_FromLong(!core_config->write_bytecode)); + PyBool_FromLong(!config->write_bytecode)); if (get_warnoptions() == NULL) return -1; @@ -2739,35 +2794,35 @@ PySys_SetPath(const wchar_t *path) } static PyObject * -makeargvobject(int argc, wchar_t **argv) +make_sys_argv(int argc, wchar_t * const * argv) { - PyObject *av; - if (argc <= 0 || argv == NULL) { - /* Ensure at least one (empty) argument is seen */ - static wchar_t *empty_argv[1] = {L""}; - argv = empty_argv; - argc = 1; + PyObject *list = PyList_New(argc); + if (list == NULL) { + return NULL; } - av = PyList_New(argc); - if (av != NULL) { - int i; - for (i = 0; i < argc; i++) { - PyObject *v = PyUnicode_FromWideChar(argv[i], -1); - if (v == NULL) { - Py_DECREF(av); - av = NULL; - break; - } - PyList_SET_ITEM(av, i, v); + + for (Py_ssize_t i = 0; i < argc; i++) { + PyObject *v = PyUnicode_FromWideChar(argv[i], -1); + if (v == NULL) { + Py_DECREF(list); + return NULL; } + PyList_SET_ITEM(list, i, v); } - return av; + return list; } void PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) { - PyObject *av = makeargvobject(argc, argv); + if (argc < 1 || argv == NULL) { + /* Ensure at least one (empty) argument is seen */ + wchar_t* empty_argv[1] = {L""}; + argv = empty_argv; + argc = 1; + } + + PyObject *av = make_sys_argv(argc, argv); if (av == NULL) { Py_FatalError("no mem for sys.argv"); } @@ -2780,19 +2835,22 @@ PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) if (updatepath) { /* If argv[0] is not '-c' nor '-m', prepend argv[0] to sys.path. If argv[0] is a symlink, use the real path. */ - PyObject *argv0 = _PyPathConfig_ComputeArgv0(argc, argv); - if (argv0 == NULL) { - Py_FatalError("can't compute path0 from argv"); - } + const _PyWstrList argv_list = {.length = argc, .items = argv}; + PyObject *path0 = NULL; + if (_PyPathConfig_ComputeSysPath0(&argv_list, &path0)) { + if (path0 == NULL) { + Py_FatalError("can't compute path0 from argv"); + } - PyObject *sys_path = _PySys_GetObjectId(&PyId_path); - if (sys_path != NULL) { - if (PyList_Insert(sys_path, 0, argv0) < 0) { - Py_DECREF(argv0); - Py_FatalError("can't prepend path0 to sys.path"); + PyObject *sys_path = _PySys_GetObjectId(&PyId_path); + if (sys_path != NULL) { + if (PyList_Insert(sys_path, 0, path0) < 0) { + Py_DECREF(path0); + Py_FatalError("can't prepend path0 to sys.path"); + } } + Py_DECREF(path0); } - Py_DECREF(argv0); } } |