[med-svn] [Git][med-team/python3-typed-ast][master] 4 commits: New upstream version 1.3.1
Michael R. Crusoe
gitlab at salsa.debian.org
Sat Feb 9 08:54:54 GMT 2019
Michael R. Crusoe pushed to branch master at Debian Med / python3-typed-ast
Commits:
b5562f9d by Michael R. Crusoe at 2019-02-09T07:11:22Z
New upstream version 1.3.1
- - - - -
77a04c1e by Michael R. Crusoe at 2019-02-09T07:11:24Z
Update upstream source from tag 'upstream/1.3.1'
Update to upstream version '1.3.1'
with Debian dir a611da8190c2da48e71565365a512c86dcfd3f6f
- - - - -
3fd55efe by Michael R. Crusoe at 2019-02-09T07:11:24Z
New upstream version
- - - - -
09683de0 by Michael R. Crusoe at 2019-02-09T07:13:02Z
Upload to unstable
- - - - -
6 changed files:
- PKG-INFO
- ast3/Parser/parsetok.c
- ast3/Python/ast.c
- debian/changelog
- typed_ast.egg-info/PKG-INFO
- typed_ast/__init__.py
Changes:
=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: typed-ast
-Version: 1.3.0
+Version: 1.3.1
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
=====================================
ast3/Parser/parsetok.c
=====================================
@@ -302,6 +302,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
}
if (type == TYPE_IGNORE) {
+ PyObject_FREE(str);
if (!growable_int_array_add(&type_ignores, tok->lineno)) {
err_ret->error = E_NOMEM;
break;
=====================================
ast3/Python/ast.c
=====================================
@@ -740,7 +740,14 @@ new_identifier(const char *n, struct compiling *c)
static string
new_type_comment(const char *s, struct compiling *c)
{
- return PyUnicode_DecodeUTF8(s, strlen(s), NULL);
+ PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);
+ if (!res)
+ return NULL;
+ if (PyArena_AddPyObject(c->c_arena, res) < 0) {
+ Py_DECREF(res);
+ return NULL;
+ }
+ return res;
}
#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n), c)
@@ -1444,6 +1451,8 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start,
case TYPE_COMMENT:
/* arg will be equal to the last argument processed */
arg->type_comment = NEW_TYPE_COMMENT(ch);
+ if (!arg->type_comment)
+ goto error;
i += 1;
break;
case DOUBLESTAR:
@@ -1575,7 +1584,7 @@ ast_for_arguments(struct compiling *c, const node *n)
return NULL;
asdl_seq_SET(posargs, k++, arg);
i += 1; /* the name */
- if (TYPE(CHILD(n, i)) == COMMA)
+ if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
i += 1; /* the comma, if present */
break;
case STAR:
@@ -1591,7 +1600,7 @@ ast_for_arguments(struct compiling *c, const node *n)
int res = 0;
i += 2; /* now follows keyword only arguments */
- if (TYPE(CHILD(n, i)) == TYPE_COMMENT) {
+ if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
ast_error(c, CHILD(n, i),
"bare * has associated type comment");
return NULL;
@@ -1608,11 +1617,13 @@ ast_for_arguments(struct compiling *c, const node *n)
return NULL;
i += 2; /* the star and the name */
- if (TYPE(CHILD(n, i)) == COMMA)
+ if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
i += 1; /* the comma, if present */
- if (TYPE(CHILD(n, i)) == TYPE_COMMENT) {
+ if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
vararg->type_comment = NEW_TYPE_COMMENT(CHILD(n, i));
+ if (!vararg->type_comment)
+ return NULL;
i += 1;
}
@@ -1644,6 +1655,8 @@ ast_for_arguments(struct compiling *c, const node *n)
/* arg will be equal to the last argument processed */
arg->type_comment = NEW_TYPE_COMMENT(ch);
+ if (!arg->type_comment)
+ return NULL;
i += 1;
break;
default:
@@ -1783,19 +1796,27 @@ ast_for_funcdef_impl(struct compiling *c, const node *n0,
}
if (TYPE(CHILD(n, name_i + 3)) == TYPE_COMMENT) {
type_comment = NEW_TYPE_COMMENT(CHILD(n, name_i + 3));
+ if (!type_comment)
+ return NULL;
name_i += 1;
}
body = ast_for_suite(c, CHILD(n, name_i + 3));
if (!body)
return NULL;
- if (!type_comment && NCH(CHILD(n, name_i + 3)) > 1) {
- /* If the function doesn't have a type comment on the same line, check
- * if the suite has a type comment in it. */
+ if (NCH(CHILD(n, name_i + 3)) > 1) {
+ /* Check if the suite has a type comment in it. */
tc = CHILD(CHILD(n, name_i + 3), 1);
- if (TYPE(tc) == TYPE_COMMENT)
+ if (TYPE(tc) == TYPE_COMMENT) {
+ if (type_comment != NULL) {
+ ast_error(c, n, "Cannot have two type comments on def");
+ return NULL;
+ }
type_comment = NEW_TYPE_COMMENT(tc);
+ if (!type_comment)
+ return NULL;
+ }
}
if (is_async)
@@ -1811,8 +1832,7 @@ ast_for_async_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_se
{
/* 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,
@@ -1833,8 +1853,7 @@ ast_for_async_stmt(struct compiling *c, const node *n)
{
/* 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:
@@ -1952,8 +1971,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) {
@@ -2038,8 +2056,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 {
@@ -3281,8 +3298,11 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
expression = ast_for_expr(c, value);
if (!expression)
return NULL;
- if (has_type_comment)
+ if (has_type_comment) {
type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));
+ if (!type_comment)
+ return NULL;
+ }
else
type_comment = NULL;
return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset, c->c_arena);
@@ -3970,8 +3990,11 @@ ast_for_for_stmt(struct compiling *c, const node *n0, bool is_async)
if (!suite_seq)
return NULL;
- if (has_type_comment)
+ if (has_type_comment) {
type_comment = NEW_TYPE_COMMENT(CHILD(n, 5));
+ if (!type_comment)
+ return NULL;
+ }
else
type_comment = NULL;
@@ -4162,8 +4185,11 @@ ast_for_with_stmt(struct compiling *c, const node *n0, bool is_async)
if (!body)
return NULL;
- if (has_type_comment)
+ if (has_type_comment) {
type_comment = NEW_TYPE_COMMENT(CHILD(n, NCH(n) - 2));
+ if (!type_comment)
+ return NULL;
+ }
else
type_comment = NULL;
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+python3-typed-ast (1.3.1-1) unstable; urgency=medium
+
+ * New upstream version
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com> Fri, 08 Feb 2019 23:11:28 -0800
+
python3-typed-ast (1.3.0-1) unstable; urgency=medium
* New upstream version
=====================================
typed_ast.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: typed-ast
-Version: 1.3.0
+Version: 1.3.1
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
=====================================
typed_ast/__init__.py
=====================================
@@ -1 +1 @@
-__version__ = "1.3.0"
+__version__ = "1.3.1"
View it on GitLab: https://salsa.debian.org/med-team/python3-typed-ast/compare/1411244742748ebe2ff1ecf1293d5aca5020a2b1...09683de0f575842f067da789e0b2f3b163576ff9
--
View it on GitLab: https://salsa.debian.org/med-team/python3-typed-ast/compare/1411244742748ebe2ff1ecf1293d5aca5020a2b1...09683de0f575842f067da789e0b2f3b163576ff9
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190209/f11bf1d9/attachment-0001.html>
More information about the debian-med-commit
mailing list