Lines Matching defs:name
303 PyObject *u_qualname; /* dot-separated qualified name (lazy) */
316 PyObject *u_private; /* for private name mangling */
368 // A list of strings corresponding to name captures. It is used to track:
369 // - Repeated name assignments in the same pattern.
370 // - Different name assignments in alternatives.
371 // - The order of name assignments in alternatives.
373 // If 0, any name captures against our subject will raise.
457 This is independent from how the name is used. */
471 The only time a name with a dot can occur is when
473 package name.
476 mangling of the module name, e.g. __M.X.
484 /* Strip leading underscores from class name */
629 src is a symbol table dictionary. If the scope of a name matches
739 PyObject *name, *base;
787 name = PyUnicode_Concat(base, &_Py_STR(dot));
789 if (name == NULL)
791 PyUnicode_Append(&name, u->u_name);
792 if (name == NULL)
797 name = u->u_name;
799 u->u_qualname = name;
1663 the ASDL name to synthesize the name of the C type and the visit function.
1715 compiler_enter_scope(struct compiler *c, identifier name,
1736 Py_INCREF(name);
1737 u->u_name = name;
2221 handle classes where name is both local and free. The local var is
2226 get_ref_type(struct compiler *c, PyObject *name)
2230 _PyUnicode_EqualToASCIIString(name, "__class__"))
2232 scope = _PyST_GetScope(c->u->u_ste, name);
2235 "_PyST_GetScope(name=%R) failed: "
2238 name,
2247 compiler_lookup_arg(PyObject *dict, PyObject *name)
2250 v = PyDict_GetItemWithError(dict, name);
2269 PyObject *name = PyTuple_GET_ITEM(co->co_localsplusnames, i);
2272 free variable that has the same name as a method,
2273 the name will be considered free *and* local in the
2275 well as by the normal name lookup logic.
2277 int reftype = get_ref_type(c, name);
2283 arg = compiler_lookup_arg(c->u->u_cellvars, name);
2286 arg = compiler_lookup_arg(c->u->u_freevars, name);
2294 "compiler_lookup_arg(name=%R) with reftype=%d failed in %S; "
2296 name,
2536 forbidden_name(struct compiler *c, identifier name, expr_context_ty ctx)
2539 if (ctx == Store && _PyUnicode_EqualToASCIIString(name, "__debug__")) {
2543 if (ctx == Del && _PyUnicode_EqualToASCIIString(name, "__debug__")) {
2595 identifier name;
2609 name = s->v.AsyncFunctionDef.name;
2619 name = s->v.FunctionDef.name;
2649 if (!compiler_enter_scope(c, name, scope_type, (void *)s, firstlineno)) {
2688 return compiler_nameop(c, name, Store);
2707 <name> = __build_class__(<func>, <name>, *<bases>, **<keywords>)
2711 <name> is the class name
2718 if (!compiler_enter_scope(c, s->v.ClassDef.name,
2724 /* use the class name for name mangling */
2725 Py_INCREF(s->v.ClassDef.name);
2726 Py_XSETREF(c->u->u_private, s->v.ClassDef.name);
2792 /* 4. load class name */
2793 ADDOP_LOAD_CONST(c, s->v.ClassDef.name);
2802 /* 7. store into <name> */
2803 if (!compiler_nameop(c, s->v.ClassDef.name, Store))
3524 if (handler->v.ExceptHandler.name) {
3533 compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3538 except type as name:
3542 name = None # in case body contains "del name"
3543 del name
3549 if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, handler->v.ExceptHandler.name))
3555 /* name = None; del name; # Mark as artificial */
3561 compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3562 compiler_nameop(c, handler->v.ExceptHandler.name, Del);
3568 /* name = None; del name; # Mark as artificial */
3572 compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3573 compiler_nameop(c, handler->v.ExceptHandler.name, Del);
3757 if (handler->v.ExceptHandler.name) {
3758 compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3767 except type as name:
3771 name = None # in case body contains "del name"
3772 del name
3777 if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, handler->v.ExceptHandler.name))
3783 /* name = None; del name; # Mark as artificial */
3786 if (handler->v.ExceptHandler.name) {
3788 compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3789 compiler_nameop(c, handler->v.ExceptHandler.name, Del);
3796 /* name = None; del name; # Mark as artificial */
3799 if (handler->v.ExceptHandler.name) {
3801 compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3802 compiler_nameop(c, handler->v.ExceptHandler.name, Del);
3875 compiler_import_as(struct compiler *c, identifier name, identifier asname)
3878 merely needs to bind the result to a name.
3880 If there is a dot in name, we need to split it and emit a
3881 IMPORT_FROM for each name.
3883 Py_ssize_t len = PyUnicode_GET_LENGTH(name);
3884 Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0, len, 1);
3888 /* Consume the base module name to get the first attribute */
3892 dot = PyUnicode_FindChar(name, '.', pos, len, 1);
3895 attr = PyUnicode_Substring(name, pos, (dot != -1) ? dot : len);
3917 /* The Import node stores a module name like a.b.c as a single
3933 ADDOP_NAME(c, IMPORT_NAME, alias->name, names);
3936 r = compiler_import_as(c, alias->name, alias->asname);
3941 identifier tmp = alias->name;
3943 alias->name, '.', 0, PyUnicode_GET_LENGTH(alias->name), 1);
3945 tmp = PyUnicode_Substring(alias->name, 0, dot);
3975 Py_INCREF(alias->name);
3976 PyTuple_SET_ITEM(names, i, alias->name);
3998 if (i == 0 && PyUnicode_READ_CHAR(alias->name, 0) == '*') {
4004 ADDOP_NAME(c, IMPORT_FROM, alias->name, names);
4005 store_name = alias->name;
4248 compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
4257 assert(!_PyUnicode_EqualToASCIIString(name, "None") &&
4258 !_PyUnicode_EqualToASCIIString(name, "True") &&
4259 !_PyUnicode_EqualToASCIIString(name, "False"));
4261 if (forbidden_name(c, name, ctx))
4264 mangled = _Py_Mangle(c->u->u_private, name);
4297 assert(scope || PyUnicode_READ_CHAR(name, 0) == '_');
4823 // location to point to the attribute name.
5450 identifier name, asdl_comprehension_seq *generators, expr_ty elt,
5461 if (!compiler_enter_scope(c, name, COMPILER_SCOPE_COMPREHENSION,
6113 /* If we have a simple name in a module or class, store annotation. */
6294 // of the stack: they will be popped on failure, and any name captures will be
6299 ((N)->kind == MatchAs_kind && !(N)->v.MatchAs.name)
6302 ((N)->kind == MatchStar_kind && !(N)->v.MatchStar.name)
6369 return compiler_error(c, "multiple assignments to name %R in pattern", n);
6392 // Can't assign to the same name twice:
6509 if (p->v.MatchAs.name) {
6510 const char *e = "name capture %R makes remaining patterns unreachable";
6511 return compiler_error(c, e, p->v.MatchAs.name);
6516 return pattern_helper_store_name(c, p->v.MatchAs.name, pc);
6524 RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.MatchAs.name, pc));
6532 RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.MatchStar.name, pc));
6539 // Any errors will point to the pattern rather than the arg name as the
6552 compiler_error(c, "attribute name repeated in class pattern: %U", attr);
6589 PyObject *name = asdl_seq_GET(kwd_attrs, i);
6590 Py_INCREF(name);
6591 PyTuple_SET_ITEM(attr_names, i, name);
6730 // If we have a starred name, bind a dict of remaining items to it (this may
6770 // for checking different name bindings in alternatives, and for correcting
6807 PyObject *name = PyList_GET_ITEM(control, icontrol);
6808 Py_ssize_t istores = PySequence_Index(pc->stores, name);
6879 // Update the list of previous stores with this new name, checking for
6881 PyObject *name = PyList_GET_ITEM(control, i);
6882 int dupe = PySequence_Contains(pc->stores, name);
6887 compiler_error_duplicate_store(c, name);
6890 if (PyList_Append(pc->stores, name)) {
6919 // Find a starred name, if it exists. There may be at most one:
7052 PyObject *name = PyList_GET_ITEM(pc->stores, n);
7053 if (!compiler_nameop(c, name, Store)) {
8030 .name = c->u->u_name,