summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index cc3c774..c0201c3 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -87,9 +87,9 @@ ste_repr(PySTEntryObject *ste)
PyOS_snprintf(buf, sizeof(buf),
"<symtable entry %.100s(%ld), line %d>",
- PyString_AS_STRING(ste->ste_name),
+ PyBytes_AS_STRING(ste->ste_name),
PyInt_AS_LONG(ste->ste_id), ste->ste_lineno);
- return PyString_FromString(buf);
+ return PyBytes_FromString(buf);
}
static void
@@ -180,7 +180,7 @@ static int symtable_implicit_arg(struct symtable *st, int pos);
static identifier top = NULL, lambda = NULL, genexpr = NULL;
#define GET_IDENTIFIER(VAR) \
- ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR)))
+ ((VAR) ? (VAR) : ((VAR) = PyBytes_InternFromString(# VAR)))
#define DUPLICATE_ARGUMENT \
"duplicate argument '%s' in function definition"
@@ -372,7 +372,7 @@ analyze_name(PySTEntryObject *ste, PyObject *dict, PyObject *name, long flags,
if (flags & DEF_PARAM) {
PyErr_Format(PyExc_SyntaxError,
"name '%s' is local and global",
- PyString_AS_STRING(name));
+ PyBytes_AS_STRING(name));
return 0;
}
SET_SCOPE(dict, name, GLOBAL_EXPLICIT);
@@ -487,19 +487,19 @@ check_unoptimized(const PySTEntryObject* ste) {
PyOS_snprintf(buf, sizeof(buf),
"import * is not allowed in function '%.100s' "
"because it is %s",
- PyString_AS_STRING(ste->ste_name), trailer);
+ PyBytes_AS_STRING(ste->ste_name), trailer);
break;
case OPT_BARE_EXEC:
PyOS_snprintf(buf, sizeof(buf),
"unqualified exec is not allowed in function "
"'%.100s' it %s",
- PyString_AS_STRING(ste->ste_name), trailer);
+ PyBytes_AS_STRING(ste->ste_name), trailer);
break;
default:
PyOS_snprintf(buf, sizeof(buf),
"function '%.100s' uses import * and bare exec, "
"which are illegal because it %s",
- PyString_AS_STRING(ste->ste_name), trailer);
+ PyBytes_AS_STRING(ste->ste_name), trailer);
break;
}
@@ -800,7 +800,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag)
if ((flag & DEF_PARAM) && (val & DEF_PARAM)) {
/* Is it better to use 'mangled' or 'name' here? */
PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT,
- PyString_AsString(name));
+ PyBytes_AsString(name));
PyErr_SyntaxLocation(st->st_filename,
st->st_cur->ste_lineno);
goto error;
@@ -914,7 +914,7 @@ symtable_new_tmpname(struct symtable *st)
PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]",
++st->st_cur->ste_tmpname);
- tmp = PyString_InternFromString(tmpname);
+ tmp = PyBytes_InternFromString(tmpname);
if (!tmp)
return 0;
if (!symtable_add_def(st, tmp, DEF_LOCAL))
@@ -1065,7 +1065,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
asdl_seq *seq = s->v.Global.names;
for (i = 0; i < asdl_seq_LEN(seq); i++) {
identifier name = (identifier)asdl_seq_GET(seq, i);
- char *c_name = PyString_AS_STRING(name);
+ char *c_name = PyBytes_AS_STRING(name);
long cur = symtable_lookup(st, name);
if (cur < 0)
return 0;
@@ -1218,7 +1218,7 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
static int
symtable_implicit_arg(struct symtable *st, int pos)
{
- PyObject *id = PyString_FromFormat(".%d", pos);
+ PyObject *id = PyBytes_FromFormat(".%d", pos);
if (id == NULL)
return 0;
if (!symtable_add_def(st, id, DEF_PARAM)) {
@@ -1326,10 +1326,10 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
*/
PyObject *store_name;
PyObject *name = (a->asname == NULL) ? a->name : a->asname;
- const char *base = PyString_AS_STRING(name);
+ const char *base = PyBytes_AS_STRING(name);
char *dot = strchr(base, '.');
if (dot) {
- store_name = PyString_FromStringAndSize(base, dot - base);
+ store_name = PyBytes_FromStringAndSize(base, dot - base);
if (!store_name)
return 0;
}
@@ -1337,7 +1337,7 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
store_name = name;
Py_INCREF(store_name);
}
- if (strcmp(PyString_AS_STRING(name), "*")) {
+ if (strcmp(PyBytes_AS_STRING(name), "*")) {
int r = symtable_add_def(st, store_name, DEF_IMPORT);
Py_DECREF(store_name);
return r;