[pypy-commit] stmgc default: Port tests back from pypy/duhton about variable-argument && and ||

2014-08-26 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r1323:ec32e70ca45c
Date: 2014-08-26 15:16 +0200
http://bitbucket.org/pypy/stmgc/changeset/ec32e70ca45c/

Log:Port tests back from pypy/duhton about variable-argument && and ||

diff --git a/duhton/glob.c b/duhton/glob.c
--- a/duhton/glob.c
+++ b/duhton/glob.c
@@ -144,24 +144,13 @@
 DuObject *du_xor(DuObject *cons, DuObject *locals)
 {
 int result = 0;
-/* _du_read1(cons); IMMUTABLE */
-DuObject *expr = _DuCons_CAR(cons);
-DuObject *next = _DuCons_NEXT(cons);
-
-_du_save2(next, locals);
-DuObject *obj = Du_Eval(expr, locals);
-result = DuInt_AsInt(obj);
-_du_restore2(next, locals);
-
-cons = next;
-
 while (cons != Du_None) {
 /* _du_read1(cons); IMMUTABLE */
-expr = _DuCons_CAR(cons);
-next = _DuCons_NEXT(cons);
+DuObject *expr = _DuCons_CAR(cons);
+DuObject *next = _DuCons_NEXT(cons);
 
 _du_save2(next, locals);
-obj = Du_Eval(expr, locals);
+DuObject *obj = Du_Eval(expr, locals);
 result ^= DuInt_AsInt(obj);
 _du_restore2(next, locals);
 
@@ -353,8 +342,6 @@
 case 3: r = a != b; break;
 case 4: r = a > b; break;
 case 5: r = a >= b; break;
-case 6: r = a && b; break;
-case 7: r = a || b; break;
 }
 return DuInt_FromInt(r);
 }
@@ -371,11 +358,48 @@
 { return _du_intcmp(cons, locals, 4); }
 DuObject *du_ge(DuObject *cons, DuObject *locals)
 { return _du_intcmp(cons, locals, 5); }
+
 DuObject *du_and(DuObject *cons, DuObject *locals)
-{ return _du_intcmp(cons, locals, 6); }
+{
+while (cons != Du_None) {
+/* _du_read1(cons); IMMUTABLE */
+DuObject *expr = _DuCons_CAR(cons);
+DuObject *next = _DuCons_NEXT(cons);
+
+_du_save2(next, locals);
+DuObject *obj = Du_Eval(expr, locals);
+int result = DuObject_IsTrue(obj);
+_du_restore2(next, locals);
+
+if (!result)
+return DuInt_FromInt(0);
+
+cons = next;
+}
+
+return DuInt_FromInt(1);
+}
+
 DuObject *du_or(DuObject *cons, DuObject *locals)
-{ return _du_intcmp(cons, locals, 7); }
+{
+while (cons != Du_None) {
+/* _du_read1(cons); IMMUTABLE */
+DuObject *expr = _DuCons_CAR(cons);
+DuObject *next = _DuCons_NEXT(cons);
 
+_du_save2(next, locals);
+DuObject *obj = Du_Eval(expr, locals);
+int result = DuObject_IsTrue(obj);
+_du_restore2(next, locals);
+
+if (result)
+return DuInt_FromInt(1);
+
+cons = next;
+}
+
+return DuInt_FromInt(0);
+}
 
 
 DuObject *du_type(DuObject *cons, DuObject *locals)
diff --git a/duhton/test/test_int.py b/duhton/test/test_int.py
--- a/duhton/test/test_int.py
+++ b/duhton/test/test_int.py
@@ -20,9 +20,11 @@
 assert evaluate("(* 2 3 7)") == 42
 assert evaluate("(* (+ 5 1) (+ 6 1))") == 42
 
-def test_div():
+def test_div_mod():
 assert evaluate("(/ 11 2)") == 5
 assert evaluate("(/ 29 2 3)") == 4
+assert evaluate("(% 29 2)") == 1
+assert evaluate("(% 29 10 3)") == 0
 
 def test_cmp():
 assert evaluate("(<  6 6)") == 0
@@ -47,3 +49,35 @@
 assert evaluate("(>= 7 6)") == 1
 #
 assert evaluate("(< (+ 10 2) (+ 4 5))") == 0
+
+def test_and_or():
+assert evaluate("(&& 1 1 1)") == 1
+assert evaluate("(&& 1 0 1)") == 0
+assert evaluate("(&& 0 sdfdsfsd)") == 0
+assert evaluate("(&& None)") == 0
+assert evaluate("(&& (quote bla))") == 1
+assert evaluate("(&& )") == 1
+
+assert evaluate("(|| 0 1)") == 1
+assert evaluate("(|| 0 0 0 1)") == 1
+assert evaluate("(|| 0 0 0)") == 0
+assert evaluate("(|| 1 sdfdsfafds)") == 1
+assert evaluate("(|| None)") == 0
+assert evaluate("(|| (quote bla))") == 1
+assert evaluate("(|| )") == 0
+
+
+def test_shifts_bitwise():
+assert evaluate("(<< 1 1)") == 2
+assert evaluate("(<< 12)") == 12
+assert evaluate("(<< 1 1 1)") == 4
+assert evaluate("(<< 0 1)") == 0
+
+assert evaluate("(>> 4 1 1)") == 1
+assert evaluate("(>> 4 3)") == 0
+assert evaluate("(>> 4)") == 4
+
+assert evaluate("(^ 1 4)") == 1 ^ 4
+assert evaluate("(^ 1 4 122)") == 1 ^ 4 ^ 122
+assert evaluate("(^ 1)") == 1
+assert evaluate("(^)") == 0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add an enforceargs, bah

2014-08-26 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r73060:818f09dbcaed
Date: 2014-08-26 17:34 +0200
http://bitbucket.org/pypy/pypy/changeset/818f09dbcaed/

Log:Add an enforceargs, bah

diff --git a/rpython/rtyper/rlist.py b/rpython/rtyper/rlist.py
--- a/rpython/rtyper/rlist.py
+++ b/rpython/rtyper/rlist.py
@@ -2,7 +2,7 @@
 from rpython.flowspace.model import Constant
 from rpython.rlib import rgc, jit, types
 from rpython.rlib.debug import ll_assert
-from rpython.rlib.objectmodel import malloc_zero_filled
+from rpython.rlib.objectmodel import malloc_zero_filled, enforceargs
 from rpython.rlib.signature import signature
 from rpython.rlib.rarithmetic import ovfcheck, widen, r_uint, intmask
 from rpython.rtyper.annlowlevel import ADTInterface
@@ -722,6 +722,7 @@
 l.ll_setitem_fast(index, newitem)
 # no oopspec -- the function is inlined by the JIT
 
+@enforceargs(None, None, int)
 def ll_delitem_nonneg(func, l, index):
 ll_assert(index >= 0, "unexpectedly negative list delitem index")
 length = l.ll_length()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c7: stm_collect needs roots pushed

2014-08-26 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c7
Changeset: r73062:7d2441485839
Date: 2014-08-26 18:12 +0200
http://bitbucket.org/pypy/pypy/changeset/7d2441485839/

Log:stm_collect needs roots pushed

diff --git a/rpython/memory/gctransform/stmframework.py 
b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -159,6 +159,7 @@
 gct_stm_become_inevitable   = _gct_with_roots_pushed
 gct_stm_become_globally_unique_transaction  = _gct_with_roots_pushed
 gct_stm_transaction_break   = _gct_with_roots_pushed
+gct_stm_collect = _gct_with_roots_pushed
 
 
 class StmRootWalker(BaseRootWalker):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c7: PYPY_NO_OP is transactionsafe

2014-08-26 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c7
Changeset: r73061:2a2fff134037
Date: 2014-08-26 18:12 +0200
http://bitbucket.org/pypy/pypy/changeset/2a2fff134037/

Log:PYPY_NO_OP is transactionsafe

diff --git a/rpython/rtyper/lltypesystem/rffi.py 
b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -393,7 +393,7 @@
 eci = eci.merge(compilation_info)
 return llexternal('PYPY_NO_OP', [], lltype.Void,
   compilation_info=eci, sandboxsafe=True, _nowrapper=True,
-  _callable=lambda: None)
+  _callable=lambda: None, transactionsafe=True)
 
 def generate_macro_wrapper(name, macro, functype, eci):
 """Wraps a function-like macro inside a real function, and expose
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c7: tracing was ignoring stm_dont_track_raw_accesses

2014-08-26 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c7
Changeset: r73064:ba0e9a5ccb55
Date: 2014-08-26 18:15 +0200
http://bitbucket.org/pypy/pypy/changeset/ba0e9a5ccb55/

Log:tracing was ignoring stm_dont_track_raw_accesses

diff --git a/rpython/jit/backend/llsupport/descr.py 
b/rpython/jit/backend/llsupport/descr.py
--- a/rpython/jit/backend/llsupport/descr.py
+++ b/rpython/jit/backend/llsupport/descr.py
@@ -103,7 +103,7 @@
 
 def is_immutable(self):
 return self._immutable
-
+
 def is_pointer_field(self):
 return self.flag == FLAG_POINTER
 
@@ -139,6 +139,9 @@
 def repr_of_descr(self):
 return '' % (self.flag, self.name, self.offset)
 
+def stm_should_track_raw_accesses(self):
+return not self.stm_dont_track_raw_accesses
+
 
 def get_field_descr(gccache, STRUCT, fieldname):
 cache = gccache._cache_field
@@ -215,7 +218,7 @@
 
 def is_immutable(self):
 return self._immutable
-
+
 def is_array_of_pointers(self):
 return self.flag == FLAG_POINTER
 
@@ -295,7 +298,7 @@
 
 def is_immutable(self):
 return self._immutable
-
+
 def sort_key(self):
 return self.fielddescr.sort_key()
 
diff --git a/rpython/jit/metainterp/executor.py 
b/rpython/jit/metainterp/executor.py
--- a/rpython/jit/metainterp/executor.py
+++ b/rpython/jit/metainterp/executor.py
@@ -188,7 +188,8 @@
 return BoxInt(cpu.bh_getfield_raw_i(struct, fielddescr, pure))
 
 def do_getfield_raw(cpu, _, structbox, fielddescr):
-return _do_getfield_raw(cpu, False, structbox, fielddescr)
+pure = not fielddescr.stm_should_track_raw_accesses()
+return _do_getfield_raw(cpu, pure, structbox, fielddescr)
 
 def do_getfield_raw_pure(cpu, _, structbox, fielddescr):
 return _do_getfield_raw(cpu, True, structbox, fielddescr)
diff --git a/rpython/jit/metainterp/history.py 
b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -155,6 +155,9 @@
 def get_vinfo(self):
 raise NotImplementedError
 
+def stm_should_track_raw_accesses(self):
+return True
+
 class AbstractFailDescr(AbstractDescr):
 index = -1
 final_descr = False
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c7: break transactions during tracing

2014-08-26 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c7
Changeset: r73063:27ec5df9b53f
Date: 2014-08-26 18:13 +0200
http://bitbucket.org/pypy/pypy/changeset/27ec5df9b53f/

Log:break transactions during tracing

diff --git a/rpython/jit/metainterp/pyjitpl.py 
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -189,7 +189,7 @@
 
 @arguments("int")
 def opimpl_stm_should_break_transaction(self, keep):
-# from rpython.rlib import rstm
+from rpython.rlib import rstm
 
 record_break = False
 resbox = history.ConstInt(0)
@@ -199,13 +199,7 @@
 resbox = history.BoxInt(0)
 record_break = True
 
-## XXX: not working yet. we are always inevitable when tracing
-# if we_are_translated() and rstm.is_inevitable():
-# # return BoxInt(1) if there is an inevitable
-# # transaction, because it's likely that there
-# # will always be an inevitable transaction here
-# resbox = history.BoxInt(1)
-# record_break = True
+rstm.possible_transaction_break(0)
 
 if record_break:
 mi = self.metainterp
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c7: make thread number optional in logparser

2014-08-26 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c7
Changeset: r73065:c9e3663343e3
Date: 2014-08-26 18:16 +0200
http://bitbucket.org/pypy/pypy/changeset/c9e3663343e3/

Log:make thread number optional in logparser

diff --git a/rpython/tool/logparser.py b/rpython/tool/logparser.py
--- a/rpython/tool/logparser.py
+++ b/rpython/tool/logparser.py
@@ -26,8 +26,8 @@
 
 def parse_log(lines, verbose=False):
 color = "(?:\x1b.*?m)?"
-thread = "\d+#\s"
-r_start = re.compile(color + thread + 
+thread = "\d*#?\s?"
+r_start = re.compile(color + thread +
  r"\[([0-9a-fA-F]+)\] \{([\w-]+)" + color + "$")
 r_stop  = re.compile(color + thread +
  r"\[([0-9a-fA-F]+)\] ([\w-]+)\}" + color + "$")
@@ -117,7 +117,7 @@
 for entry in log:
 if not entry[0].startswith(catprefix):
 if len(entry) > 3:
-newlog.append(entry[:3] + 
+newlog.append(entry[:3] +
   (kill_category(entry[3], catprefix),))
 else:
 newlog.append(entry)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: regenerate ast.py

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73067:276f1b668967
Date: 2014-08-24 15:55 -0700
http://bitbucket.org/pypy/pypy/changeset/276f1b668967/

Log:regenerate ast.py

diff too long, truncating to 2000 out of 6594 lines

diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -321,8 +321,6 @@
 return Assign.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_AugAssign):
 return AugAssign.from_object(space, w_node)
-if space.isinstance_w(w_node, get(space).w_Print):
-return Print.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_For):
 return For.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_While):
@@ -343,10 +341,10 @@
 return Import.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_ImportFrom):
 return ImportFrom.from_object(space, w_node)
-if space.isinstance_w(w_node, get(space).w_Exec):
-return Exec.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_Global):
 return Global.from_object(space, w_node)
+if space.isinstance_w(w_node, get(space).w_Nonlocal):
+return Nonlocal.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_Expr):
 return Expr.from_object(space, w_node)
 if space.isinstance_w(w_node, get(space).w_Pass):
@@ -366,16 +364,8 @@
 self.args = args
 self.body = body
 self.decorator_list = decorator_list
-<<< mine
-self.w_decorator_list = None
 self.returns = returns
-===
->>> theirs
 stmt.__init__(self, lineno, col_offset)
-<<< mine
-self.initialization_state = 127
-===
->>> theirs
 
 def walkabout(self, visitor):
 visitor.visit_FunctionDef(self)
@@ -390,37 +380,6 @@
 self.returns = self.returns.mutate_over(visitor)
 return visitor.visit_FunctionDef(self)
 
-<<< mine
-def sync_app_attrs(self, space):
-if (self.initialization_state & ~64) ^ 63:
-self.missing_field(space, ['lineno', 'col_offset', 'name', 'args', 
'body', 'decorator_list', None], 'FunctionDef')
-else:
-if not self.initialization_state & 64:
-self.returns = None
-self.args.sync_app_attrs(space)
-w_list = self.w_body
-if w_list is not None:
-list_w = space.listview(w_list)
-if list_w:
-self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
-else:
-self.body = None
-if self.body is not None:
-for node in self.body:
-node.sync_app_attrs(space)
-w_list = self.w_decorator_list
-if w_list is not None:
-list_w = space.listview(w_list)
-if list_w:
-self.decorator_list = [space.interp_w(expr, w_obj) for w_obj 
in list_w]
-else:
-self.decorator_list = None
-if self.decorator_list is not None:
-for node in self.decorator_list:
-node.sync_app_attrs(space)
-if self.returns:
-self.returns.sync_app_attrs(space)
-===
 def to_object(self, space):
 w_node = space.call_function(get(space).w_FunctionDef)
 w_name = space.wrap(self.name)  # identifier
@@ -439,6 +398,8 @@
 decorator_list_w = [node.to_object(space) for node in 
self.decorator_list] # expr
 w_decorator_list = space.newlist(decorator_list_w)
 space.setattr(w_node, space.wrap('decorator_list'), w_decorator_list)
+w_returns = self.returns.to_object(space) if self.returns is not None 
else space.w_None  # expr
+space.setattr(w_node, space.wrap('returns'), w_returns)
 w_lineno = space.wrap(self.lineno)  # int
 space.setattr(w_node, space.wrap('lineno'), w_lineno)
 w_col_offset = space.wrap(self.col_offset)  # int
@@ -451,6 +412,7 @@
 w_args = get_field(space, w_node, 'args', False)
 w_body = get_field(space, w_node, 'body', False)
 w_decorator_list = get_field(space, w_node, 'decorator_list', False)
+w_returns = get_field(space, w_node, 'returns', True)
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
 _name = space.realstr_w(w_name)
@@ -459,12 +421,12 @@
 _body = [stmt.from_object(space, w_item) for w_item in body_w]
 decorator_list_w = space.unpackiterable(w_decorator_list)
 _decorator_list = [expr.from_object(space, w_item) for w_item in 
decorator_list_w]
+_returns = expr.from_object(space, w_returns)
 _lineno = space.int_w(w_lineno)
 _col_offs

[pypy-commit] pypy py3k: merge default (bf3e8fa831fd)

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73066:9310ca287cdd
Date: 2014-08-24 15:54 -0700
http://bitbucket.org/pypy/pypy/changeset/9310ca287cdd/

Log:merge default (bf3e8fa831fd)

diff too long, truncating to 2000 out of 5869 lines

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -354,6 +354,6 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 
-Detailled license information is contained in the NOTICE file in the
+Detailed license information is contained in the NOTICE file in the
 directory.
 
diff --git a/lib_pypy/pyrepl/reader.py b/lib_pypy/pyrepl/reader.py
--- a/lib_pypy/pyrepl/reader.py
+++ b/lib_pypy/pyrepl/reader.py
@@ -101,7 +101,7 @@
 st = {}
 for c in map(unichr, range(256)):
 st[c] = SYNTAX_SYMBOL
-for c in [a for a in map(unichr, range(256)) if a.isalpha()]:
+for c in [a for a in map(unichr, range(256)) if a.isalnum()]:
 st[c] = SYNTAX_WORD
 st[unicode('\n')] = st[unicode(' ')] = SYNTAX_WHITESPACE
 return st
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -54,3 +54,6 @@
 .. branch: pytest-25
 Update our copies of py.test and pylib to versions 2.5.2 and 1.4.20, 
 respectively.
+
+.. branch: split-ast-classes
+Classes in the ast module are now distinct from structures used by the 
compiler.
diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst
--- a/pypy/doc/windows.rst
+++ b/pypy/doc/windows.rst
@@ -37,7 +37,7 @@
 using a 32 bit Python and vice versa. By default pypy is built using the 
 Multi-threaded DLL (/MD) runtime environment.
 
-**Note:** PyPy is currently not supported for 64 bit Windows, and translation
+**Note:** PyPy is currently not supported for 64 bit Python, and translation
 will fail in this case.
 
 Python and a C compiler are all you need to build pypy, but it will miss some
@@ -136,7 +136,7 @@
 
 cd zlib-1.2.3
 nmake -f win32\Makefile.msc
-copy zlib1.lib 
+copy zlib.lib 
 copy zlib.h zconf.h 
 
 The bz2 compression library
@@ -165,27 +165,29 @@
 directory.  Version 2.1.0 is known to pass tests. Then open the project 
 file ``expat.dsw`` with Visual
 Studio; follow the instruction for converting the project files,
-switch to the "Release" configuration, reconfigure the runtime for 
-Multi-threaded DLL (/MD) and build the solution (the ``expat`` project 
-is actually enough for pypy).
+switch to the "Release" configuration, use the ``expat_static`` project,
+reconfigure the runtime for Multi-threaded DLL (/MD) and build.
 
-Then, copy the file ``win32\bin\release\libexpat.dll`` somewhere in
-your PATH, ``win32\bin\release\libexpat.lib`` somewhere in LIB, and
-both ``lib\expat.h`` and ``lib\expat_external.h`` somewhere in INCLUDE.
+Then, copy the file ``win32\bin\release\libexpat.lib`` somewhere in
+somewhere in LIB, and both ``lib\expat.h`` and ``lib\expat_external.h``
+somewhere in INCLUDE.
 
 The OpenSSL library
 ~~~
 
 OpenSSL needs a Perl interpreter to configure its makefile.  You may
-use the one distributed by ActiveState, or the one from cygwin.  In
-both case the perl interpreter must be found on the PATH.
+use the one distributed by ActiveState, or the one from cygwin.::
 
-svn export http://svn.python.org/projects/external/openssl-0.9.8y
-cd openssl-0.9.8y
-perl Configure VC-WIN32
+svn export http://svn.python.org/projects/external/openssl-1.0.1i
+cd openssl-1.0.1i
+perl Configure VC-WIN32 no-idea no-mdc2
 ms\do_ms.bat
 nmake -f ms\nt.mak install
 
+Then, copy the files ``out32\*.lib`` somewhere in
+somewhere in LIB, and the entire ``include\openssl`` directory as-is somewhere
+in INCLUDE.
+
 TkInter module support
 ~~
 
diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -1,5 +1,4 @@
 # Generated by tools/asdl_py.py
-from rpython.rlib.unroll import unrolling_iterable
 from rpython.tool.pairtype import extendabletype
 from rpython.tool.sourcetools import func_with_new_name
 
@@ -21,11 +20,15 @@
 'AST string must be of type str or unicode'))
 return w_obj
 
-
-class AST(W_Root):
-
-w_dict = None
-
+def get_field(space, w_node, name, optional):
+w_obj = w_node.getdictvalue(space, name)
+if w_obj is None and not optional:
+raise oefmt(space.w_TypeError,
+"required field \"%s\" missing from %T", name, w_node)
+return w_obj
+
+
+class AST(object):
 __metaclass__ = extendabletype
 
 def walkabout(self, visitor):
@@ -34,8 +37,23 @@
 def mutate_over(self, visitor):
 raise AssertionError("mutate_over() implementation not provided")
 
-def sync_app_attrs(self, space):
-raise NotImplementedError
+
+class NodeVisitorNotImplemented(Exception):
+pass
+
+
+class _FieldsW

[pypy-commit] pypy py3k: (mattip) fix test_fillWithObject

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73070:f7c113013604
Date: 2014-08-26 10:56 -0700
http://bitbucket.org/pypy/pypy/changeset/f7c113013604/

Log:(mattip) fix test_fillWithObject

diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py
--- a/pypy/module/cpyext/buffer.py
+++ b/pypy/module/cpyext/buffer.py
@@ -1,6 +1,5 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
 from rpython.rlib import buffer
-from rpython.rlib.objectmodel import import_from_mixin
 from pypy.module.cpyext.api import (
 cpython_api, CANNOT_FAIL, Py_buffer)
 from pypy.module.cpyext.pyobject import PyObject, Py_DecRef
@@ -13,7 +12,8 @@
 # PyPy only supports contiguous Py_buffers for now.
 return 1
 
-class CBufferMixin(object):
+class CBuffer(buffer.Buffer):
+_immutable_ = True
 
 def __init__(self, space, c_buf, c_len, w_obj):
 self.space = space
@@ -21,8 +21,7 @@
 self.c_len = c_len
 self.w_obj = w_obj
 
-def destructor(self):
-assert isinstance(self, CBufferMixin)
+def __del__(self):
 Py_DecRef(self.space, self.w_obj)
 
 def getlength(self):
@@ -34,10 +33,3 @@
 def as_str(self):
 return rffi.charpsize2str(rffi.cast(rffi.CCHARP, self.c_buf),
   self.c_len)
-
-class CBuffer(buffer.Buffer):
-import_from_mixin(CBufferMixin)
-_immutable_ = True
-
-def __del__(self):
-CBufferMixin.destructor(self)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73071:e15d0862520d
Date: 2014-08-26 10:57 -0700
http://bitbucket.org/pypy/pypy/changeset/e15d0862520d/

Log:merge default

diff --git a/rpython/jit/backend/x86/callbuilder.py 
b/rpython/jit/backend/x86/callbuilder.py
--- a/rpython/jit/backend/x86/callbuilder.py
+++ b/rpython/jit/backend/x86/callbuilder.py
@@ -1,7 +1,6 @@
 import sys
 from rpython.rlib.clibffi import FFI_DEFAULT_ABI
 from rpython.rlib.objectmodel import we_are_translated
-from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.jit.metainterp.history import INT, FLOAT
 from rpython.jit.backend.x86.arch import (WORD, IS_X86_64, IS_X86_32,
   PASS_ON_MY_FRAME, FRAME_FIXED_SIZE)
@@ -22,8 +21,6 @@
 def align_stack_words(words):
 return (words + CALL_ALIGN - 1) & ~(CALL_ALIGN-1)
 
-NO_ARG_FUNC_PTR = lltype.Ptr(lltype.FuncType([], lltype.Void))
-
 
 class CallBuilderX86(AbstractCallBuilder):
 
@@ -94,30 +91,9 @@
 gcrootmap = self.asm.cpu.gc_ll_descr.gcrootmap
 if gcrootmap:
 if gcrootmap.is_shadow_stack and self.is_call_release_gil:
-from rpython.jit.backend.x86.assembler import heap
-from rpython.jit.backend.x86 import rx86
-from rpython.rtyper.lltypesystem.lloperation import llop
-#
-# When doing a call_release_gil with shadowstack, there
-# is the risk that the 'rpy_fastgil' was free but the
-# current shadowstack can be the one of a different
-# thread.  So here we check if the shadowstack pointer
-# is still the same as before we released the GIL (saved
-# in 'ebx'), and if not, we call 'thread_run'.
-rst = gcrootmap.get_root_stack_top_addr()
-mc = self.mc
-mc.CMP(ebx, heap(rst))
-mc.J_il8(rx86.Conditions['E'], 0)
-je_location = mc.get_relative_pos()
-# call 'thread_run'
-t_run = llop.gc_thread_run_ptr(NO_ARG_FUNC_PTR)
-mc.CALL(imm(rffi.cast(lltype.Signed, t_run)))
-# patch the JE above
-offset = mc.get_relative_pos() - je_location
-assert 0 < offset <= 127
-mc.overwrite(je_location-1, chr(offset))
+# in this mode, 'ebx' happens to contain the shadowstack
+# top at this point, so reuse it instead of loading it again
 ssreg = ebx
-#
 self.asm._reload_frame_if_necessary(self.mc, shadowstack_reg=ssreg)
 if self.change_extra_stack_depth:
 self.asm.set_extra_stack_depth(self.mc, 0)
@@ -206,8 +182,35 @@
 mc.MOV_ri(X86_64_SCRATCH_REG.value, fastgil)
 mc.XCHG_rm(old_value.value, (X86_64_SCRATCH_REG.value, 0))
 mc.CMP(old_value, css_value)
-mc.J_il8(rx86.Conditions['E'], 0)
-je_location = mc.get_relative_pos()
+#
+gcrootmap = self.asm.cpu.gc_ll_descr.gcrootmap
+if bool(gcrootmap) and gcrootmap.is_shadow_stack:
+from rpython.jit.backend.x86.assembler import heap
+#
+# When doing a call_release_gil with shadowstack, there
+# is the risk that the 'rpy_fastgil' was free but the
+# current shadowstack can be the one of a different
+# thread.  So here we check if the shadowstack pointer
+# is still the same as before we released the GIL (saved
+# in 'ebx'), and if not, we fall back to 'reacqgil_addr'.
+mc.J_il8(rx86.Conditions['NE'], 0)
+jne_location = mc.get_relative_pos()
+# here, ecx is zero (so rpy_fastgil was not acquired)
+rst = gcrootmap.get_root_stack_top_addr()
+mc = self.mc
+mc.CMP(ebx, heap(rst))
+mc.J_il8(rx86.Conditions['E'], 0)
+je_location = mc.get_relative_pos()
+# revert the rpy_fastgil acquired above, so that the
+# general 'reacqgil_addr' below can acquire it again...
+mc.MOV(heap(fastgil), ecx)
+# patch the JNE above
+offset = mc.get_relative_pos() - jne_location
+assert 0 < offset <= 127
+mc.overwrite(jne_location-1, chr(offset))
+else:
+mc.J_il8(rx86.Conditions['E'], 0)
+je_location = mc.get_relative_pos()
 #
 # Yes, we need to call the reacqgil() function
 self.save_result_value_reacq()
diff --git a/rpython/memory/gctransform/framework.py 
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -977,12 +977,6 @@
 hop.genop("direct_call", [self.root_walker.thread_run_ptr])
 self.pop_roots(hop, livevars)
 
-def gct_gc_thread_run_ptr(self, hop):
-assert self.translat

[pypy-commit] pypy py3k: py3 _fields

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73068:5c7c51c7c4f7
Date: 2014-08-24 16:07 -0700
http://bitbucket.org/pypy/pypy/changeset/5c7c51c7c4f7/

Log:py3 _fields

diff --git a/pypy/interpreter/astcompiler/test/test_ast.py 
b/pypy/interpreter/astcompiler/test/test_ast.py
--- a/pypy/interpreter/astcompiler/test/test_ast.py
+++ b/pypy/interpreter/astcompiler/test/test_ast.py
@@ -41,11 +41,12 @@
 w_fields = space.getattr(ast.get(space).w_FunctionDef,
  space.wrap("_fields"))
 assert space.eq_w(w_fields, space.wrap(
-('name', 'args', 'body', 'decorator_list')))
+('name', 'args', 'body', 'decorator_list', 'returns')))
 w_fields = space.getattr(ast.get(space).w_arguments,
  space.wrap("_fields"))
 assert space.eq_w(w_fields, space.wrap(
-('args', 'vararg', 'kwarg', 'defaults')))
+('args', 'vararg', 'varargannotation', 'kwonlyargs', 'kwarg',
+ 'kwargannotation', 'defaults', 'kw_defaults')))
 
 def test_attributes(self, space):
 w_attrs = space.getattr(ast.get(space).w_FunctionDef,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix handling of None values in kw_defaults again

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73069:f9d726dbb392
Date: 2014-08-24 16:31 -0700
http://bitbucket.org/pypy/pypy/changeset/f9d726dbb392/

Log:fix handling of None values in kw_defaults again

diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -3291,7 +3291,7 @@
 if self.kw_defaults is None:
 kw_defaults_w = []
 else:
-kw_defaults_w = [node.to_object(space) for node in 
self.kw_defaults] # expr
+kw_defaults_w = [node.to_object(space) if node is not None else 
space.w_None for node in self.kw_defaults] # expr
 w_kw_defaults = space.newlist(kw_defaults_w)
 space.setattr(w_node, space.wrap('kw_defaults'), w_kw_defaults)
 return w_node
diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py 
b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -131,7 +131,9 @@
 return "space.wrap(%s)" % (value,)
 else:
 wrapper = "%s.to_object(space)" % (value,)
-if field.opt:
+# XXX: kw_defaults, unlike other sequences, allows None
+# values
+if field.opt or field.name.value == 'kw_defaults':
 wrapper += " if %s is not None else space.w_None" % (value,)
 return wrapper
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: regenerate ast.py

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73074:ce5d419573a8
Date: 2014-08-26 11:03 -0700
http://bitbucket.org/pypy/pypy/changeset/ce5d419573a8/

Log:regenerate ast.py

diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -382,7 +382,7 @@
 
 def to_object(self, space):
 w_node = space.call_function(get(space).w_FunctionDef)
-w_name = space.wrap(self.name)  # identifier
+w_name = space.wrap(self.name.decode('utf-8'))  # identifier
 space.setattr(w_node, space.wrap('name'), w_name)
 w_args = self.args.to_object(space)  # arguments
 space.setattr(w_node, space.wrap('args'), w_args)
@@ -415,13 +415,13 @@
 w_returns = get_field(space, w_node, 'returns', True)
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
-_name = space.realstr_w(w_name)
+_name = space.identifier_w(w_name)
 _args = arguments.from_object(space, w_args)
 body_w = space.unpackiterable(w_body)
 _body = [stmt.from_object(space, w_item) for w_item in body_w]
 decorator_list_w = space.unpackiterable(w_decorator_list)
 _decorator_list = [expr.from_object(space, w_item) for w_item in 
decorator_list_w]
-_returns = expr.from_object(space, w_returns)
+_returns = expr.from_object(space, w_returns) if w_returns is not None 
else None
 _lineno = space.int_w(w_lineno)
 _col_offset = space.int_w(w_col_offset)
 return FunctionDef(_name, _args, _body, _decorator_list, _returns, 
_lineno, _col_offset)
@@ -461,7 +461,7 @@
 
 def to_object(self, space):
 w_node = space.call_function(get(space).w_ClassDef)
-w_name = space.wrap(self.name)  # identifier
+w_name = space.wrap(self.name.decode('utf-8'))  # identifier
 space.setattr(w_node, space.wrap('name'), w_name)
 if self.bases is None:
 bases_w = []
@@ -508,13 +508,13 @@
 w_decorator_list = get_field(space, w_node, 'decorator_list', False)
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
-_name = space.realstr_w(w_name)
+_name = space.identifier_w(w_name)
 bases_w = space.unpackiterable(w_bases)
 _bases = [expr.from_object(space, w_item) for w_item in bases_w]
 keywords_w = space.unpackiterable(w_keywords)
 _keywords = [keyword.from_object(space, w_item) for w_item in 
keywords_w]
-_starargs = expr.from_object(space, w_starargs)
-_kwargs = expr.from_object(space, w_kwargs)
+_starargs = expr.from_object(space, w_starargs) if w_starargs is not 
None else None
+_kwargs = expr.from_object(space, w_kwargs) if w_kwargs is not None 
else None
 body_w = space.unpackiterable(w_body)
 _body = [stmt.from_object(space, w_item) for w_item in body_w]
 decorator_list_w = space.unpackiterable(w_decorator_list)
@@ -555,7 +555,7 @@
 w_value = get_field(space, w_node, 'value', True)
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
-_value = expr.from_object(space, w_value)
+_value = expr.from_object(space, w_value) if w_value is not None else 
None
 _lineno = space.int_w(w_lineno)
 _col_offset = space.int_w(w_col_offset)
 return Return(_value, _lineno, _col_offset)
@@ -931,7 +931,7 @@
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
 _context_expr = expr.from_object(space, w_context_expr)
-_optional_vars = expr.from_object(space, w_optional_vars)
+_optional_vars = expr.from_object(space, w_optional_vars) if 
w_optional_vars is not None else None
 body_w = space.unpackiterable(w_body)
 _body = [stmt.from_object(space, w_item) for w_item in body_w]
 _lineno = space.int_w(w_lineno)
@@ -976,8 +976,8 @@
 w_cause = get_field(space, w_node, 'cause', True)
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
-_exc = expr.from_object(space, w_exc)
-_cause = expr.from_object(space, w_cause)
+_exc = expr.from_object(space, w_exc) if w_exc is not None else None
+_cause = expr.from_object(space, w_cause) if w_cause is not None else 
None
 _lineno = space.int_w(w_lineno)
 _col_offset = space.int_w(w_col_offset)
 return Raise(_exc, _cause, _lineno, _col_offset)
@@ -1140,7 +1140,7 @@
 w_lineno = get_field(space, w_node, 'lineno', False)
 w_col_offset = get_field(space, w_node, 'col_offset', False)
 _test = expr.from_o

[pypy-commit] pypy py3k: kill realstr_w which is no longer used nor makes much sense on py3k

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73075:d5ad5952d919
Date: 2014-08-26 11:04 -0700
http://bitbucket.org/pypy/pypy/changeset/d5ad5952d919/

Log:kill realstr_w which is no longer used nor makes much sense on py3k

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1529,13 +1529,6 @@
 """
 return w_obj.float_w(self, allow_conversion)
 
-def realstr_w(self, w_obj):
-# Like str_w, but only works if w_obj is really of type 'str'.
-if not self.isinstance_w(w_obj, self.w_str):
-raise OperationError(self.w_TypeError,
- self.wrap('argument must be a string'))
-return self.str_w(w_obj)
-
 def unicode_w(self, w_obj):
 return w_obj.unicode_w(self)
 
diff --git a/pypy/module/mmap/interp_mmap.py b/pypy/module/mmap/interp_mmap.py
--- a/pypy/module/mmap/interp_mmap.py
+++ b/pypy/module/mmap/interp_mmap.py
@@ -196,7 +196,7 @@
 "mmap item value must be in range(0, 256)"))
 self.mmap.setitem(start, chr(value))
 else:
-value = space.realstr_w(w_value)
+value = space.bytes_w(w_value)
 if len(value) != length:
 raise OperationError(space.w_ValueError,
   space.wrap("mmap slice assignment is wrong size"))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix generic extraction of optional fields

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73072:f82f65bb5aec
Date: 2014-08-26 11:03 -0700
http://bitbucket.org/pypy/pypy/changeset/f82f65bb5aec/

Log:fix generic extraction of optional fields

diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py 
b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -153,7 +153,10 @@
 elif field.type.value in ("bool",):
 return "space.bool_w(%s)" % (value,)
 else:
-return "%s.from_object(space, %s)" % (field.type, value)
+extractor = "%s.from_object(space, %s)" % (field.type, value)
+if field.opt:
+extractor += " if %s is not None else None" % (value,)
+return extractor
 
 def get_field_converter(self, field):
 if field.seq:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: reapply py3k's special handling of identifiers

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r73073:1be2c936628c
Date: 2014-08-26 11:03 -0700
http://bitbucket.org/pypy/pypy/changeset/1be2c936628c/

Log:reapply py3k's special handling of identifiers

diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py 
b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -125,9 +125,14 @@
 def get_value_converter(self, field, value):
 if field.type.value in self.data.simple_types:
 return "%s_to_class[%s - 1]().to_object(space)" % (field.type, 
value)
+elif field.type.value == "identifier":
+wrapper = "space.wrap(%s.decode('utf-8'))" % (value,)
+if field.opt:
+wrapper += " if %s is not None else space.w_None" % (value,)
+return wrapper
 elif field.type.value in ("object", "string"):
 return value
-elif field.type.value in ("identifier", "int", "bool"):
+elif field.type.value in ("int", "bool"):
 return "space.wrap(%s)" % (value,)
 else:
 wrapper = "%s.to_object(space)" % (value,)
@@ -147,7 +152,7 @@
 elif field.type.value in ("identifier",):
 if field.opt:
 return "space.str_or_None_w(%s)" % (value,)
-return "space.realstr_w(%s)" % (value,)
+return "space.identifier_w(%s)" % (value,)
 elif field.type.value in ("int",):
 return "space.int_w(%s)" % (value,)
 elif field.type.value in ("bool",):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: back out changeset: f7c113013604, breaks translation

2014-08-26 Thread mattip
Author: mattip 
Branch: py3k
Changeset: r73076:b3072cefc086
Date: 2014-08-26 23:09 +0300
http://bitbucket.org/pypy/pypy/changeset/b3072cefc086/

Log:back out changeset: f7c113013604, breaks translation

diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py
--- a/pypy/module/cpyext/buffer.py
+++ b/pypy/module/cpyext/buffer.py
@@ -1,5 +1,6 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
 from rpython.rlib import buffer
+from rpython.rlib.objectmodel import import_from_mixin
 from pypy.module.cpyext.api import (
 cpython_api, CANNOT_FAIL, Py_buffer)
 from pypy.module.cpyext.pyobject import PyObject, Py_DecRef
@@ -12,8 +13,7 @@
 # PyPy only supports contiguous Py_buffers for now.
 return 1
 
-class CBuffer(buffer.Buffer):
-_immutable_ = True
+class CBufferMixin(object):
 
 def __init__(self, space, c_buf, c_len, w_obj):
 self.space = space
@@ -21,7 +21,8 @@
 self.c_len = c_len
 self.w_obj = w_obj
 
-def __del__(self):
+def destructor(self):
+assert isinstance(self, CBufferMixin)
 Py_DecRef(self.space, self.w_obj)
 
 def getlength(self):
@@ -33,3 +34,10 @@
 def as_str(self):
 return rffi.charpsize2str(rffi.cast(rffi.CCHARP, self.c_buf),
   self.c_len)
+
+class CBuffer(buffer.Buffer):
+import_from_mixin(CBufferMixin)
+_immutable_ = True
+
+def __del__(self):
+CBufferMixin.destructor(self)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3.3
Changeset: r73077:664cef61a119
Date: 2014-08-26 14:22 -0700
http://bitbucket.org/pypy/pypy/changeset/664cef61a119/

Log:merge py3k

diff too long, truncating to 2000 out of 11591 lines

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -354,6 +354,6 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 
-Detailled license information is contained in the NOTICE file in the
+Detailed license information is contained in the NOTICE file in the
 directory.
 
diff --git a/lib_pypy/pyrepl/reader.py b/lib_pypy/pyrepl/reader.py
--- a/lib_pypy/pyrepl/reader.py
+++ b/lib_pypy/pyrepl/reader.py
@@ -101,7 +101,7 @@
 st = {}
 for c in map(unichr, range(256)):
 st[c] = SYNTAX_SYMBOL
-for c in [a for a in map(unichr, range(256)) if a.isalpha()]:
+for c in [a for a in map(unichr, range(256)) if a.isalnum()]:
 st[c] = SYNTAX_WORD
 st[unicode('\n')] = st[unicode(' ')] = SYNTAX_WHITESPACE
 return st
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -54,3 +54,6 @@
 .. branch: pytest-25
 Update our copies of py.test and pylib to versions 2.5.2 and 1.4.20, 
 respectively.
+
+.. branch: split-ast-classes
+Classes in the ast module are now distinct from structures used by the 
compiler.
diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst
--- a/pypy/doc/windows.rst
+++ b/pypy/doc/windows.rst
@@ -37,7 +37,7 @@
 using a 32 bit Python and vice versa. By default pypy is built using the 
 Multi-threaded DLL (/MD) runtime environment.
 
-**Note:** PyPy is currently not supported for 64 bit Windows, and translation
+**Note:** PyPy is currently not supported for 64 bit Python, and translation
 will fail in this case.
 
 Python and a C compiler are all you need to build pypy, but it will miss some
@@ -136,7 +136,7 @@
 
 cd zlib-1.2.3
 nmake -f win32\Makefile.msc
-copy zlib1.lib 
+copy zlib.lib 
 copy zlib.h zconf.h 
 
 The bz2 compression library
@@ -165,27 +165,29 @@
 directory.  Version 2.1.0 is known to pass tests. Then open the project 
 file ``expat.dsw`` with Visual
 Studio; follow the instruction for converting the project files,
-switch to the "Release" configuration, reconfigure the runtime for 
-Multi-threaded DLL (/MD) and build the solution (the ``expat`` project 
-is actually enough for pypy).
+switch to the "Release" configuration, use the ``expat_static`` project,
+reconfigure the runtime for Multi-threaded DLL (/MD) and build.
 
-Then, copy the file ``win32\bin\release\libexpat.dll`` somewhere in
-your PATH, ``win32\bin\release\libexpat.lib`` somewhere in LIB, and
-both ``lib\expat.h`` and ``lib\expat_external.h`` somewhere in INCLUDE.
+Then, copy the file ``win32\bin\release\libexpat.lib`` somewhere in
+somewhere in LIB, and both ``lib\expat.h`` and ``lib\expat_external.h``
+somewhere in INCLUDE.
 
 The OpenSSL library
 ~~~
 
 OpenSSL needs a Perl interpreter to configure its makefile.  You may
-use the one distributed by ActiveState, or the one from cygwin.  In
-both case the perl interpreter must be found on the PATH.
+use the one distributed by ActiveState, or the one from cygwin.::
 
-svn export http://svn.python.org/projects/external/openssl-0.9.8y
-cd openssl-0.9.8y
-perl Configure VC-WIN32
+svn export http://svn.python.org/projects/external/openssl-1.0.1i
+cd openssl-1.0.1i
+perl Configure VC-WIN32 no-idea no-mdc2
 ms\do_ms.bat
 nmake -f ms\nt.mak install
 
+Then, copy the files ``out32\*.lib`` somewhere in
+somewhere in LIB, and the entire ``include\openssl`` directory as-is somewhere
+in INCLUDE.
+
 TkInter module support
 ~~
 
diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -1,5 +1,4 @@
 # Generated by tools/asdl_py.py
-from rpython.rlib.unroll import unrolling_iterable
 from rpython.tool.pairtype import extendabletype
 from rpython.tool.sourcetools import func_with_new_name
 
@@ -21,11 +20,15 @@
 'AST string must be of type str or unicode'))
 return w_obj
 
-
-class AST(W_Root):
-
-w_dict = None
-
+def get_field(space, w_node, name, optional):
+w_obj = w_node.getdictvalue(space, name)
+if w_obj is None and not optional:
+raise oefmt(space.w_TypeError,
+"required field \"%s\" missing from %T", name, w_node)
+return w_obj
+
+
+class AST(object):
 __metaclass__ = extendabletype
 
 def walkabout(self, visitor):
@@ -34,8 +37,23 @@
 def mutate_over(self, visitor):
 raise AssertionError("mutate_over() implementation not provided")
 
-def sync_app_attrs(self, space):
-raise NotImplementedError
+
+class NodeVisitorNotImplemented(Exception):
+pass
+
+
+class _FieldsWrapper(W_Root):

[pypy-commit] pypy py3.3: fix per new ast.py

2014-08-26 Thread pjenvey
Author: Philip Jenvey 
Branch: py3.3
Changeset: r73078:1d260c164b38
Date: 2014-08-26 16:41 -0700
http://bitbucket.org/pypy/pypy/changeset/1d260c164b38/

Log:fix per new ast.py

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
@@ -21,7 +21,7 @@
 def expr_context_name(ctx):
 if not 1 <= ctx <= len(ast.expr_context_to_class):
 return '??'
-return ast.expr_context_to_class[ctx - 1].typedef.name
+return ast.expr_context_to_class[ctx - 1].__name__[1:]
 
 def _check_context(expected_ctx, actual_ctx):
 if expected_ctx != actual_ctx:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit