[pypy-commit] extradoc extradoc: Added myself to winter sprint

2018-03-03 Thread stevie_92
Author: Stefan Beyer 
Branch: extradoc
Changeset: r5875:0e42fc53e29d
Date: 2018-03-03 15:20 +0100
http://bitbucket.org/pypy/extradoc/changeset/0e42fc53e29d/

Log:Added myself to winter sprint

diff --git a/sprintinfo/leysin-winter-2018/people.txt 
b/sprintinfo/leysin-winter-2018/people.txt
--- a/sprintinfo/leysin-winter-2018/people.txt
+++ b/sprintinfo/leysin-winter-2018/people.txt
@@ -21,6 +21,7 @@
 Alexander Schremmer  18.3/20.3  Ermina
 Ronan Lamy   17.3/23.3  Ermina
 René Dudfield18.3/24.3  Ermina
+Stefan Beyer 18.3/24.3  Ermina
  == ===
 
 **NOTE:** lodging is by default in Ermina.  Based on past years, there
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.6: Some ast validation errors are shown as TypeError

2018-03-03 Thread amauryfa
Author: Amaury Forgeot d'Arc 
Branch: py3.6
Changeset: r93945:4f89f769905c
Date: 2018-03-03 17:07 +0100
http://bitbucket.org/pypy/pypy/changeset/4f89f769905c/

Log:Some ast validation errors are shown as TypeError

diff --git a/pypy/interpreter/astcompiler/test/test_validate.py 
b/pypy/interpreter/astcompiler/test/test_validate.py
--- a/pypy/interpreter/astcompiler/test/test_validate.py
+++ b/pypy/interpreter/astcompiler/test/test_validate.py
@@ -397,7 +397,8 @@
 
 def test_constant(self):
 node = ast.Constant(self.space.newlist([1]), 0, 0)
-self.expr(node, "got an invalid type in Constant: list")
+self.expr(node, "got an invalid type in Constant: list",
+  exc=validate.ValidationTypeError)
 
 def test_stdlib_validates(self):
 stdlib = os.path.join(os.path.dirname(ast.__file__), 
'../../../lib-python/3')
diff --git a/pypy/interpreter/astcompiler/validate.py 
b/pypy/interpreter/astcompiler/validate.py
--- a/pypy/interpreter/astcompiler/validate.py
+++ b/pypy/interpreter/astcompiler/validate.py
@@ -11,12 +11,17 @@
 
 
 class ValidationError(Exception):
+# Will be seen as a ValueError
 def __init__(self, message):
 self.message = message
 
 def __str__(self):
 return self.message
 
+class ValidationTypeError(ValidationError):
+# Will be seen as a TypeError
+pass
+
 
 def expr_context_name(ctx):
 if not 1 <= ctx <= len(ast.expr_context_to_class):
@@ -111,8 +116,8 @@
 for w_item in space.unpackiterable(w_obj):
 validate_constant(space, w_item)
 return
-raise ValidationError("got an invalid type in Constant: %s" %
-  space.type(w_obj).name)
+raise ValidationTypeError("got an invalid type in Constant: %s" %
+  space.type(w_obj).name)
 
 
 class AstValidator(ast.ASTVisitor):
diff --git a/pypy/interpreter/pycompiler.py b/pypy/interpreter/pycompiler.py
--- a/pypy/interpreter/pycompiler.py
+++ b/pypy/interpreter/pycompiler.py
@@ -138,6 +138,9 @@
 def validate_ast(self, node):
 try:
 validate.validate_ast(self.space, node)
+except validate.ValidationTypeError as e:
+raise OperationError(self.space.w_TypeError,
+ self.space.newtext(e.message))
 except validate.ValidationError as e:
 raise OperationError(self.space.w_ValueError,
  self.space.newtext(e.message))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit