Skip to content
Commits on Source (3)
Metadata-Version: 1.1
Name: typed-ast
Version: 1.0.4
Version: 1.1.0
Summary: a fork of Python 2 and 3 ast modules with type comment support
Home-page: https://github.com/python/typed_ast
Author: David Fisher
......
......@@ -239,6 +239,7 @@ string_object_to_py_ast(const char *str, PyObject *filename, int start,
PyCompilerFlags *flags)
{
mod_ty mod;
PyObject *result;
PyArena *arena = PyArena_New();
if (arena == NULL)
return NULL;
......@@ -249,7 +250,7 @@ string_object_to_py_ast(const char *str, PyObject *filename, int start,
return NULL;
}
PyObject *result = Ta27AST_mod2obj(mod);
result = Ta27AST_mod2obj(mod);
PyArena_Free(arena);
return result;
}
......
......@@ -1352,6 +1352,10 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
};
char cbuf[80];
char *tp, **cp;
/* used for type comment checks */
const char *prefix, *p, *type_start;
tp = cbuf;
do {
*tp++ = c = tok_nextc(tok);
......@@ -1375,9 +1379,9 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
}
while (c != EOF && c != '\n')
c = tok_nextc(tok);
/* check for type comment */
const char *prefix, *p, *type_start;
p = tok->start;
prefix = type_comment_prefix;
while (*prefix && p < tok->cur) {
......
......@@ -2303,6 +2303,7 @@ ast_for_class_bases(struct compiling *c, const node* n)
static stmt_ty
ast_for_expr_stmt(struct compiling *c, const node *n)
{
int num;
REQ(n, expr_stmt);
/* expr_stmt: testlist (augassign (yield_expr|testlist)
| ('=' (yield_expr|testlist))* [TYPE_COMMENT])
......@@ -2311,7 +2312,7 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
| '<<=' | '>>=' | '**=' | '//='
test: ... here starts the operator precendence dance
*/
int num = NCH(n);
num = NCH(n);
if (num == 1 || (num == 2 && TYPE(CHILD(n, 1)) == TYPE_COMMENT)) {
expr_ty e = ast_for_testlist(c, CHILD(n, 0));
......@@ -3516,12 +3517,13 @@ parsenumber(struct compiling *c, const char *s)
/* Make a copy without the trailing 'L' */
size_t len = end - s + 1;
char *copy = malloc(len);
PyObject *result;
if (copy == NULL)
return PyErr_NoMemory();
memcpy(copy, s, len);
copy[len - 1] = '\0';
old_style_octal = len > 2 && copy[0] == '0' && copy[1] >= '0' && copy[1] <= '9';
PyObject *result = PyLong_FromString(copy, (char **)0, old_style_octal ? 8 : 0);
result = PyLong_FromString(copy, (char **)0, old_style_octal ? 8 : 0);
free(copy);
return result;
}
......
......@@ -249,6 +249,7 @@ string_object_to_py_ast(const char *str, PyObject *filename, int start,
PyCompilerFlags *flags, int feature_version)
{
mod_ty mod;
PyObject *result;
PyArena *arena = PyArena_New();
if (arena == NULL)
return NULL;
......@@ -259,7 +260,7 @@ string_object_to_py_ast(const char *str, PyObject *filename, int start,
return NULL;
}
PyObject *result = Ta3AST_mod2obj(mod);
result = Ta3AST_mod2obj(mod);
PyArena_Free(arena);
return result;
}
......
......@@ -2274,6 +2274,7 @@ ast_for_atom(struct compiling *c, const node *n)
return str;
}
case NUMBER: {
PyObject *pynum;
const char *s = STR(ch);
/* 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 */
......@@ -2282,7 +2283,7 @@ ast_for_atom(struct compiling *c, const node *n)
"Underscores in numeric literals are only supported in Python 3.6 and greater");
return NULL;
}
PyObject *pynum = parsenumber(c, s);
pynum = parsenumber(c, s);
if (!pynum)
return NULL;
......@@ -3040,6 +3041,7 @@ ast_for_testlist(struct compiling *c, const node* n)
static stmt_ty
ast_for_expr_stmt(struct compiling *c, const node *n)
{
int num;
REQ(n, expr_stmt);
/* expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |
('=' (yield_expr|testlist_star_expr))* [TYPE_COMMENT])
......@@ -3049,7 +3051,7 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
| '<<=' | '>>=' | '**=' | '//='
test: ... here starts the operator precedence dance
*/
int num = NCH(n);
num = NCH(n);
if (num == 1 || (num == 2 && TYPE(CHILD(n, 1)) == TYPE_COMMENT)) {
expr_ty e = ast_for_testlist(c, CHILD(n, 0));
......
python3-typed-ast (1.1.0-1) unstable; urgency=medium
* New upstream version.
-- Michael R. Crusoe <michael.crusoe@gmail.com> Sat, 07 Oct 2017 10:06:39 -0700
python3-typed-ast (1.0.4-1) unstable; urgency=medium
* New upstream version
......
......@@ -8,7 +8,7 @@ Build-Depends: debhelper (>= 9),
python3-all,
python3-setuptools,
python3-all-dev
Standards-Version: 4.0.0
Standards-Version: 4.1.1
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/python3-typed-ast.git
Vcs-Git: https://anonscm.debian.org/git/debian-med/python3-typed-ast.git
Homepage: http://www.mypy-lang.org/
......
......@@ -87,7 +87,7 @@ based on the CPython 2.7 and 3.6 parsers.
""".strip()
setup (name = 'typed-ast',
version = '1.0.4',
version = '1.1.0',
description = 'a fork of Python 2 and 3 ast modules with type comment support',
long_description = long_description,
author = 'David Fisher',
......
Metadata-Version: 1.1
Name: typed-ast
Version: 1.0.4
Version: 1.1.0
Summary: a fork of Python 2 and 3 ast modules with type comment support
Home-page: https://github.com/python/typed_ast
Author: David Fisher
......