[pypy-commit] pypy release-2.3.x: add more macros (tests?)

2014-05-05 Thread mattip
Author: mattip 
Branch: release-2.3.x
Changeset: r71273:3f7cffa4d3ed
Date: 2014-05-05 10:03 +0300
http://bitbucket.org/pypy/pypy/changeset/3f7cffa4d3ed/

Log:add more macros (tests?)

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -902,7 +902,9 @@
 ("SIZEOF_TIME_T", rffi.TIME_T),
 ("SIZEOF_LONG", rffi.LONG),
 ("SIZEOF_SHORT", rffi.SHORT),
-("SIZEOF_INT", rffi.INT)
+("SIZEOF_INT", rffi.INT),
+("SIZEOF_FLOAT", rffi.FLOAT),
+("SIZEOF_DOUBLE", rffi.DOUBLE),
 ]:
 pypy_macros.append("#define %s %s" % (macro_name, rffi.sizeof(size)))
 pypy_macros.append('')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: add more macros (tests?)

2014-05-05 Thread mattip
Author: mattip 
Branch: 
Changeset: r71274:5ceef23a14b8
Date: 2014-05-05 10:03 +0300
http://bitbucket.org/pypy/pypy/changeset/5ceef23a14b8/

Log:add more macros (tests?)

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -902,7 +902,9 @@
 ("SIZEOF_TIME_T", rffi.TIME_T),
 ("SIZEOF_LONG", rffi.LONG),
 ("SIZEOF_SHORT", rffi.SHORT),
-("SIZEOF_INT", rffi.INT)
+("SIZEOF_INT", rffi.INT),
+("SIZEOF_FLOAT", rffi.FLOAT),
+("SIZEOF_DOUBLE", rffi.DOUBLE),
 ]:
 pypy_macros.append("#define %s %s" % (macro_name, rffi.sizeof(size)))
 pypy_macros.append('')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: some extensions, do the XXXs

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5227:e223b2a3a220
Date: 2014-05-05 09:50 +0200
http://bitbucket.org/pypy/extradoc/changeset/e223b2a3a220/

Log:some extensions, do the XXXs

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -21,7 +21,7 @@
 
 \conferenceinfo{ICOOOLPS workshop 2014}{July 28th, 2014, Uppsala, Sweden}
 \copyrightyear{2014}
-\copyrightdata{978-1---n/yy/mm}
+%\copyrightdata{978-1---n/yy/mm}
 \doi{nnn.nnn}
 
 % Uncomment one of the following two, if you are not going for the
@@ -37,7 +37,7 @@
 %% \titlebanner{banner above paper title}% These are ignored unless
 %% \preprintfooter{short description of paper}   % 'preprint' option specified.
 
-\title{The Way Forward in Parallelizing Dynamic Languages}
+\title{The Way Forward in Parallelising Dynamic Languages}
 \subtitle{Position Paper, ICOOOLPS'14}
 
 \authorinfo{Remigius Meier}
@@ -50,10 +50,21 @@
 \maketitle
 
 \begin{abstract}
-This is the text of the abstract.
+  Dynamic languages became very popular in recent years. At some
+  point, the need for concurrency arised, and many of them made the
+  choice to use a single global interpreter lock (GIL) to synchronize
+  the interpreter in a multithreading scenario. This choice however
+  makes it impossible to actually run code in parallel.
+
+  Here we want to compare different approaches to replacing the GIL
+  with a technology that allows parallel execution. We look at
+  fine-grained locking, shared-nothing, and transactional memory (TM)
+  approaches. We argue that software-based TM systems are the most
+  promising, especially since they also enable the introduction of
+  atomic blocks as a better synchronization mechanism in the language.
 \end{abstract}
 
-\category{CR-number}{subcategory}{third-level}
+%\category{CR-number}{subcategory}{third-level}
 
 % general terms are not compulsory anymore,
 % you may leave them out
@@ -123,6 +134,8 @@
 
 \section{Discussion}
 
+In this section we examine the approaches and highlight their
+advantages and disadvantages.
 %% \paragraph{dynamic language VM problems}
 %% XXX:
 %% - high allocation rate (short lived objects)\\
@@ -141,9 +154,9 @@
 code. While depending on this may not always be a good idea, it is
 done in practice. A GIL-replacement should therefore uphold these
 guarantees, while preferably also be as easily implementable as a GIL
-for the interpreter.
-[xxx mention that the interpreter is typically
-  very large and maintained by open-source communities]
+for the interpreter. The latter can be especially important since
+many of these languages are developed and maintained by very large
+open-source communities, which are not easy to coordinate.
 
 The GIL also allows for easy integration with external C libraries that
 may not be thread-safe. For the duration of the calls, we
@@ -343,12 +356,11 @@
 locally by a program transformation\cite{felber07}. There are attempts
 to do the same for fine-grained locking\cite{bill06} but they require
 a whole program analysis since locks are inherently non-composable.
-The effectiveness of these approaches still has to be proven for our
-use case.
-[xxx or maybe: "The effectiveness of these approaches is doubtful in our
-use case --- for example, it makes it close to impossible to order the
-locks consistently or to know in advance which locks a transaction will
-need.]
+The effectiveness of these approaches is doubtful in our use case,
+since we execute bytecode instructions in any order defined by a
+script only known at runtime. This makes it close to impossible to
+order locks consistently or to know in advance which locks a
+transaction will need.
 
 %% - overhead (100-1000\%) (barrier reference resolution, kills performance on 
low \#cpu)
 %% (FastLane: low overhead, not much gain)\\
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: change title

2014-05-05 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: extradoc
Changeset: r5228:008c9121c210
Date: 2014-05-05 10:52 +0200
http://bitbucket.org/pypy/extradoc/changeset/008c9121c210/

Log:change title

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -37,7 +37,7 @@
 %% \titlebanner{banner above paper title}% These are ignored unless
 %% \preprintfooter{short description of paper}   % 'preprint' option specified.
 
-\title{The Way Forward in Parallelising Dynamic Languages}
+\title{A Way Forward in Parallelising Dynamic Languages}
 \subtitle{Position Paper, ICOOOLPS'14}
 
 \authorinfo{Remigius Meier}
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: a few typos

2014-05-05 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: extradoc
Changeset: r5229:354573ba2558
Date: 2014-05-05 10:52 +0200
http://bitbucket.org/pypy/extradoc/changeset/354573ba2558/

Log:a few typos

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -51,8 +51,8 @@
 
 \begin{abstract}
   Dynamic languages became very popular in recent years. At some
-  point, the need for concurrency arised, and many of them made the
-  choice to use a single global interpreter lock (GIL) to synchronize
+  point, the need for concurrency arose, and many of them made the
+  choice to use a single global interpreter lock (GIL) to synchronise
   the interpreter in a multithreading scenario. This choice however
   makes it impossible to actually run code in parallel.
 
@@ -61,7 +61,7 @@
   fine-grained locking, shared-nothing, and transactional memory (TM)
   approaches. We argue that software-based TM systems are the most
   promising, especially since they also enable the introduction of
-  atomic blocks as a better synchronization mechanism in the language.
+  atomic blocks as a better synchronisation mechanism in the language.
 \end{abstract}
 
 %\category{CR-number}{subcategory}{third-level}
@@ -116,9 +116,9 @@
 %% designed with GIL semantics in mind.
 
 %% Furthermore, a solution to this problem should also bring better
-%% synchronization mechanism with it...
+%% synchronisation mechanism with it...
 
-%% (supporting (large) atomic blocks for synchronization)
+%% (supporting (large) atomic blocks for synchronisation)
 
 %% \subsection{Our Position}
 %% Current solutions for replacing the GIL include STM, HTM, and
@@ -144,8 +144,8 @@
 
 \subsection{Why is there a GIL?}
 The GIL is a very simple synchronisation mechanism for supporting
-multithreading in the interpreter. The basic guarantee is that the GIL
-may only be released in-between bytecode instructions. The interpreter
+multithreading in an interpreter. The basic guarantee is that the GIL
+may only be released in between bytecode instructions. The interpreter
 can thus rely on complete isolation and atomicity of these
 instructions. Additionally, it provides the application with a
 sequential consistency model\cite{lamport79}. As a consequence,
@@ -413,7 +413,7 @@
 are executing a program only known at runtime. Additionally, replacing
 the GIL means running every part of the application in transactions,
 so there is not much code that can run outside and that can be
-optimized better. The performance of the TM system is vital.
+optimised better. The performance of the TM system is vital.
 
 One way to get more performance is to develop STM systems that make
 better use of low-level features in existing OS kernels.  We are
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: use a ~ (non-breaking space) before citations

2014-05-05 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: extradoc
Changeset: r5230:9753ced909e1
Date: 2014-05-05 10:53 +0200
http://bitbucket.org/pypy/extradoc/changeset/9753ced909e1/

Log:use a ~ (non-breaking space) before citations

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -148,7 +148,7 @@
 may only be released in between bytecode instructions. The interpreter
 can thus rely on complete isolation and atomicity of these
 instructions. Additionally, it provides the application with a
-sequential consistency model\cite{lamport79}. As a consequence,
+sequential consistency model~\cite{lamport79}. As a consequence,
 applications can rely on certain operations to be atomic and that they
 will always be executed in the order in which they appear in the
 code. While depending on this may not always be a good idea, it is
@@ -226,7 +226,7 @@
 single-threaded case compared to the GIL, which requires much less
 acquire-release operations.
 
-Jython\cite{webjython} is one project that implements an
+Jython~\cite{webjython} is one project that implements an
 interpreter for Python on the JVM\footnote{Java Virtual Machine} and
 that uses fine-grained locking to correctly synchronise the
 interpreter. For a language like Python, one needs quite a few,
@@ -298,7 +298,7 @@
 desktop CPUs from Intel (Haswell generation).
 
 \paragraph{HTM} provides us with transactions like any TM system does.
-It can be used as a direct replacement for the 
GIL\cite{nicholas06,odaira14,fuad10}. However, as is
+It can be used as a direct replacement for the 
GIL~\cite{nicholas06,odaira14,fuad10}. However, as is
 common with hardware-only solutions, there are quite a few limitations
 that can not be lifted easily. For this comparison, we look at the
 implementation of Intel in recent Haswell generation CPUs.
@@ -308,13 +308,13 @@
 importantly it limits the amount of memory that can be accessed within
 a transaction. This transaction-length limitation makes it necessary
 to have a fallback in place in case this limit is reached. In recent
-attempts, the usual fallback is the GIL\cite{odaira14,fuad10}. In our
+attempts, the usual fallback is the GIL~\cite{odaira14,fuad10}. In our
 experiments, the current generation of HTM proved to be very fragile
 and thus needing the fallback very often. Consequently, scalability
 suffered a lot from this.
 
 The performance of HTM is pretty good as it does not introduce much
-overhead ($<40\%$ overhead\cite{odaira14}). And it can transparently
+overhead ($<40\%$ overhead~\cite{odaira14}). And it can transparently
 parallelise existing applications to some degree. The implementation
 is very straight-forward because it directly replaces the GIL in a
 central place. HTM is also directly compatible with any external
@@ -332,11 +332,11 @@
 
 \paragraph{STM} provides all the same benefits as HTM except for its
 performance.  It is not unusual for the overhead introduced by STM to
-be between 100\% to even 1000\% \cite{cascaval08,drago11}. While STM
+be between 100\% to even 1000\% ~\cite{cascaval08,drago11}. While STM
 systems often scale very well to a big number of threads and
 eventually overtake the single-threaded execution, they often provide
 no benefits at all for low numbers of threads (1-8). There are some
-attempts \cite{warmhoff13,spear09} that can reduce the overhead a lot,
+attempts ~\cite{warmhoff13,spear09} that can reduce the overhead a lot,
 but scale badly or only for certain workloads. Often the benefits
 on more than one thread are too little in real world applications.
 
@@ -353,8 +353,8 @@
 
 While one can argue that STM requires the insertion of read and write
 barriers in the whole program, this can be done automatically and
-locally by a program transformation\cite{felber07}. There are attempts
-to do the same for fine-grained locking\cite{bill06} but they require
+locally by a program transformation~\cite{felber07}. There are attempts
+to do the same for fine-grained locking~\cite{bill06} but they require
 a whole program analysis since locks are inherently non-composable.
 The effectiveness of these approaches is doubtful in our use case,
 since we execute bytecode instructions in any order defined by a
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c7: add real stmcb_commit_soon()

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c7
Changeset: r71275:cce0ed9a775c
Date: 2014-05-05 10:57 +0200
http://bitbucket.org/pypy/pypy/changeset/cce0ed9a775c/

Log:add real stmcb_commit_soon()

diff --git a/rpython/translator/stm/src_stm/stmgcintf.c 
b/rpython/translator/stm/src_stm/stmgcintf.c
--- a/rpython/translator/stm/src_stm/stmgcintf.c
+++ b/rpython/translator/stm/src_stm/stmgcintf.c
@@ -23,6 +23,16 @@
 pypy_stmcb_trace(obj, (void(*)(void*))visit);
 }
 
+inline void stmcb_commit_soon()
+{
+if (pypy_stm_nursery_low_fill_mark == (uintptr_t)-1) {
+/* atomic */
+pypy_stm_nursery_low_fill_mark_saved = 0;
+} else {
+pypy_stm_nursery_low_fill_mark >>= 2;
+}
+}
+
 
 //
 /* "include" the stmgc.c file here */
@@ -147,7 +157,7 @@
transaction.
  */
 assert(pypy_stm_nursery_low_fill_mark != (uintptr_t) -1);
-assert((STM_SEGMENT->jmpbuf_ptr == NULL) ==
+assert(!(STM_SEGMENT->jmpbuf_ptr == NULL) ||
(pypy_stm_nursery_low_fill_mark == 0));
 
 stm_commit_transaction();
@@ -182,7 +192,7 @@
transaction whose jmpbuf points into this function
 */
 if (pypy_stm_ready_atomic == 1) {
-assert(pypy_stm_nursery_low_fill_mark != 0);
+//assert(pypy_stm_nursery_low_fill_mark != 0);
 assert(pypy_stm_nursery_low_fill_mark != (uintptr_t) -1);
 stm_commit_transaction();
 pypy_stm_nursery_low_fill_mark = 0;
@@ -196,7 +206,7 @@
 }
 /* double-check */
 if (pypy_stm_ready_atomic == 1) {
-assert((STM_SEGMENT->jmpbuf_ptr == NULL) ==
+assert(!(STM_SEGMENT->jmpbuf_ptr == NULL) ||
(pypy_stm_nursery_low_fill_mark == 0));
 }
 else {
@@ -234,5 +244,3 @@
 _pypy_stm_inev_state();
 stm_become_globally_unique_transaction(&stm_thread_local, "for the JIT");
 }
-
-void stmcb_commit_soon(void) { /*XXX FIXME*/ }
diff --git a/rpython/translator/stm/src_stm/stmgcintf.h 
b/rpython/translator/stm/src_stm/stmgcintf.h
--- a/rpython/translator/stm/src_stm/stmgcintf.h
+++ b/rpython/translator/stm/src_stm/stmgcintf.h
@@ -73,7 +73,7 @@
 case 1:
 pypy_stm_nursery_low_fill_mark = pypy_stm_nursery_low_fill_mark_saved;
 assert(pypy_stm_nursery_low_fill_mark != (uintptr_t) -1);
-assert((STM_SEGMENT->jmpbuf_ptr == NULL) ==
+assert(!(STM_SEGMENT->jmpbuf_ptr == NULL) ||
(pypy_stm_nursery_low_fill_mark == 0));
 break;
 case 0:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: a few tweaks, a few places where more citations are needed

2014-05-05 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: extradoc
Changeset: r5231:6698e6fce68f
Date: 2014-05-05 12:09 +0200
http://bitbucket.org/pypy/extradoc/changeset/6698e6fce68f/

Log:a few tweaks, a few places where more citations are needed

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -10,8 +10,19 @@
 
 \usepackage[utf8]{inputenc}
 \usepackage{array}
+\usepackage{color}
 \usepackage{hyperref}
 \usepackage{amsmath}
+\usepackage{amssymb}
+
+\newcommand{\mynote}[2]{%
+  \textcolor{red}{%
+\fbox{\bfseries\sffamily\scriptsize#1}%
+{\small$\blacktriangleright$\textsf{\emph{#2}}$\blacktriangleleft$}%
+  }%
+}
+
+\newcommand\cfbolz[1]{\mynote{Carl Friedrich}{#1}}
 
 \begin{document}
 
@@ -174,11 +185,12 @@
 it is not exposed to the application running on top of it. To
 synchronise memory accesses in applications using threads, the
 state-of-the-art still means explicit locking everywhere. It is well
-known that using locks for synchronisation is not easy.  They are
+known that using locks for synchronisation is not easy\cfbolz{citation needed
+:-). would be cool if you could find something}.  They are
 non-composable, have overhead, may deadlock, limit scalability, and
-overall add a lot of complexity. For a better parallel programming
+overall add a lot of complexity\cfbolz{same here, really}. For a better 
parallel programming
 model for dynamic languages, we propose another, well-known
-synchronisation mechanism called \emph{atomic blocks}.
+synchronisation mechanism called \emph{atomic blocks}\cfbolz{and here}.
 
 Atomic blocks are composable, deadlock-free, higher-level and expose
 useful atomicity and isolation guarantees to the application for a
@@ -199,7 +211,7 @@
 
 \begin{description}
 \item[Performance:] How well does the approach perform compared to the
-  GIL on single and multiple threads?
+  GIL on a single and on multiple threads?
 \item[Existing applications:] How big are the changes required to
   integrate with and parallelise existing applications?
 \item[Better synchronisation:] Does the approach enable better
@@ -243,6 +255,7 @@
 It does however not provide a better synchronisation
 mechanism to the application like e.g. atomic blocks.
 
+\cfbolz{I think you should mention the commented out point below, that a lot 
of existing code contains latent races / deadlocks that are just not exposed in 
a GIL-full world}
 %% - support of atomic blocks?\\
 %% - hard to get right (deadlocks, performance, lock-granularity)\\
 %% - very hard to get right for a large language\\
@@ -295,7 +308,7 @@
 capabilities as software-only approaches but with different
 performance characteristics. We will now first look at HTM, which
 recently gained a lot of popularity by its introduction in common
-desktop CPUs from Intel (Haswell generation).
+desktop CPUs from Intel (Haswell generation).\cfbolz{citation}
 
 \paragraph{HTM} provides us with transactions like any TM system does.
 It can be used as a direct replacement for the 
GIL~\cite{nicholas06,odaira14,fuad10}. However, as is
@@ -341,7 +354,7 @@
 on more than one thread are too little in real world applications.
 
 However, STM compared to HTM does not suffer from the same restricting
-limitations. Transactions can be arbitrarily long.  This makes it
+limitations. Transactions can in principle be arbitrarily long.  This makes it
 possible to actually expose transactions to the application in the
 form of atomic blocks. This is the only approach that enables a better
 synchronisation mechanism than locks for applications \emph{and} still
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: move the table up, to force latex to put it into a sensible place

2014-05-05 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: extradoc
Changeset: r5232:8a17d33447d1
Date: 2014-05-05 12:11 +0200
http://bitbucket.org/pypy/extradoc/changeset/8a17d33447d1/

Log:move the table up, to force latex to put it into a sensible place

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -143,6 +143,31 @@
 %% language.  STM is the best way forward but has bad performance, so we
 %% fix that.
 
+
+\begin{table*}[ht]
+  \centering
+  \begin{tabular}{|l|c|c|c|c|c|}
+\hline
+& \textbf{GIL} & \textbf{Fine-grained locking}
+& \textbf{Shared-nothing} & \textbf{HTM} & \textbf{STM}\\
+\hline
+Performance (single threaded) & ++   & +  & ++   & ++ & -{-} \\
+\hline
+Performance (multithreaded)   & -{-} & +  & +& +  & +\\
+\hline
+Existing applications & ++   & ++ & -{-} & ++ & ++   \\
+\hline
+Better synchronisation& -& -  & -& -  & ++   \\
+\hline
+Implementation& ++   & -  & ++   & ++ & ++   \\
+\hline
+External libraries& ++   & ++ & ++   & ++ & ++   \\
+\hline
+  \end{tabular}
+  \caption{Comparison between the approaches (-{-}/-/o/+/++)}
+  \label{tab:comparison}
+\end{table*}
+
 \section{Discussion}
 
 In this section we examine the approaches and highlight their
@@ -383,30 +408,6 @@
 
 \section{The Way Forward}
 
-\begin{table*}[h]
-  \centering
-  \begin{tabular}{|l|c|c|c|c|c|}
-\hline
-& \textbf{GIL} & \textbf{Fine-grained locking}
-& \textbf{Shared-nothing} & \textbf{HTM} & \textbf{STM}\\
-\hline
-Performance (single threaded) & ++   & +  & ++   & ++ & -{-} \\
-\hline
-Performance (multithreaded)   & -{-} & +  & +& +  & +\\
-\hline
-Existing applications & ++   & ++ & -{-} & ++ & ++   \\
-\hline
-Better synchronisation& -& -  & -& -  & ++   \\
-\hline
-Implementation& ++   & -  & ++   & ++ & ++   \\
-\hline
-External libraries& ++   & ++ & ++   & ++ & ++   \\
-\hline
-  \end{tabular}
-  \caption{Comparison between the approaches (-{-}/-/o/+/++)}
-  \label{tab:comparison}
-\end{table*}
-
 
 Following the above argumentation for each approach we assembled a
 general overview in Table \ref{tab:comparison}. The general picture is
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Move this check earlier (random attempt to avoid SIGILL on very very old x86 machines)

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r71276:3484aaa1e858
Date: 2014-05-05 12:52 +0200
http://bitbucket.org/pypy/pypy/changeset/3484aaa1e858/

Log:Move this check earlier (random attempt to avoid SIGILL on very very
old x86 machines)

diff --git a/rpython/translator/c/src/entrypoint.c 
b/rpython/translator/c/src/entrypoint.c
--- a/rpython/translator/c/src/entrypoint.c
+++ b/rpython/translator/c/src/entrypoint.c
@@ -35,9 +35,6 @@
 
pypy_g_rpython_rtyper_lltypesystem_rffi_StackCounter.sc_inst_stacks_counter++;
 #endif
 pypy_asm_stack_bottom();
-#ifdef PYPY_X86_CHECK_SSE2_DEFINED
-pypy_x86_check_sse2();
-#endif
 instrument_setup();
 
 #ifndef MS_WINDOWS
@@ -83,6 +80,9 @@
 
 int PYPY_MAIN_FUNCTION(int argc, char *argv[])
 {
+#ifdef PYPY_X86_CHECK_SSE2_DEFINED
+pypy_x86_check_sse2();
+#endif
 return pypy_main_function(argc, argv);
 }
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: more citations

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5233:9c837c7672df
Date: 2014-05-05 13:41 +0200
http://bitbucket.org/pypy/extradoc/changeset/9c837c7672df/

Log:more citations

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -157,7 +157,7 @@
 \hline
 Existing applications & ++   & ++ & -{-} & ++ & ++   \\
 \hline
-Better synchronisation& -& -  & -& -  & ++   \\
+Better synchronisation& o& o  & o& -  & ++   \\
 \hline
 Implementation& ++   & -  & ++   & ++ & ++   \\
 \hline
@@ -210,12 +210,13 @@
 it is not exposed to the application running on top of it. To
 synchronise memory accesses in applications using threads, the
 state-of-the-art still means explicit locking everywhere. It is well
-known that using locks for synchronisation is not easy\cfbolz{citation needed
-:-). would be cool if you could find something}.  They are
-non-composable, have overhead, may deadlock, limit scalability, and
-overall add a lot of complexity\cfbolz{same here, really}. For a better 
parallel programming
+known that using locks for synchronisation is not
+easy~\cite{christopher10,victor11,shan08}. They are non-composable,
+have overhead, may deadlock, limit scalability, and add to the overall
+complexity of the program logic. For a better parallel programming
 model for dynamic languages, we propose another, well-known
-synchronisation mechanism called \emph{atomic blocks}\cfbolz{and here}.
+synchronisation mechanism called \emph{atomic
+  blocks}~\cite{tim03,tim05}.
 
 Atomic blocks are composable, deadlock-free, higher-level and expose
 useful atomicity and isolation guarantees to the application for a
@@ -522,6 +523,34 @@
   correctly executes multiprocess programs." \emph{Computers, IEEE
 Transactions} on 100.9 (1979): 690-691.
 
+\bibitem{victor11}
+  Victor Pankratius and Ali-Reza Adl-Tabatabai. 2011. A study of
+  transactional memory vs. locks in practice. In \emph{Proceedings of
+the twenty-third annual ACM symposium on Parallelism in algorithms
+and architectures} (SPAA '11). ACM, New York, NY, USA
+
+\bibitem{christopher10}
+  Christopher J. Rossbach, Owen S. Hofmann, and Emmett
+  Witchel. 2010. Is transactional programming actually
+  easier?. \emph{SIGPLAN} Not. 45, 5 (January 2010), 47-56.
+
+\bibitem{tim03}
+  Tim Harris and Keir Fraser. 2003. Language support for lightweight
+  transactions. \emph{In Proceedings of the 18th annual ACM SIGPLAN
+conference on Object-oriented programing, systems, languages, and
+applications} (OOPSLA '03).
+
+\bibitem{tim05}
+  Tim Harris, Simon Marlow, Simon Peyton-Jones, and Maurice
+  Herlihy. 2005. Composable memory transactions. \emph{In Proceedings
+of the tenth ACM SIGPLAN symposium on Principles and practice of
+parallel programming} (PPoPP '05).
+
+\bibitem{shan08}
+  Shan Lu, Soyeon Park, Eunsoo Seo, and Yuanyuan Zhou. 2008. Learning
+  from mistakes: a comprehensive study on real world concurrency bug
+  characteristics. \emph{SIGARCH Comput. Archit. News} 36, 1 (March 2008),
+  329-339.
 
 \end{thebibliography}
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: another comment

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5234:18ba53e1a5b4
Date: 2014-05-05 13:54 +0200
http://bitbucket.org/pypy/extradoc/changeset/18ba53e1a5b4/

Log:another comment

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -274,14 +274,15 @@
 however be very simple too. One could simply use one lock per library
 to avoid this issue.
 
-In the end, fine-grained locking can transparently replace the GIL
-and therefore parallelise existing applications, generally without any
+In the end, fine-grained locking can transparently replace the GIL and
+therefore parallelise existing applications, generally without any
 changes\footnote{There are rare cases where not having atomic
-bytecodes actually changes the semantics.}
-It does however not provide a better synchronisation
-mechanism to the application like e.g. atomic blocks.
+  bytecodes actually changes the semantics.}. An implementation has to
+follow the GIL semantics very closely, otherwise it may expose some
+latent data races in existing applications which are just not exposed
+with a GIL. This approach does however not provide a better parallelising
+synchronisation mechanism to the application like e.g. atomic blocks.
 
-\cfbolz{I think you should mention the commented out point below, that a lot 
of existing code contains latent races / deadlocks that are just not exposed in 
a GIL-full world}
 %% - support of atomic blocks?\\
 %% - hard to get right (deadlocks, performance, lock-granularity)\\
 %% - very hard to get right for a large language\\
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: another citation

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5235:09622858923e
Date: 2014-05-05 13:57 +0200
http://bitbucket.org/pypy/extradoc/changeset/09622858923e/

Log:another citation

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -335,7 +335,7 @@
 capabilities as software-only approaches but with different
 performance characteristics. We will now first look at HTM, which
 recently gained a lot of popularity by its introduction in common
-desktop CPUs from Intel (Haswell generation).\cfbolz{citation}
+desktop CPUs from Intel (Haswell generation)~\cite{odaira14,leis14}.
 
 \paragraph{HTM} provides us with transactions like any TM system does.
 It can be used as a direct replacement for the 
GIL~\cite{nicholas06,odaira14,fuad10}. However, as is
@@ -553,6 +553,11 @@
   characteristics. \emph{SIGARCH Comput. Archit. News} 36, 1 (March 2008),
   329-339.
 
+\bibitem{leis14}
+  Leis, Viktor, Alfons Kemper, and Thomas Neumann. "Exploiting
+  Hardware Transactional Memory in Main-Memory Databases."
+  \emph{Proc. of ICDE}. 2014.
+
 \end{thebibliography}
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Correctly reset the state between iterations. Before this change, successive iterations would take slightly longer and

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r71277:c1d1f4dd5f5f
Date: 2014-05-05 13:58 +0200
http://bitbucket.org/pypy/pypy/changeset/c1d1f4dd5f5f/

Log:Correctly reset the state between iterations. Before this change,
successive iterations would take slightly longer and longer to
execute, with no bound; roughly 2-4% slower every 500 iterations.

diff --git a/rpython/translator/goal/richards.py 
b/rpython/translator/goal/richards.py
--- a/rpython/translator/goal/richards.py
+++ b/rpython/translator/goal/richards.py
@@ -144,6 +144,9 @@
 
 class TaskWorkArea(object):
 def __init__(self):
+self.reset()
+
+def reset(self):
 self.taskTab = [None] * TASKTABSIZE
 
 self.taskList = None
@@ -151,7 +154,6 @@
 self.holdCount = 0
 self.qpktCount = 0
 
-taskWorkArea = TaskWorkArea()
 
 class Task(TaskState):
 
@@ -361,8 +363,7 @@
 
 def run(self, iterations):
 for i in xrange(iterations):
-taskWorkArea.holdCount = 0
-taskWorkArea.qpktCount = 0
+taskWorkArea.reset()
 
 IdleTask(I_IDLE, 1, 1, TaskState().running(), IdleTaskRec())
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: at least give HTM a 0 too

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5236:788db02a12d7
Date: 2014-05-05 13:59 +0200
http://bitbucket.org/pypy/extradoc/changeset/788db02a12d7/

Log:at least give HTM a 0 too

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -157,7 +157,7 @@
 \hline
 Existing applications & ++   & ++ & -{-} & ++ & ++   \\
 \hline
-Better synchronisation& o& o  & o& -  & ++   \\
+Better synchronisation& o& o  & o& o  & ++   \\
 \hline
 Implementation& ++   & -  & ++   & ++ & ++   \\
 \hline
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] benchmarks default: Update to use the new 'atomic' module

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r256:be0306e43d45
Date: 2014-05-03 13:46 +0200
http://bitbucket.org/pypy/benchmarks/changeset/be0306e43d45/

Log:Update to use the new 'atomic' module

diff --git a/multithread/common/abstract_threading.py 
b/multithread/common/abstract_threading.py
--- a/multithread/common/abstract_threading.py
+++ b/multithread/common/abstract_threading.py
@@ -2,12 +2,7 @@
 from threading import Thread, Condition, Lock, local
 import thread, atexit, sys, time
 
-try:
-from __pypy__.thread import atomic, getsegmentlimit
-except ImportError:
-atomic = Lock()
-def getsegmentlimit():
-return 1
+from atomic import atomic, getsegmentlimit, print_abort_info
 
 
 class TLQueue_concurrent(object):
diff --git a/multithread/threadworms/threadworms.py 
b/multithread/threadworms/threadworms.py
--- a/multithread/threadworms/threadworms.py
+++ b/multithread/threadworms/threadworms.py
@@ -6,7 +6,7 @@
 # This is meant to be an educational example of multithreaded programming,
 # so I get kind of verbose in the comments.
 
-from common.abstract_threading import atomic, Future
+from common.abstract_threading import atomic, Future, print_abort_info
 import time
 import random, sys, threading
 
@@ -61,6 +61,7 @@
 self.direction = self.rnd.choice((UP, DOWN, LEFT, RIGHT))
 
 with atomic:
+print_abort_info(0.01)
 # GRID_LOCK.acquire() # don't return (that is, block) until 
this thread can acquire the lock
 
 nextx, nexty = self.getNextPosition()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] benchmarks default: Fix the multithreaded richards as done in c1d1f4dd5f5f for translator/goal/richards.py.

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r257:d047b054ff7f
Date: 2014-05-05 14:15 +0200
http://bitbucket.org/pypy/benchmarks/changeset/d047b054ff7f/

Log:Fix the multithreaded richards as done in c1d1f4dd5f5f for
translator/goal/richards.py.

diff --git a/multithread/multithread-richards.py 
b/multithread/multithread-richards.py
--- a/multithread/multithread-richards.py
+++ b/multithread/multithread-richards.py
@@ -370,7 +370,6 @@
 def __init__(self):
 self.finished_lock = thread.allocate_lock()
 self.finished_lock.acquire()
-self.taskWorkArea = TaskWorkArea()
 
 def run_and_unlock(self, to_do):
 os.write(1, 'running...\n')
@@ -382,15 +381,14 @@
 except IndexError:
 break
 iterations += 1
-self.result = self.run(self.taskWorkArea)
+self.result = self.run()
 os.write(1, 'done, iterations=%d, result=%r\n' % (iterations, 
self.result))
 self.finished_lock.release()
 
-def run(self, taskWorkArea):
+def run(self):
 #with atomic:
 if 1:
-taskWorkArea.holdCount = 0
-taskWorkArea.qpktCount = 0
+taskWorkArea = TaskWorkArea()
 
 IdleTask(I_IDLE, 1, 1, TaskState().running(), IdleTaskRec(),
  taskWorkArea)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: emphasize atomic block parallelisation

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5237:458ea996a081
Date: 2014-05-05 14:17 +0200
http://bitbucket.org/pypy/extradoc/changeset/458ea996a081/

Log:emphasize atomic block parallelisation

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -119,7 +119,7 @@
 overall winner. While it has a big performance problem currently, it
 gets more points in all the other categories. We think that it is the
 only solution that also provides a better synchronisation mechanism to
-the application in the form of atomic blocks.
+the application in the form of paralleliseable atomic blocks.
 
 %% \subsection{Issue}
 %% The issue that we want to discuss is how to efficiently support
@@ -209,9 +209,9 @@
 Since the GIL is mostly an implementation detail of the interpreter,
 it is not exposed to the application running on top of it. To
 synchronise memory accesses in applications using threads, the
-state-of-the-art still means explicit locking everywhere. It is well
-known that using locks for synchronisation is not
-easy~\cite{christopher10,victor11,shan08}. They are non-composable,
+state-of-the-art still means explicit locking everywhere. It is
+known that using locks for synchronisation can be hard at
+times~\cite{christopher10,victor11,shan08}. They are non-composable,
 have overhead, may deadlock, limit scalability, and add to the overall
 complexity of the program logic. For a better parallel programming
 model for dynamic languages, we propose another, well-known
@@ -220,12 +220,12 @@
 
 Atomic blocks are composable, deadlock-free, higher-level and expose
 useful atomicity and isolation guarantees to the application for a
-series of instructions.  Interpreters using a GIL can simply guarantee
+series of instructions. Interpreters using a GIL can simply guarantee
 that the GIL is not released during the execution of the atomic
 block. Of course, this still means that no two atomic blocks can
-execute in parallel or even concurrently. Potential solutions that
-provide a good way to implement atomic blocks are therefore
-preferable.
+execute in parallel or even concurrently.  Potential solutions are
+preferable if they provide a good way to implement atomic blocks that
+are also able to be executed in parallel.
 
 
 
@@ -240,7 +240,7 @@
   GIL on a single and on multiple threads?
 \item[Existing applications:] How big are the changes required to
   integrate with and parallelise existing applications?
-\item[Better synchronisation:] Does the approach enable better
+\item[Better synchronisation:] Does the approach enable better, paralleliseable
   synchronisation mechanisms for applications (e.g. atomic blocks)?
 \item[Implementation:] How difficult is it to implement the approach
   in the interpreter?
@@ -362,7 +362,7 @@
 multiple threads. The one thing that is missing is support for a
 better synchronisation mechanism for the application. It is not
 possible in general to expose the hardware-transactions to the
-application in the form of atomic blocks because that would require
+application in the form of atomic blocks, because that would require
 much longer transactions.
 
 %% - false-sharing on cache-line level\\
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: add pdf

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5238:642543cf5085
Date: 2014-05-05 14:17 +0200
http://bitbucket.org/pypy/extradoc/changeset/642543cf5085/

Log:add pdf

diff --git a/talk/icooolps2014/position-paper.pdf 
b/talk/icooolps2014/position-paper.pdf
new file mode 100644
index 
..8a9a6a4ac4f35959a4eec538ef2bc6d20ef057b1
GIT binary patch

[cut]

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] benchmarks default: extend mandelbrot.py

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: 
Changeset: r258:f7ba852bdc89
Date: 2014-05-05 15:27 +0200
http://bitbucket.org/pypy/benchmarks/changeset/f7ba852bdc89/

Log:extend mandelbrot.py

diff --git a/multithread/mandelbrot/mandelbrot.py 
b/multithread/mandelbrot/mandelbrot.py
--- a/multithread/mandelbrot/mandelbrot.py
+++ b/multithread/mandelbrot/mandelbrot.py
@@ -52,23 +52,25 @@
 return res
 
 
-def run(threads=2):
+def run(threads=2, stripes=16):
 threads = int(threads)
+stripes = int(stripes)
+assert stripes >= threads
 ar, ai = -2.0, -1.5
 br, bi = 1.0, 1.5
 width, height = 4096, 4096
 
 set_thread_pool(ThreadPool(threads))
-step = (bi - ai) / threads
+step = (bi - ai) / stripes
 res = []
 ai = -1.5
 bi = ai + step
 parallel_time = time.time()
-for i in xrange(threads):
+for i in xrange(stripes):
 res.append(Future(calculate,
   a=(ar, ai + i * step),
   b=(br, bi + i * step),
-  im_size=(width, int(height / threads))
+  im_size=(width, int(height / stripes))
 ))
 
 res = [f() for f in res]
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Tweaks tweaks tweaks

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5239:fbc8c4259336
Date: 2014-05-05 16:11 +0200
http://bitbucket.org/pypy/extradoc/changeset/fbc8c4259336/

Log:Tweaks tweaks tweaks

diff --git a/talk/icooolps2014/position-paper.pdf 
b/talk/icooolps2014/position-paper.pdf
index 
8a9a6a4ac4f35959a4eec538ef2bc6d20ef057b1..d0e11f70c50dc0b0e812b86a8ade78182e267737
GIT binary patch

[cut]

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -72,7 +72,8 @@
   fine-grained locking, shared-nothing, and transactional memory (TM)
   approaches. We argue that software-based TM systems are the most
   promising, especially since they also enable the introduction of
-  atomic blocks as a better synchronisation mechanism in the language.
+  large, parallelisable atomic blocks as a better synchronisation
+  mechanism in the language.
 \end{abstract}
 
 %\category{CR-number}{subcategory}{third-level}
@@ -111,7 +112,7 @@
 The approach that wins in the end should perform similarly for
 single-threaded execution as compared to the GIL and be able to
 execute code in parallel on multiple cores. Furthermore, we will also
-take into account the compatibility to existing code that already uses
+take into account the compatibility with existing code that may already use
 threads for concurrency, as well as the changes that are required to
 the interpreter itself.
 
@@ -119,7 +120,7 @@
 overall winner. While it has a big performance problem currently, it
 gets more points in all the other categories. We think that it is the
 only solution that also provides a better synchronisation mechanism to
-the application in the form of paralleliseable atomic blocks.
+the application in the form of parallelisable atomic blocks.
 
 %% \subsection{Issue}
 %% The issue that we want to discuss is how to efficiently support
@@ -157,7 +158,7 @@
 \hline
 Existing applications & ++   & ++ & -{-} & ++ & ++   \\
 \hline
-Better synchronisation& o& o  & o& o  & ++   \\
+Better synchronisation& o& o  &  & o  & ++   \\
 \hline
 Implementation& ++   & -  & ++   & ++ & ++   \\
 \hline
@@ -265,11 +266,13 @@
 acquire-release operations.
 
 Jython~\cite{webjython} is one project that implements an
-interpreter for Python on the JVM\footnote{Java Virtual Machine} and
-that uses fine-grained locking to correctly synchronise the
+interpreter for Python on the Java Virtual Machine (JVM) and
+that uses fine-grained locking\footnote{The performance impact of
+fine-grained locking is milder in Java than it would be in a typical piece
+of C code; see e.g.~\cite{biased}.} to correctly synchronise the
 interpreter. For a language like Python, one needs quite a few,
 carefully placed locks. Since there is no central location, the
-complexity of the implementation is quite a bit greater compared to
+complexity of the implementation is quite a bit larger compared to
 using a GIL. Integrating external, non-thread-safe libraries should
 however be very simple too. One could simply use one lock per library
 to avoid this issue.
@@ -296,25 +299,25 @@
 to replace it. If an application can be split into completely
 independent parts that only very rarely need to share anything, or
 only do so via an external program like a database, then it is
-sensible to have one GIL per independent part. As an example of such
-an approach we look at the
+sensible to have one GIL per independent part. At the extreme, there
+are applications that parallelise perfectly simply by running
+independent processes; some web servers and some numeric computations
+do. We will consider here a slightly more general approach: the
 
\emph{multiprocessing}\footnote{https://docs.python.org/2/library/multiprocessing.html}
 module of Python. In essence, it uses process-forking to provide the
 application with multiple interpreters that can run in parallel.
 Communication is then done explicitly through pipes.
 
-Obviously not every application fits well into this model and its
-applicability is therefore quite limited. Performance is good as
+The model of explicit communication is sometimes seen as a superior
+way to synchronise concurrent applications because of its explicitness.
+However, not every application fits well into this model and its
+applicability is therefore limited. Performance is good as
 long as the application does not need to communicate a lot, because
 inter-process communication is relatively expensive. Also the
 implementation of this approach is very cheap since one can
 actually take an unmodified GIL-supported interpreter and run
-multiple of them in parallel. That way, we also inherit the
+several of them in parallel. That way, we also inherit the
 easy integration of external libraries without any changes.
-While the model of explicit communication is often seen as a

[pypy-commit] pypy default: Fix

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r71278:1034226b87f2
Date: 2014-05-05 16:24 +0200
http://bitbucket.org/pypy/pypy/changeset/1034226b87f2/

Log:Fix

diff --git a/rpython/translator/c/src/entrypoint.c 
b/rpython/translator/c/src/entrypoint.c
--- a/rpython/translator/c/src/entrypoint.c
+++ b/rpython/translator/c/src/entrypoint.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Move the table to page 3.

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5240:11071f8ef812
Date: 2014-05-05 16:31 +0200
http://bitbucket.org/pypy/extradoc/changeset/11071f8ef812/

Log:Move the table to page 3.

diff --git a/talk/icooolps2014/position-paper.pdf 
b/talk/icooolps2014/position-paper.pdf
index 
d0e11f70c50dc0b0e812b86a8ade78182e267737..61eddb1d20c2838e3b9a63f29aa5080dbda0a2aa
GIT binary patch

[cut]

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -145,30 +145,6 @@
 %% fix that.
 
 
-\begin{table*}[ht]
-  \centering
-  \begin{tabular}{|l|c|c|c|c|c|}
-\hline
-& \textbf{GIL} & \textbf{Fine-grained locking}
-& \textbf{Shared-nothing} & \textbf{HTM} & \textbf{STM}\\
-\hline
-Performance (single threaded) & ++   & +  & ++   & ++ & -{-} \\
-\hline
-Performance (multithreaded)   & -{-} & +  & +& +  & +\\
-\hline
-Existing applications & ++   & ++ & -{-} & ++ & ++   \\
-\hline
-Better synchronisation& o& o  &  & o  & ++   \\
-\hline
-Implementation& ++   & -  & ++   & ++ & ++   \\
-\hline
-External libraries& ++   & ++ & ++   & ++ & ++   \\
-\hline
-  \end{tabular}
-  \caption{Comparison between the approaches (-{-}/-/o/+/++)}
-  \label{tab:comparison}
-\end{table*}
-
 \section{Discussion}
 
 In this section we examine the approaches and highlight their
@@ -230,6 +206,32 @@
 
 
 
+\begin{table*}[ht]
+  \centering
+  \begin{tabular}{|l|c|c|c|c|c|}
+\hline
+& \textbf{GIL} & \textbf{Fine-grained locking}
+& \textbf{Shared-nothing} & \textbf{HTM} & \textbf{STM}\\
+\hline
+Performance (single threaded) & ++   & +  & ++   & ++ & -{-} \\
+\hline
+Performance (multithreaded)   & -{-} & +  & +& +  & +\\
+\hline
+Existing applications & ++   & ++ & -{-} & ++ & ++   \\
+\hline
+Better synchronisation& o& o  &  & o  & ++   \\
+\hline
+Implementation& ++   & -  & ++   & ++ & ++   \\
+\hline
+External libraries& ++   & ++ & ++   & ++ & ++   \\
+\hline
+  \end{tabular}
+  \caption{Comparison between the approaches (-{-}/-/o/+/++)}
+  \label{tab:comparison}
+\end{table*}
+
+
+
 \subsection{Potential Solutions}
 
 For the discussion we define a set of criteria to evaluate the
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: add concluding sentence

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: extradoc
Changeset: r5241:379da0f357d3
Date: 2014-05-05 17:00 +0200
http://bitbucket.org/pypy/extradoc/changeset/379da0f357d3/

Log:add concluding sentence

diff --git a/talk/icooolps2014/position-paper.pdf 
b/talk/icooolps2014/position-paper.pdf
index 
61eddb1d20c2838e3b9a63f29aa5080dbda0a2aa..d50af6d75293ebca7607edd49d1c57321cf7e97f
GIT binary patch

[cut]

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -417,7 +417,7 @@
 \section{The Way Forward}
 
 
-Following the above argumentation for each approach we assembled a
+Following the above argumentation for each approach, we assembled a
 general overview in Table \ref{tab:comparison}. The general picture is
 everything else than clear. It looks like HTM may be a good solution
 to replace the GIL in the near future. Current implementations are
@@ -446,10 +446,15 @@
 approach, initial results suggest that we can keep the overhead of STM
 well below 50\%. A hybrid TM system, which also uses HTM to accelerate
 certain tasks, looks like a very promising direction of research
-too. We believe that further work to reduce the overhead of STM is
-very worthwhile.
+too.
 
-
+We believe that further work to reduce the overhead of STM is
+very worthwhile. In fact, considering some analogies that have been
+drawn between garbage collection and transactional memory \cite{dan07},
+we believe that it is worthwhile to focus the STM research more
+specifically on the context shown in this paper --- for use in
+implementations of high-level languages, rather than as a tool
+directly used by the programmer.
 
 
 %% possible solution:\\
@@ -475,6 +480,12 @@
 \begin{thebibliography}{}
 \softraggedright
 
+\bibitem{dan07}
+  Dan Grossman. 2007. The transactional memory / garbage collection
+  analogy. \emph{In Proceedings of the 22nd annual ACM SIGPLAN
+conference on Object-oriented programming systems and
+applications} (OOPSLA '07).
+
 \bibitem{webjython}
   The Jython Project, \url{www.jython.org}
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: ~\cite

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5242:1cbe6de6b5e2
Date: 2014-05-05 17:02 +0200
http://bitbucket.org/pypy/extradoc/changeset/1cbe6de6b5e2/

Log:~\cite

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -450,7 +450,7 @@
 
 We believe that further work to reduce the overhead of STM is
 very worthwhile. In fact, considering some analogies that have been
-drawn between garbage collection and transactional memory \cite{dan07},
+drawn between garbage collection and transactional memory~\cite{dan07},
 we believe that it is worthwhile to focus the STM research more
 specifically on the context shown in this paper --- for use in
 implementations of high-level languages, rather than as a tool
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: regen

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5243:7a830b8d3eed
Date: 2014-05-05 17:02 +0200
http://bitbucket.org/pypy/extradoc/changeset/7a830b8d3eed/

Log:regen

diff --git a/talk/icooolps2014/position-paper.pdf 
b/talk/icooolps2014/position-paper.pdf
index 
d50af6d75293ebca7607edd49d1c57321cf7e97f..1b6cdc2799253a841eb294649452de2bd5a91af1
GIT binary patch

[cut]

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Fix, maybe?

2014-05-05 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5244:cdc97c676401
Date: 2014-05-05 17:08 +0200
http://bitbucket.org/pypy/extradoc/changeset/cdc97c676401/

Log:Fix, maybe?

diff --git a/talk/icooolps2014/position-paper.pdf 
b/talk/icooolps2014/position-paper.pdf
index 
1b6cdc2799253a841eb294649452de2bd5a91af1..473787d313f0bad0af373cb268d3e6b7cdb17d6d
GIT binary patch

[cut]

diff --git a/talk/icooolps2014/position-paper.tex 
b/talk/icooolps2014/position-paper.tex
--- a/talk/icooolps2014/position-paper.tex
+++ b/talk/icooolps2014/position-paper.tex
@@ -452,7 +452,7 @@
 very worthwhile. In fact, considering some analogies that have been
 drawn between garbage collection and transactional memory~\cite{dan07},
 we believe that it is worthwhile to focus the STM research more
-specifically on the context shown in this paper --- for use in
+specifically onto the context shown in this paper --- for use in
 implementations of high-level languages, rather than as a tool
 directly used by the programmer.
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] benchmarks default: this shows cpyext not working on stm currently

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: 
Changeset: r259:11c8ab4dc4b6
Date: 2014-05-05 17:35 +0200
http://bitbucket.org/pypy/benchmarks/changeset/11c8ab4dc4b6/

Log:this shows cpyext not working on stm currently

diff --git a/multithread/mandelbrot/mandelbrot.py 
b/multithread/mandelbrot/mandelbrot.py
--- a/multithread/mandelbrot/mandelbrot.py
+++ b/multithread/mandelbrot/mandelbrot.py
@@ -27,7 +27,7 @@
 return result
 
 def save_img(image, file_name='out.png'):
-import Image
+from PIL import Image
 im = Image.new("RGB", (len(image[0]), len(image)))
 out = im.load()
 
@@ -53,6 +53,7 @@
 
 
 def run(threads=2, stripes=16):
+global out_image
 threads = int(threads)
 stripes = int(stripes)
 assert stripes >= threads
@@ -77,12 +78,12 @@
 parallel_time = time.time() - parallel_time
 
 set_thread_pool(None)
-merge_imgs(res)
+out_image = merge_imgs(res)
 return parallel_time
 
 
 
 if __name__ == '__main__':
-image = run(int(sys.argv[1]))
-save_to_file(image)
-# save_img(image) don't run on STM, allocates 4000GB of memory
+image = run(int(sys.argv[1]), int(sys.argv[2]))
+#save_to_file(out_image)
+save_img(out_image)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] benchmarks default: make threadworms use a deque() because a linked list is better for STM

2014-05-05 Thread Raemi
Author: Remi Meier 
Branch: 
Changeset: r260:0ccaad335031
Date: 2014-05-05 18:01 +0200
http://bitbucket.org/pypy/benchmarks/changeset/0ccaad335031/

Log:make threadworms use a deque() because a linked list is better for
STM

diff --git a/multithread/common/abstract_threading.py 
b/multithread/common/abstract_threading.py
--- a/multithread/common/abstract_threading.py
+++ b/multithread/common/abstract_threading.py
@@ -1,8 +1,15 @@
 from Queue import Queue, Empty, Full
-from threading import Thread, Condition, Lock, local
+from threading import Thread, Condition, RLock, local
 import thread, atexit, sys, time
 
-from atomic import atomic, getsegmentlimit, print_abort_info
+try:
+from atomic import atomic, getsegmentlimit, print_abort_info
+except:
+atomic = RLock()
+def getsegmentlimit():
+return 1
+def print_abort_info(tm=0.0):
+pass
 
 
 class TLQueue_concurrent(object):
@@ -102,6 +109,7 @@
 
 def shutdown(self):
 for w in self.workers:
+self.input_queue.put((print_abort_info, (), {}))
 self.input_queue.put((sys.exit, (), {}))
 for w in self.workers:
 w.join()
diff --git a/multithread/threadworms/threadworms.py 
b/multithread/threadworms/threadworms.py
--- a/multithread/threadworms/threadworms.py
+++ b/multithread/threadworms/threadworms.py
@@ -130,9 +130,16 @@
 NUM_WORMS = int(worms)
 NUM_STEPS = int(steps) // NUM_WORMS
 
-GRID = []
+# using a deque instead of a list is kind of cheating
+# since it is a linked list of blocks. This means
+# that there are less conflicts.
+# So maybe remove this again when we support array-barriers in STM
+import collections
+list_to_use = collections.deque #list
+
+GRID = list_to_use()
 for x in range(CELLS_WIDE):
-GRID.append([None] * CELLS_HIGH)
+GRID.append(list_to_use([None] * CELLS_HIGH))
 #GRID_LOCK = threading.Lock() # pun was not intended
 
 # Draw some walls on the grid
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: test/fix searchsorted return type for scalars

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71279:3581f7a906c9
Date: 2014-05-05 15:02 -0400
http://bitbucket.org/pypy/pypy/changeset/3581f7a906c9/

Log:test/fix searchsorted return type for scalars

diff --git a/pypy/module/micronumpy/ndarray.py 
b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -738,6 +738,8 @@
 ret = W_NDimArray.from_shape(
 space, v.get_shape(), 
descriptor.get_dtype_cache(space).w_longdtype)
 app_searchsort(space, self, v, space.wrap(side), ret)
+if ret.is_scalar():
+return ret.get_scalar_value()
 return ret
 
 def descr_setasflat(self, space, w_v):
diff --git a/pypy/module/micronumpy/test/test_sorting.py 
b/pypy/module/micronumpy/test/test_sorting.py
--- a/pypy/module/micronumpy/test/test_sorting.py
+++ b/pypy/module/micronumpy/test/test_sorting.py
@@ -351,13 +351,21 @@
 assert (x.argsort(kind='m') == np.arange(32)).all()
 
 def test_searchsort(self):
-from numpy import arange
+import numpy as np
 import sys
-a = arange(1, 6)
+a = np.arange(1, 6)
 ret = a.searchsorted(3)
 assert ret == 2
+assert isinstance(ret, np.generic)
+ret = a.searchsorted(np.array(3))
+assert ret == 2
+assert isinstance(ret, np.generic)
+ret = a.searchsorted(np.array([3]))
+assert ret == 2
+assert isinstance(ret, np.ndarray)
 ret = a.searchsorted(3, side='right')
 assert ret == 3
+assert isinstance(ret, np.generic)
 ret = a.searchsorted([-10, 10, 2, 3])
 assert (ret == [0, 5, 1, 2]).all()
 if '__pypy__' in sys.builtin_module_names:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge upstream

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71283:01e1b2dbf81e
Date: 2014-05-05 12:07 -0700
http://bitbucket.org/pypy/pypy/changeset/01e1b2dbf81e/

Log:merge upstream

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -202,30 +202,6 @@
 return w_result.buffer_w(space, flags)
 raise TypeError
 
-def readbuf_w(self, space):
-w_impl = space.lookup(self, '__buffer__')
-if w_impl is not None:
-w_result = space.get_and_call_function(w_impl, self)
-if space.isinstance_w(w_result, space.w_memoryview):
-return w_result.readbuf_w(space)
-return self.buffer_w(space, space.BUF_SIMPLE)
-
-def writebuf_w(self, space):
-w_impl = space.lookup(self, '__buffer__')
-if w_impl is not None:
-w_result = space.get_and_call_function(w_impl, self)
-if space.isinstance_w(w_result, space.w_memoryview):
-return w_result.writebuf_w(space)
-return self.buffer_w(space, space.BUF_WRITABLE)
-
-def charbuf_w(self, space):
-w_impl = space.lookup(self, '__buffer__')
-if w_impl is not None:
-w_result = space.get_and_call_function(w_impl, self)
-if space.isinstance_w(w_result, space.w_memoryview):
-return w_result.charbuf_w(space)
-return self.buffer_w(space, space.BUF_SIMPLE).as_str()
-
 def bytes_w(self, space):
 self._typed_unwrap_error(space, "bytes")
 
@@ -1369,31 +1345,33 @@
 return w_obj.buffer_w(self, flags)
 except TypeError:
 raise oefmt(self.w_TypeError,
-"'%T' does not have the buffer interface", w_obj)
+"'%T' does not support the buffer interface", w_obj)
 
 def readbuf_w(self, w_obj):
 # Old buffer interface, returns a readonly buffer 
(PyObject_AsReadBuffer)
 try:
-return w_obj.readbuf_w(self)
+return w_obj.buffer_w(self, self.BUF_SIMPLE)
 except TypeError:
 raise oefmt(self.w_TypeError,
-"expected a readable buffer object")
+"expected an object with a buffer interface")
 
 def writebuf_w(self, w_obj):
 # Old buffer interface, returns a writeable buffer 
(PyObject_AsWriteBuffer)
 try:
-return w_obj.writebuf_w(self)
+return w_obj.buffer_w(self, self.BUF_WRITABLE)
 except TypeError:
 raise oefmt(self.w_TypeError,
-"expected a writeable buffer object")
+"expected an object with a writable buffer interface")
 
 def charbuf_w(self, w_obj):
 # Old buffer interface, returns a character buffer 
(PyObject_AsCharBuffer)
 try:
-return w_obj.charbuf_w(self)
+buf = w_obj.buffer_w(self, self.BUF_SIMPLE)
 except TypeError:
 raise oefmt(self.w_TypeError,
-"expected a character buffer object")
+"expected an object with a buffer interface")
+else:
+return buf.as_str()
 
 def _getarg_error(self, expected, w_obj):
 if self.is_none(w_obj):
@@ -1410,15 +1388,11 @@
 code = 's*'
 if code == 's*':
 if self.isinstance_w(w_obj, self.w_str):
-return w_obj.readbuf_w(self)
+return StringBuffer(w_obj.bytes_w(self))
 if self.isinstance_w(w_obj, self.w_unicode):
 return StringBuffer(w_obj.identifier_w(self))
 try:
-return w_obj.buffer_w(self, 0)
-except TypeError:
-pass
-try:
-return w_obj.readbuf_w(self)
+return w_obj.buffer_w(self, self.BUF_SIMPLE)
 except TypeError:
 self._getarg_error("bytes or buffer", w_obj)
 elif code == 's#':
@@ -1427,7 +1401,7 @@
 if self.isinstance_w(w_obj, self.w_unicode):
 return w_obj.identifier_w(self)
 try:
-return w_obj.readbuf_w(self).as_str()
+return w_obj.buffer_w(self, self.BUF_SIMPLE).as_str()
 except TypeError:
 self._getarg_error("bytes or read-only buffer", w_obj)
 elif code == 'w*':
@@ -1435,13 +1409,15 @@
 try:
 return w_obj.buffer_w(self, self.BUF_WRITABLE)
 except OperationError:
-self._getarg_error("read-write buffer", w_obj)
+pass
 except TypeError:
 pass
+self._getarg_error("read-write buffer", w_obj)
+elif code == 'y*':
 try:
-return w_obj.writebuf_w(self)
+return w_obj.buffer_w(self, self.BUF_SIMPLE)
 

[pypy-commit] pypy py3k: fix translation

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71281:a36e3abccfce
Date: 2014-05-05 12:06 -0700
http://bitbucket.org/pypy/pypy/changeset/a36e3abccfce/

Log:fix translation

diff --git a/pypy/module/_lsprof/interp_lsprof.py 
b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -199,7 +199,7 @@
 if isinstance(w_type, W_TypeObject):
 w_realclass, _ = space.lookup_in_type_where(w_type, name)
 if isinstance(w_realclass, W_TypeObject):
-class_name = w_realclass.name
+class_name = w_realclass.name.decode('utf-8')
 else:
 name = '?'
 if class_name is None:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.3.x: test/fix searchsorted return type for scalars

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: release-2.3.x
Changeset: r71284:6296ec75007c
Date: 2014-05-05 15:02 -0400
http://bitbucket.org/pypy/pypy/changeset/6296ec75007c/

Log:test/fix searchsorted return type for scalars (grafted from
3581f7a906c91c9c57ea024c4242546af0a37e3e)

diff --git a/pypy/module/micronumpy/ndarray.py 
b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -738,6 +738,8 @@
 ret = W_NDimArray.from_shape(
 space, v.get_shape(), 
descriptor.get_dtype_cache(space).w_longdtype)
 app_searchsort(space, self, v, space.wrap(side), ret)
+if ret.is_scalar():
+return ret.get_scalar_value()
 return ret
 
 def descr_setasflat(self, space, w_v):
diff --git a/pypy/module/micronumpy/test/test_sorting.py 
b/pypy/module/micronumpy/test/test_sorting.py
--- a/pypy/module/micronumpy/test/test_sorting.py
+++ b/pypy/module/micronumpy/test/test_sorting.py
@@ -351,13 +351,21 @@
 assert (x.argsort(kind='m') == np.arange(32)).all()
 
 def test_searchsort(self):
-from numpy import arange
+import numpy as np
 import sys
-a = arange(1, 6)
+a = np.arange(1, 6)
 ret = a.searchsorted(3)
 assert ret == 2
+assert isinstance(ret, np.generic)
+ret = a.searchsorted(np.array(3))
+assert ret == 2
+assert isinstance(ret, np.generic)
+ret = a.searchsorted(np.array([3]))
+assert ret == 2
+assert isinstance(ret, np.ndarray)
 ret = a.searchsorted(3, side='right')
 assert ret == 3
+assert isinstance(ret, np.generic)
 ret = a.searchsorted([-10, 10, 2, 3])
 assert (ret == [0, 5, 1, 2]).all()
 if '__pypy__' in sys.builtin_module_names:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: typos (thanks Ryan)

2014-05-05 Thread mattip
Author: mattip 
Branch: 
Changeset: r71285:c9c45912211f
Date: 2014-05-05 23:46 +0300
http://bitbucket.org/pypy/pypy/changeset/c9c45912211f/

Log:typos (thanks Ryan)

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
--- a/pypy/doc/release-2.3.0.rst
+++ b/pypy/doc/release-2.3.0.rst
@@ -84,7 +84,7 @@
 
 * Fix issues with reimporting builtin modules
 
-* Fix a RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
+* Fix an RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
 
 * Support for corner cases on objects with __int__ and __float__ methods
 
@@ -125,7 +125,7 @@
   and scalars were corrected. We are slowly approaching our goal of passing
   the NumPy test suite. We still do not support object or unicode ndarrays.
 
-* speed of iteration in dot() is now within 1.5x of the NumPy c 
+* Speed of iteration in dot() is now within 1.5x of the NumPy c 
   implementation (without BLAS acceleration). Since the same array
   iterator is used throughout the ``_numpy`` module, speed increases should
   be apparent in all NumPy functionality.
@@ -135,7 +135,7 @@
 * A cffi-based ``numpy.random`` module is available as a branch;
   it will be merged soon after this release.
 
-* enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
+* Enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
   memory operations used in NumPy arrays. Further work remains here in 
virtualizing the 
   alloc_raw_storage when possible. This will allow scalars to have storages 
but still be 
   virtualized when possible in loops.
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.3.x: typos (thanks Ryan)

2014-05-05 Thread mattip
Author: mattip 
Branch: release-2.3.x
Changeset: r71286:030cfa02b9af
Date: 2014-05-05 23:46 +0300
http://bitbucket.org/pypy/pypy/changeset/030cfa02b9af/

Log:typos (thanks Ryan)

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
--- a/pypy/doc/release-2.3.0.rst
+++ b/pypy/doc/release-2.3.0.rst
@@ -84,7 +84,7 @@
 
 * Fix issues with reimporting builtin modules
 
-* Fix a RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
+* Fix an RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
 
 * Support for corner cases on objects with __int__ and __float__ methods
 
@@ -125,7 +125,7 @@
   and scalars were corrected. We are slowly approaching our goal of passing
   the NumPy test suite. We still do not support object or unicode ndarrays.
 
-* speed of iteration in dot() is now within 1.5x of the NumPy c 
+* Speed of iteration in dot() is now within 1.5x of the NumPy c 
   implementation (without BLAS acceleration). Since the same array
   iterator is used throughout the ``_numpy`` module, speed increases should
   be apparent in all NumPy functionality.
@@ -135,7 +135,7 @@
 * A cffi-based ``numpy.random`` module is available as a branch;
   it will be merged soon after this release.
 
-* enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
+* Enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
   memory operations used in NumPy arrays. Further work remains here in 
virtualizing the 
   alloc_raw_storage when possible. This will allow scalars to have storages 
but still be 
   virtualized when possible in loops.
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: We now need -fPIC on PPC or translation will blow up with R_PPC_REL24 relocations that are out of range

2014-05-05 Thread stefanor
Author: Stefano Rivera 
Branch: 
Changeset: r71287:11c4878ea354
Date: 2014-05-05 23:09 +0200
http://bitbucket.org/pypy/pypy/changeset/11c4878ea354/

Log:We now need -fPIC on PPC or translation will blow up with
R_PPC_REL24 relocations that are out of range

diff --git a/rpython/translator/platform/__init__.py 
b/rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py
+++ b/rpython/translator/platform/__init__.py
@@ -267,7 +267,7 @@
 # Only required on armhf and mips{,el}, not armel. But there's no way to
 # detect armhf without shelling out
 if (platform.architecture()[0] == '64bit'
-or platform.machine().startswith(('arm', 'mips'))):
+or platform.machine().startswith(('arm', 'mips', 'ppc'))):
 host_factory = LinuxPIC
 else:
 host_factory = Linux
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: adjust expected per py3k

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71289:fc93c113016b
Date: 2014-05-05 12:13 -0700
http://bitbucket.org/pypy/pypy/changeset/fc93c113016b/

Log:adjust expected per py3k

diff --git a/pypy/module/_lsprof/test/test_cprofile.py 
b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -38,7 +38,7 @@
 prof.disable()
 stats = prof.getstats()
 expected = (
-"",
+"",
 "",
 )
 by_id = set()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: kill long literal

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71288:345171b6d983
Date: 2014-05-05 12:10 -0700
http://bitbucket.org/pypy/pypy/changeset/345171b6d983/

Log:kill long literal

diff --git a/pypy/module/cppyy/test/test_cppyy.py 
b/pypy/module/cppyy/test/test_cppyy.py
--- a/pypy/module/cppyy/test/test_cppyy.py
+++ b/pypy/module/cppyy/test/test_cppyy.py
@@ -47,8 +47,6 @@
 
 res = t.get_overload("staticAddOneToInt").call(None, 1)
 assert res == 2
-res = t.get_overload("staticAddOneToInt").call(None, 1L)
-assert res == 2
 res = t.get_overload("staticAddOneToInt").call(None, 1, 2)
 assert res == 4
 res = t.get_overload("staticAddOneToInt").call(None, -1)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: adapt tests from default

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71290:96a00ddec0cd
Date: 2014-05-05 13:01 -0700
http://bitbucket.org/pypy/pypy/changeset/96a00ddec0cd/

Log:adapt tests from default

diff --git a/pypy/module/marshal/test/test_marshal.py 
b/pypy/module/marshal/test/test_marshal.py
--- a/pypy/module/marshal/test/test_marshal.py
+++ b/pypy/module/marshal/test/test_marshal.py
@@ -196,7 +196,7 @@
 
 def test_bad_typecode(self):
 import marshal
-exc = raises(ValueError, marshal.loads, chr(1))
+exc = raises(ValueError, marshal.loads, bytes([1]))
 assert str(exc.value) == "bad marshal data (unknown type code)"
 
 def test_bad_data(self):
diff --git a/pypy/module/mmap/test/test_mmap.py 
b/pypy/module/mmap/test/test_mmap.py
--- a/pypy/module/mmap/test/test_mmap.py
+++ b/pypy/module/mmap/test/test_mmap.py
@@ -528,7 +528,7 @@
 
 f.close()
 
-def test_buffer(self):
+def test_memoryview(self):
 from mmap import mmap
 f = open(self.tmpname + "y", "bw+")
 f.write(b"foobar")
@@ -542,18 +542,6 @@
 m.close()
 f.close()
 
-def test_memoryview(self):
-from mmap import mmap
-f = open(self.tmpname + "y", "w+")
-f.write("foobar")
-f.flush()
-m = mmap(f.fileno(), 6)
-m[5] = '?'
-exc = raises(TypeError, memoryview, m)
-assert 'buffer interface' in str(exc.value)
-m.close()
-f.close()
-
 def test_offset(self):
 from mmap import mmap, ALLOCATIONGRANULARITY
 f = open(self.tmpname + "y", "wb+")
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: use the new buffer interface, adapt tests

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71291:7549430fa354
Date: 2014-05-05 13:01 -0700
http://bitbucket.org/pypy/pypy/changeset/7549430fa354/

Log:use the new buffer interface, adapt tests

diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -92,11 +92,7 @@
 @unwrap_spec(format=str, offset=int)
 def unpack_from(space, format, w_buffer, offset=0):
 size = _calcsize(space, format)
-buf = space.getarg_w('z*', w_buffer)
-if buf is None:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise oefmt(w_error, "unpack_from requires a buffer argument")
+buf = space.buffer_w(w_buffer, space.BUF_SIMPLE)
 if offset < 0:
 offset += buf.getlength()
 if offset < 0 or (buf.getlength() - offset) < size:
diff --git a/pypy/module/struct/test/test_struct.py 
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -354,32 +354,33 @@
 
 def test_pack_unpack_buffer(self):
 import array
-b = array.array('c', '\x00' * 19)
+b = array.array('b', b'\x00' * 19)
 sz = self.struct.calcsize("ii")
 for offset in [2, -17]:
 self.struct.pack_into("ii", b, offset, 17, 42)
-assert str(buffer(b)) == ('\x00' * 2 +
-  self.struct.pack("ii", 17, 42) +
-  '\x00' * (19-sz-2))
-exc = raises(TypeError, self.struct.pack_into, "ii", buffer(b), 0, 17, 
42)
-assert str(exc.value) == "buffer is read-only"
+assert bytes(memoryview(b)) == (b'\x00' * 2 +
+self.struct.pack("ii", 17, 42) +
+b'\x00' * (19-sz-2))
+b2 = array.array('b', b'\x00' * 19)
+self.struct.pack_into("ii", memoryview(b2), 0, 17, 42)
+assert bytes(b2) == self.struct.pack("ii", 17, 42) + (b'\x00' * 11)
+
 exc = raises(TypeError, self.struct.pack_into, "ii", 'test', 0, 17, 42)
-assert str(exc.value) == "Cannot use string as modifiable buffer"
+assert str(exc.value) == "expected an object with a writable buffer 
interface"
 exc = raises(self.struct.error, self.struct.pack_into, "ii", b[0:1], 
0, 17, 42)
 assert str(exc.value) == "pack_into requires a buffer of at least 8 
bytes"
 
 assert self.struct.unpack_from("ii", b, 2) == (17, 42)
 assert self.struct.unpack_from("ii", b, -17) == (17, 42)
-assert self.struct.unpack_from("ii", buffer(b, 2)) == (17, 42)
-assert self.struct.unpack_from("ii", buffer(b), 2) == (17, 42)
-assert self.struct.unpack_from("ii", memoryview(buffer(b)), 2) == (17, 
42)
+assert self.struct.unpack_from("ii", memoryview(b)[2:]) == (17, 42)
+assert self.struct.unpack_from("ii", memoryview(b), 2) == (17, 42)
 exc = raises(TypeError, self.struct.unpack_from, "ii", 123)
-assert 'must be string or buffer, not int' in str(exc.value)
-exc = raises(self.struct.error, self.struct.unpack_from, "ii", None)
-assert str(exc.value) == "unpack_from requires a buffer argument"
-exc = raises(self.struct.error, self.struct.unpack_from, "ii", '')
+assert str(exc.value) == "'int' does not support the buffer interface"
+exc = raises(TypeError, self.struct.unpack_from, "ii", None)
+assert str(exc.value) == "'NoneType' does not support the buffer 
interface"
+exc = raises(self.struct.error, self.struct.unpack_from, "ii", b'')
 assert str(exc.value) == "unpack_from requires a buffer of at least 8 
bytes"
-exc = raises(self.struct.error, self.struct.unpack_from, "ii", 
memoryview(''))
+exc = raises(self.struct.error, self.struct.unpack_from, "ii", 
memoryview(b''))
 assert str(exc.value) == "unpack_from requires a buffer of at least 8 
bytes"
 
 def test___float__(self):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: skip this for now as it's also a problem on CPython, albeit not as easy to

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71292:0177e2f21337
Date: 2014-05-05 17:15 -0700
http://bitbucket.org/pypy/pypy/changeset/0177e2f21337/

Log:skip this for now as it's also a problem on CPython, albeit not as
easy to reproduce on there

diff --git a/lib-python/3/test/test_weakref.py 
b/lib-python/3/test/test_weakref.py
--- a/lib-python/3/test/test_weakref.py
+++ b/lib-python/3/test/test_weakref.py
@@ -1174,7 +1174,9 @@
 yield Object(v), v
 finally:
 it = None   # should commit all removals
-self.check_weak_destroy_and_mutate_while_iterating(dict, testcontext)
+if not support.check_impl_detail(pypy=True):
+# XXX: http://bugs.python.org/issue21173
+self.check_weak_destroy_and_mutate_while_iterating(dict, 
testcontext)
 
 def test_weak_values_destroy_while_iterating(self):
 # Issue #7105: iterators shouldn't crash when a key is implicitly 
removed
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix memoryview.readonly degrading to int from bool

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71293:59dc90f4fe8a
Date: 2014-05-05 17:33 -0700
http://bitbucket.org/pypy/pypy/changeset/59dc90f4fe8a/

Log:fix memoryview.readonly degrading to int from bool

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
@@ -19,7 +19,8 @@
 
 def buffer_w(self, space, flags):
 self.check_valid()
-return MMapBuffer(self.space, self.mmap, flags & space.BUF_WRITABLE)
+return MMapBuffer(self.space, self.mmap,
+  bool(flags & space.BUF_WRITABLE))
 
 def close(self):
 self.mmap.close()
diff --git a/pypy/module/mmap/test/test_mmap.py 
b/pypy/module/mmap/test/test_mmap.py
--- a/pypy/module/mmap/test/test_mmap.py
+++ b/pypy/module/mmap/test/test_mmap.py
@@ -536,6 +536,7 @@
 m = mmap(f.fileno(), 6)
 b = memoryview(m)
 assert len(b) == 6
+assert b.readonly is False
 assert b[3] == b"b"
 assert b[:] == b"foobar"
 del b  # For CPython: "exported pointers exist"
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fill in missing module names

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: 
Changeset: r71294:fb04fb1b644b
Date: 2014-05-05 18:33 -0700
http://bitbucket.org/pypy/pypy/changeset/fb04fb1b644b/

Log:fill in missing module names

diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -152,7 +152,7 @@
 space.call_method(self.getdict(space), "update", w_dict)
 
 W_BytesIO.typedef = TypeDef(
-'BytesIO', W_BufferedIOBase.typedef,
+'_io.BytesIO', W_BufferedIOBase.typedef,
 __new__ = generic_new_descr(W_BytesIO),
 __init__  = interp2app(W_BytesIO.descr_init),
 
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -429,7 +429,7 @@
 return w_size
 
 W_FileIO.typedef = TypeDef(
-'FileIO', W_RawIOBase.typedef,
+'_io.FileIO', W_RawIOBase.typedef,
 __new__  = interp2app(W_FileIO.descr_new.im_func),
 __init__  = interp2app(W_FileIO.descr_init),
 __repr__ = interp2app(W_FileIO.repr_w),
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,9 +27,9 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'BlockingIOError', W_IOError.typedef,
-__doc__ = ("Exception raised when I/O would block "
-   "on a non-blocking I/O stream"),
+'_io.BlockingIOError', W_IOError.typedef,
+__doc__ = ("Exception raised when I/O would block on a non-blocking "
+   "I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
 __init__ = interp2app(W_BlockingIOError.descr_init),
 characters_written = interp_attrproperty('written', W_BlockingIOError),
diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -288,7 +288,7 @@
 break
 
 W_IOBase.typedef = TypeDef(
-'_IOBase',
+'_io._IOBase',
 __new__ = generic_new_descr(W_IOBase),
 __enter__ = interp2app(W_IOBase.enter_w),
 __exit__ = interp2app(W_IOBase.exit_w),
@@ -359,7 +359,7 @@
 return space.wrap(builder.build())
 
 W_RawIOBase.typedef = TypeDef(
-'_RawIOBase', W_IOBase.typedef,
+'_io._RawIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_RawIOBase),
 
 read = interp2app(W_RawIOBase.read_w),
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -178,7 +178,7 @@
 space.call_method(self.w_decoder, "setstate", w_state)
 
 W_IncrementalNewlineDecoder.typedef = TypeDef(
-'IncrementalNewlineDecoder',
+'_io.IncrementalNewlineDecoder',
 __new__ = generic_new_descr(W_IncrementalNewlineDecoder),
 __init__  = interp2app(W_IncrementalNewlineDecoder.descr_init),
 
@@ -255,7 +255,7 @@
 
 
 W_TextIOBase.typedef = TypeDef(
-'_TextIOBase', W_IOBase.typedef,
+'_io._TextIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_TextIOBase),
 
 read = interp2app(W_TextIOBase.read_w),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -340,3 +340,9 @@
 assert res == "world\n"
 assert f.newlines == "\n"
 assert type(f.newlines) is unicode
+
+def test_mod(self):
+import _io
+typemods = dict((t, t.__module__) for t in vars(_io).values()
+if isinstance(t, type))
+assert all(mod in ('io', '_io') for mod in typemods.values()), typemods
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.3.x: fill in missing module names

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: release-2.3.x
Changeset: r71295:59cfc1e32628
Date: 2014-05-05 18:33 -0700
http://bitbucket.org/pypy/pypy/changeset/59cfc1e32628/

Log:fill in missing module names (grafted from
fb04fb1b644b7d56c9affdead41f3704be5495ee)

diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -152,7 +152,7 @@
 space.call_method(self.getdict(space), "update", w_dict)
 
 W_BytesIO.typedef = TypeDef(
-'BytesIO', W_BufferedIOBase.typedef,
+'_io.BytesIO', W_BufferedIOBase.typedef,
 __new__ = generic_new_descr(W_BytesIO),
 __init__  = interp2app(W_BytesIO.descr_init),
 
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -429,7 +429,7 @@
 return w_size
 
 W_FileIO.typedef = TypeDef(
-'FileIO', W_RawIOBase.typedef,
+'_io.FileIO', W_RawIOBase.typedef,
 __new__  = interp2app(W_FileIO.descr_new.im_func),
 __init__  = interp2app(W_FileIO.descr_init),
 __repr__ = interp2app(W_FileIO.repr_w),
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,9 +27,9 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'BlockingIOError', W_IOError.typedef,
-__doc__ = ("Exception raised when I/O would block "
-   "on a non-blocking I/O stream"),
+'_io.BlockingIOError', W_IOError.typedef,
+__doc__ = ("Exception raised when I/O would block on a non-blocking "
+   "I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
 __init__ = interp2app(W_BlockingIOError.descr_init),
 characters_written = interp_attrproperty('written', W_BlockingIOError),
diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -288,7 +288,7 @@
 break
 
 W_IOBase.typedef = TypeDef(
-'_IOBase',
+'_io._IOBase',
 __new__ = generic_new_descr(W_IOBase),
 __enter__ = interp2app(W_IOBase.enter_w),
 __exit__ = interp2app(W_IOBase.exit_w),
@@ -359,7 +359,7 @@
 return space.wrap(builder.build())
 
 W_RawIOBase.typedef = TypeDef(
-'_RawIOBase', W_IOBase.typedef,
+'_io._RawIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_RawIOBase),
 
 read = interp2app(W_RawIOBase.read_w),
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -178,7 +178,7 @@
 space.call_method(self.w_decoder, "setstate", w_state)
 
 W_IncrementalNewlineDecoder.typedef = TypeDef(
-'IncrementalNewlineDecoder',
+'_io.IncrementalNewlineDecoder',
 __new__ = generic_new_descr(W_IncrementalNewlineDecoder),
 __init__  = interp2app(W_IncrementalNewlineDecoder.descr_init),
 
@@ -255,7 +255,7 @@
 
 
 W_TextIOBase.typedef = TypeDef(
-'_TextIOBase', W_IOBase.typedef,
+'_io._TextIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_TextIOBase),
 
 read = interp2app(W_TextIOBase.read_w),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -340,3 +340,9 @@
 assert res == "world\n"
 assert f.newlines == "\n"
 assert type(f.newlines) is unicode
+
+def test_mod(self):
+import _io
+typemods = dict((t, t.__module__) for t in vars(_io).values()
+if isinstance(t, type))
+assert all(mod in ('io', '_io') for mod in typemods.values()), typemods
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: kill more __module__s

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71301:6b34e576e6be
Date: 2014-05-05 18:43 -0700
http://bitbucket.org/pypy/pypy/changeset/6b34e576e6be/

Log:kill more __module__s

diff --git a/pypy/module/_io/interp_bufferedio.py 
b/pypy/module/_io/interp_bufferedio.py
--- a/pypy/module/_io/interp_bufferedio.py
+++ b/pypy/module/_io/interp_bufferedio.py
@@ -97,8 +97,7 @@
space.w_DeprecationWarning)
 
 W_BufferedIOBase.typedef = TypeDef(
-'_BufferedIOBase', W_IOBase.typedef,
-__module__ = "_io",
+'_io._BufferedIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_BufferedIOBase),
 read = interp2app(W_BufferedIOBase.read_w),
 read1 = interp2app(W_BufferedIOBase.read1_w),
@@ -993,8 +992,7 @@
   'isatty'])
 
 W_BufferedRWPair.typedef = TypeDef(
-'BufferedRWPair', W_BufferedIOBase.typedef,
-__module__ = "_io",
+'_io.BufferedRWPair', W_BufferedIOBase.typedef,
 __new__ = generic_new_descr(W_BufferedRWPair),
 __init__  = interp2app(W_BufferedRWPair.descr_init),
 __getstate__ = interp2app(W_BufferedRWPair.getstate_w),
diff --git a/pypy/module/itertools/interp_itertools.py 
b/pypy/module/itertools/interp_itertools.py
--- a/pypy/module/itertools/interp_itertools.py
+++ b/pypy/module/itertools/interp_itertools.py
@@ -251,7 +251,6 @@
 
 W_FilterFalse.typedef = TypeDef(
 'itertools.ifilterfalse',
-__module__ = 'itertools',
 __new__  = interp2app(W_FilterFalse___new__),
 __iter__ = interp2app(W_FilterFalse.iter_w),
 __next__ = interp2app(W_FilterFalse.next_w),
@@ -492,7 +491,6 @@
 
 W_ZipLongest.typedef = TypeDef(
 'itertools.zip_longest',
-__module__ = 'itertools',
 __new__  = interp2app(W_ZipLongest___new__),
 __iter__ = interp2app(W_ZipLongest.iter_w),
 __next__ = interp2app(W_ZipLongest.next_w),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: forgot to kill this __module__

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: 
Changeset: r71296:3a5da776e68e
Date: 2014-05-05 18:42 -0700
http://bitbucket.org/pypy/pypy/changeset/3a5da776e68e/

Log:forgot to kill this __module__

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,7 +442,6 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
-__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __nonzero__ = interp2app(W_CData.nonzero),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71299:d8096ef0c138
Date: 2014-05-05 18:38 -0700
http://bitbucket.org/pypy/pypy/changeset/d8096ef0c138/

Log:merge default

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
--- a/pypy/doc/release-2.3.0.rst
+++ b/pypy/doc/release-2.3.0.rst
@@ -84,7 +84,7 @@
 
 * Fix issues with reimporting builtin modules
 
-* Fix a RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
+* Fix an RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
 
 * Support for corner cases on objects with __int__ and __float__ methods
 
@@ -125,7 +125,7 @@
   and scalars were corrected. We are slowly approaching our goal of passing
   the NumPy test suite. We still do not support object or unicode ndarrays.
 
-* speed of iteration in dot() is now within 1.5x of the NumPy c 
+* Speed of iteration in dot() is now within 1.5x of the NumPy c 
   implementation (without BLAS acceleration). Since the same array
   iterator is used throughout the ``_numpy`` module, speed increases should
   be apparent in all NumPy functionality.
@@ -135,7 +135,7 @@
 * A cffi-based ``numpy.random`` module is available as a branch;
   it will be merged soon after this release.
 
-* enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
+* Enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
   memory operations used in NumPy arrays. Further work remains here in 
virtualizing the 
   alloc_raw_storage when possible. This will allow scalars to have storages 
but still be 
   virtualized when possible in loops.
diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -199,8 +199,7 @@
 space.call_method(self.getdict(space), "update", w_dict)
 
 W_BytesIO.typedef = TypeDef(
-'BytesIO', W_BufferedIOBase.typedef,
-__module__ = "_io",
+'_io.BytesIO', W_BufferedIOBase.typedef,
 __new__  = interp2app(W_BytesIO.descr_new.im_func),
 __init__  = interp2app(W_BytesIO.descr_init),
 
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -436,8 +436,7 @@
 return w_size
 
 W_FileIO.typedef = TypeDef(
-'FileIO', W_RawIOBase.typedef,
-__module__ = "_io",
+'_io.FileIO', W_RawIOBase.typedef,
 __new__  = interp2app(W_FileIO.descr_new.im_func),
 __init__  = interp2app(W_FileIO.descr_init),
 __repr__ = interp2app(W_FileIO.repr_w),
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,10 +27,9 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'BlockingIOError', W_IOError.typedef,
-__module__ = 'io',
-__doc__ = ("Exception raised when I/O would block "
-   "on a non-blocking I/O stream"),
+'_io.BlockingIOError', W_IOError.typedef,
+__doc__ = ("Exception raised when I/O would block on a non-blocking "
+   "I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
 __init__ = interp2app(W_BlockingIOError.descr_init),
 characters_written = interp_attrproperty('written', W_BlockingIOError),
diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -299,8 +299,7 @@
 break
 
 W_IOBase.typedef = TypeDef(
-'_IOBase',
-__module__ = "_io",
+'_io._IOBase',
 __new__ = generic_new_descr(W_IOBase),
 __enter__ = interp2app(W_IOBase.enter_w),
 __exit__ = interp2app(W_IOBase.exit_w),
@@ -372,8 +371,7 @@
 return space.wrapbytes(builder.build())
 
 W_RawIOBase.typedef = TypeDef(
-'_RawIOBase', W_IOBase.typedef,
-__module__ = "_io",
+'_io._RawIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_RawIOBase),
 
 read = interp2app(W_RawIOBase.read_w),
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -178,8 +178,7 @@
 space.call_method(self.w_decoder, "setstate", w_state)
 
 W_IncrementalNewlineDecoder.typedef = TypeDef(
-'IncrementalNewlineDecoder',
-__module__ = "_io",
+'_io.IncrementalNewlineDecoder',
 __new__ = generic_new_descr(W_IncrementalNewlineDecoder),
 __init__  = interp2app(W_IncrementalNewlineDecoder.descr_init),
 
@@ -256,8 +255,7 @@
 
 
 W_TextIOBase.typedef = TypeDef(
-'_TextIOBase', W_IOBase.typedef,
-__module__ = "_io",
+'_io._TextIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_TextIOBase),
 
 read = interp2app(W_TextIOBase.read_w),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
-

[pypy-commit] pypy py3k: disallow unicode

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71298:05a472020c13
Date: 2014-05-05 18:34 -0700
http://bitbucket.org/pypy/pypy/changeset/05a472020c13/

Log:disallow unicode

diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -136,7 +136,7 @@
 def write(space, fd, w_data):
 """Write a string to a file descriptor.  Return the number of bytes
 actually written, which may be smaller than len(data)."""
-data = space.getarg_w('s*', w_data)
+data = space.getarg_w('y*', w_data)
 try:
 res = os.write(fd, data.as_str())
 except OSError, e:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r71300:9c2e85c01eb9
Date: 2014-05-05 18:43 -0700
http://bitbucket.org/pypy/pypy/changeset/9c2e85c01eb9/

Log:merge default

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,7 +442,6 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
-__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __bool__ = interp2app(W_CData.bool),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.3.x: forgot to kill this __module__

2014-05-05 Thread pjenvey
Author: Philip Jenvey 
Branch: release-2.3.x
Changeset: r71297:530e5d850319
Date: 2014-05-05 18:42 -0700
http://bitbucket.org/pypy/pypy/changeset/530e5d850319/

Log:forgot to kill this __module__ (grafted from
3a5da776e68eb60eec90e01935b74f4d39056d51)

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,7 +442,6 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
-__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __nonzero__ = interp2app(W_CData.nonzero),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge heads

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71307:ad42ca1b0c3e
Date: 2014-05-05 22:09 -0400
http://bitbucket.org/pypy/pypy/changeset/ad42ca1b0c3e/

Log:merge heads

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
--- a/pypy/doc/release-2.3.0.rst
+++ b/pypy/doc/release-2.3.0.rst
@@ -84,7 +84,7 @@
 
 * Fix issues with reimporting builtin modules
 
-* Fix a RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
+* Fix an RPython bug with loop-unrolling that appeared in the `HippyVM`_ PHP 
port
 
 * Support for corner cases on objects with __int__ and __float__ methods
 
@@ -125,7 +125,7 @@
   and scalars were corrected. We are slowly approaching our goal of passing
   the NumPy test suite. We still do not support object or unicode ndarrays.
 
-* speed of iteration in dot() is now within 1.5x of the NumPy c 
+* Speed of iteration in dot() is now within 1.5x of the NumPy c 
   implementation (without BLAS acceleration). Since the same array
   iterator is used throughout the ``_numpy`` module, speed increases should
   be apparent in all NumPy functionality.
@@ -135,7 +135,7 @@
 * A cffi-based ``numpy.random`` module is available as a branch;
   it will be merged soon after this release.
 
-* enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
+* Enhancements to the PyPy JIT were made to support virtualizing the 
raw_store/raw_load 
   memory operations used in NumPy arrays. Further work remains here in 
virtualizing the 
   alloc_raw_storage when possible. This will allow scalars to have storages 
but still be 
   virtualized when possible in loops.
diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,7 +442,6 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
-__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __nonzero__ = interp2app(W_CData.nonzero),
diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -152,7 +152,7 @@
 space.call_method(self.getdict(space), "update", w_dict)
 
 W_BytesIO.typedef = TypeDef(
-'BytesIO', W_BufferedIOBase.typedef,
+'_io.BytesIO', W_BufferedIOBase.typedef,
 __new__ = generic_new_descr(W_BytesIO),
 __init__  = interp2app(W_BytesIO.descr_init),
 
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -429,7 +429,7 @@
 return w_size
 
 W_FileIO.typedef = TypeDef(
-'FileIO', W_RawIOBase.typedef,
+'_io.FileIO', W_RawIOBase.typedef,
 __new__  = interp2app(W_FileIO.descr_new.im_func),
 __init__  = interp2app(W_FileIO.descr_init),
 __repr__ = interp2app(W_FileIO.repr_w),
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,9 +27,9 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'BlockingIOError', W_IOError.typedef,
-__doc__ = ("Exception raised when I/O would block "
-   "on a non-blocking I/O stream"),
+'_io.BlockingIOError', W_IOError.typedef,
+__doc__ = ("Exception raised when I/O would block on a non-blocking "
+   "I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
 __init__ = interp2app(W_BlockingIOError.descr_init),
 characters_written = interp_attrproperty('written', W_BlockingIOError),
diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -288,7 +288,7 @@
 break
 
 W_IOBase.typedef = TypeDef(
-'_IOBase',
+'_io._IOBase',
 __new__ = generic_new_descr(W_IOBase),
 __enter__ = interp2app(W_IOBase.enter_w),
 __exit__ = interp2app(W_IOBase.exit_w),
@@ -359,7 +359,7 @@
 return space.wrap(builder.build())
 
 W_RawIOBase.typedef = TypeDef(
-'_RawIOBase', W_IOBase.typedef,
+'_io._RawIOBase', W_IOBase.typedef,
 __new__ = generic_new_descr(W_RawIOBase),
 
 read = interp2app(W_RawIOBase.read_w),
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -178,7 +178,7 @@
 space.call_method(self.w_decoder, "setstate", w_state)
 
 W_IncrementalNewlineDecoder.typedef = TypeDef(
-'IncrementalNewlineDecoder',
+'_io.IncrementalNewlineDecoder',
 __new__ = generic_new_descr(W_IncrementalNewlineDecoder),
 __init__  = interp2app(W_IncrementalNewlineDecoder.descr_init),
 
@@ -255,7 +255,7 @@
 
 
 W_TextIOBase.typedef = TypeDef(
-'_TextIOBase', W_IOBase.typedef,
+'_io._Te

[pypy-commit] pypy default: move _struct.error to interp level, test/fix its __module__

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71305:40142188f76a
Date: 2014-05-05 17:24 -0400
http://bitbucket.org/pypy/pypy/changeset/40142188f76a/

Log:move _struct.error to interp level, test/fix its __module__

diff --git a/pypy/module/struct/__init__.py b/pypy/module/struct/__init__.py
--- a/pypy/module/struct/__init__.py
+++ b/pypy/module/struct/__init__.py
@@ -46,6 +46,8 @@
 The variable struct.error is an exception raised on errors."""
 
 interpleveldefs = {
+'error': 'interp_struct.get_error(space)',
+
 'calcsize': 'interp_struct.calcsize',
 'pack': 'interp_struct.pack',
 'pack_into': 'interp_struct.pack_into',
@@ -56,5 +58,4 @@
 }
 
 appleveldefs = {
-'error': 'app_struct.error',
 }
diff --git a/pypy/module/struct/app_struct.py b/pypy/module/struct/app_struct.py
deleted file mode 100644
--- a/pypy/module/struct/app_struct.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# NOT_RPYTHON
-"""
-Application-level definitions for the struct module.
-"""
-
-
-class error(Exception):
-"""Exception raised on various occasions; argument is a string
-describing what is wrong."""
diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -12,6 +12,15 @@
 )
 
 
+class Cache:
+def __init__(self, space):
+self.error = space.new_exception_class("struct.error", 
space.w_Exception)
+
+
+def get_error(space):
+return space.fromcache(Cache).error
+
+
 @unwrap_spec(format=str)
 def calcsize(space, format):
 return space.wrap(_calcsize(space, format))
@@ -24,9 +33,7 @@
 except StructOverflowError, e:
 raise OperationError(space.w_OverflowError, space.wrap(e.msg))
 except StructError, e:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise OperationError(w_error, space.wrap(e.msg))
+raise OperationError(get_error(space), space.wrap(e.msg))
 return fmtiter.totalsize
 
 
@@ -42,9 +49,7 @@
 except StructOverflowError, e:
 raise OperationError(space.w_OverflowError, space.wrap(e.msg))
 except StructError, e:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise OperationError(w_error, space.wrap(e.msg))
+raise OperationError(get_error(space), space.wrap(e.msg))
 return space.wrap(fmtiter.result.build())
 
 
@@ -57,9 +62,7 @@
 offset += buf.getlength()
 size = len(res)
 if offset < 0 or (buf.getlength() - offset) < size:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise oefmt(w_error,
+raise oefmt(get_error(space),
 "pack_into requires a buffer of at least %d bytes",
 size)
 buf.setslice(offset, res)
@@ -72,9 +75,7 @@
 except StructOverflowError, e:
 raise OperationError(space.w_OverflowError, space.wrap(e.msg))
 except StructError, e:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise OperationError(w_error, space.wrap(e.msg))
+raise OperationError(get_error(space), space.wrap(e.msg))
 return space.newtuple(fmtiter.result_w[:])
 
 
@@ -89,15 +90,11 @@
 size = _calcsize(space, format)
 buf = space.getarg_w('z*', w_buffer)
 if buf is None:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise oefmt(w_error, "unpack_from requires a buffer argument")
+raise oefmt(get_error(space), "unpack_from requires a buffer argument")
 if offset < 0:
 offset += buf.getlength()
 if offset < 0 or (buf.getlength() - offset) < size:
-w_module = space.getbuiltinmodule('struct')
-w_error = space.getattr(w_module, space.wrap('error'))
-raise oefmt(w_error,
+raise oefmt(get_error(space),
 "unpack_from requires a buffer of at least %d bytes",
 size)
 buf = SubBuffer(buf, offset, size)
diff --git a/pypy/module/struct/test/test_struct.py 
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -24,6 +24,10 @@
 struct.error should be an exception class.
 """
 assert issubclass(self.struct.error, Exception)
+assert self.struct.error.__mro__ == (self.struct.error, Exception,
+ BaseException, object)
+assert self.struct.error.__name__ == "error"
+assert self.struct.error.__module__ == "struct"
 
 def test_calcsize_standard(self):
 """
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.pyt

[pypy-commit] pypy default: simplify struct.Struct methods now that everything lives at interp level

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71303:0928de078261
Date: 2014-05-05 17:25 -0400
http://bitbucket.org/pypy/pypy/changeset/0928de078261/

Log:simplify struct.Struct methods now that everything lives at interp
level

diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -2,7 +2,6 @@
 from rpython.rlib.buffer import SubBuffer
 from rpython.rlib.rstruct.error import StructError, StructOverflowError
 from rpython.rlib.rstruct.formatiterator import CalcSizeFormatIterator
-from rpython.tool.sourcetools import func_with_new_name
 
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.gateway import interp2app, unwrap_spec
@@ -51,9 +50,9 @@
 
 # XXX inefficient
 @unwrap_spec(format=str, offset=int)
-def pack_into(space, format, w_buf, offset, args_w):
+def pack_into(space, format, w_buffer, offset, args_w):
 res = pack(space, format, args_w).str_w(space)
-buf = space.writebuf_w(w_buf)
+buf = space.writebuf_w(w_buffer)
 if offset < 0:
 offset += buf.getlength()
 size = len(res)
@@ -118,21 +117,19 @@
 W_Struct.__init__(self, space, format)
 return self
 
-def wrap_struct_method(name):
-def impl(self, space, __args__):
-w_module = space.getbuiltinmodule('struct')
-w_method = space.getattr(w_module, space.wrap(name))
-return space.call_obj_args(
-w_method, space.wrap(self.format), __args__
-)
+def descr_pack(self, space, args_w):
+return pack(space, self.format, args_w)
 
-return func_with_new_name(impl, 'descr_' + name)
+@unwrap_spec(offset=int)
+def descr_pack_into(self, space, w_buffer, offset, args_w):
+return pack_into(space, self.format, w_buffer, offset, args_w)
 
-descr_pack = wrap_struct_method("pack")
-descr_unpack = wrap_struct_method("unpack")
-descr_pack_into = wrap_struct_method("pack_into")
-descr_unpack_from = wrap_struct_method("unpack_from")
+def descr_unpack(self, space, w_str):
+return unpack(space, self.format, w_str)
 
+@unwrap_spec(offset=int)
+def descr_unpack_from(self, space, w_buffer, offset=0):
+return unpack_from(space, self.format, w_buffer, offset)
 
 W_Struct.typedef = TypeDef("Struct",
 __new__=interp2app(W_Struct.descr__new__.im_func),
diff --git a/pypy/module/struct/test/test_struct.py 
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -403,6 +403,11 @@
 assert type(obj2) is float
 assert obj2 == 42.3
 
+def test_struct_object(self):
+s = self.struct.Struct('i')
+assert s.unpack(s.pack(42)) == (42,)
+assert s.unpack_from(memoryview(s.pack(42))) == (42,)
+
 
 class AppTestStructBuffer(object):
 spaceconfig = dict(usemodules=['struct', '__pypy__'])
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: backout 3a5da776e68e, this __module__ was here for a reason

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71308:8d657ce17ec5
Date: 2014-05-05 22:10 -0400
http://bitbucket.org/pypy/pypy/changeset/8d657ce17ec5/

Log:backout 3a5da776e68e, this __module__ was here for a reason

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,6 +442,7 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
+__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __nonzero__ = interp2app(W_CData.nonzero),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: add (skipped) struct object test_pypy_c

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71304:b9a02124b908
Date: 2014-05-05 18:36 -0400
http://bitbucket.org/pypy/pypy/changeset/b9a02124b908/

Log:add (skipped) struct object test_pypy_c

diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py 
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -348,51 +348,6 @@
 loop, = log.loops_by_id("globalread", is_entry_bridge=True)
 assert len(loop.ops_by_id("globalread")) == 0
 
-def test_struct_module(self):
-def main():
-import struct
-i = 1
-while i < 1000:
-x = struct.unpack("i", struct.pack("i", i))[0] # ID: struct
-i += x / i
-return i
-
-log = self.run(main)
-assert log.result == main()
-
-loop, = log.loops_by_id("struct")
-if sys.maxint == 2 ** 63 - 1:
-extra = """
-i8 = int_ge(i4, -2147483648)
-guard_true(i8, descr=...)
-"""
-else:
-extra = ""
-# This could, of course stand some improvement, to remove all these
-# arithmatic ops, but we've removed all the core overhead.
-assert loop.match_by_id("struct", """
-guard_not_invalidated(descr=...)
-# struct.pack
-%(32_bit_only)s
-i11 = int_and(i4, 255)
-i13 = int_rshift(i4, 8)
-i14 = int_and(i13, 255)
-i16 = int_rshift(i13, 8)
-i17 = int_and(i16, 255)
-i19 = int_rshift(i16, 8)
-i20 = int_and(i19, 255)
-
-# struct.unpack
-i22 = int_lshift(i14, 8)
-i23 = int_or(i11, i22)
-i25 = int_lshift(i17, 16)
-i26 = int_or(i23, i25)
-i28 = int_ge(i20, 128)
-guard_false(i28, descr=...)
-i30 = int_lshift(i20, 24)
-i31 = int_or(i26, i30)
-""" % {"32_bit_only": extra})
-
 def test_eval(self):
 def main():
 i = 1
diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py 
b/pypy/module/pypyjit/test_pypy_c/test_struct.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
@@ -0,0 +1,85 @@
+from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
+
+
+class TestStruct(BaseTestPyPyC):
+def test_struct_function(self):
+def main(n):
+import struct
+i = 1
+while i < n:
+x = struct.unpack("i", struct.pack("i", i))[0]  # ID: struct
+i += x / i
+return i
+
+log = self.run(main, [1000])
+assert log.result == main(1000)
+
+loop, = log.loops_by_filename(self.filepath)
+# This could, of course stand some improvement, to remove all these
+# arithmatic ops, but we've removed all the core overhead.
+assert loop.match_by_id("struct", """
+guard_not_invalidated(descr=...)
+# struct.pack
+i8 = int_ge(i4, -2147483648)
+guard_true(i8, descr=...)
+i9 = int_le(i4, 2147483647)
+guard_true(i9, descr=...)
+i11 = int_and(i4, 255)
+i13 = int_rshift(i4, 8)
+i14 = int_and(i13, 255)
+i16 = int_rshift(i13, 8)
+i17 = int_and(i16, 255)
+i19 = int_rshift(i16, 8)
+i20 = int_and(i19, 255)
+
+# struct.unpack
+i22 = int_lshift(i14, 8)
+i23 = int_or(i11, i22)
+i25 = int_lshift(i17, 16)
+i26 = int_or(i23, i25)
+i28 = int_ge(i20, 128)
+guard_false(i28, descr=...)
+i30 = int_lshift(i20, 24)
+i31 = int_or(i26, i30)
+""")
+
+def test_struct_object(self):
+skip("XXX broken")
+def main(n):
+import struct
+s = struct.Struct("i")
+i = 1
+while i < n:
+x = s.unpack(s.pack(i))[0]  # ID: struct
+i += x / i
+return i
+
+log = self.run(main, [1000])
+assert log.result == main(1000)
+
+loop, = log.loops_by_filename(self.filepath)
+assert loop.match_by_id('struct', """
+guard_not_invalidated(descr=...)
+# struct.pack
+i8 = int_ge(i4, -2147483648)
+guard_true(i8, descr=...)
+i9 = int_le(i4, 2147483647)
+guard_true(i9, descr=...)
+i11 = int_and(i4, 255)
+i13 = int_rshift(i4, 8)
+i14 = int_and(i13, 255)
+i16 = int_rshift(i13, 8)
+i17 = int_and(i16, 255)
+i19 = int_rshift(i16, 8)
+i20 = int_and(i19, 255)
+
+# struct.unpack
+i22 = int_lshift(i14, 8)
+i23 = int_or(i11, i22)
+i25 = int_lshift(i17, 16)
+  

[pypy-commit] pypy default: oops, fix test_pypy_c.test_buffers

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71302:a7a4b3c9936f
Date: 2014-05-05 19:45 -0400
http://bitbucket.org/pypy/pypy/changeset/a7a4b3c9936f/

Log:oops, fix test_pypy_c.test_buffers

diff --git a/pypy/module/pypyjit/test_pypy_c/test_buffers.py 
b/pypy/module/pypyjit/test_pypy_c/test_buffers.py
--- a/pypy/module/pypyjit/test_pypy_c/test_buffers.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_buffers.py
@@ -56,7 +56,7 @@
 guard_false(i99, descr=...)
 i100 = int_lshift(i98, 24)
 i101 = int_or(i97, i100)
-i102 = getfield_raw(50657056, descr=)
+i102 = getfield_raw(\d+, descr=)
 i103 = int_lt(i102, 0)
 guard_false(i103, descr=...)
 """)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: promote format on struct.Struct objects

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71306:d93da947bbf6
Date: 2014-05-05 18:35 -0400
http://bitbucket.org/pypy/pypy/changeset/d93da947bbf6/

Log:promote format on struct.Struct objects

diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py 
b/pypy/module/pypyjit/test_pypy_c/test_struct.py
--- a/pypy/module/pypyjit/test_pypy_c/test_struct.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
@@ -44,7 +44,6 @@
 """)
 
 def test_struct_object(self):
-skip("XXX broken")
 def main(n):
 import struct
 s = struct.Struct("i")
diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -115,18 +115,18 @@
 return self
 
 def descr_pack(self, space, args_w):
-return pack(space, self.format, args_w)
+return pack(space, jit.promote_string(self.format), args_w)
 
 @unwrap_spec(offset=int)
 def descr_pack_into(self, space, w_buffer, offset, args_w):
-return pack_into(space, self.format, w_buffer, offset, args_w)
+return pack_into(space, jit.promote_string(self.format), w_buffer, 
offset, args_w)
 
 def descr_unpack(self, space, w_str):
-return unpack(space, self.format, w_str)
+return unpack(space, jit.promote_string(self.format), w_str)
 
 @unwrap_spec(offset=int)
 def descr_unpack_from(self, space, w_buffer, offset=0):
-return unpack_from(space, self.format, w_buffer, offset)
+return unpack_from(space, jit.promote_string(self.format), w_buffer, 
offset)
 
 W_Struct.typedef = TypeDef("Struct",
 __new__=interp2app(W_Struct.descr__new__.im_func),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.3.x: backout 3a5da776e68e, this __module__ was here for a reason

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: release-2.3.x
Changeset: r71309:7267908b2526
Date: 2014-05-05 22:10 -0400
http://bitbucket.org/pypy/pypy/changeset/7267908b2526/

Log:backout 3a5da776e68e, this __module__ was here for a reason

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,6 +442,7 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
+__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __nonzero__ = interp2app(W_CData.nonzero),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.3.x: properly test/fix _io __modules__s

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: release-2.3.x
Changeset: r71311:186c5a7009ed
Date: 2014-05-05 22:20 -0400
http://bitbucket.org/pypy/pypy/changeset/186c5a7009ed/

Log:properly test/fix _io __modules__s

diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,7 +27,7 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'_io.BlockingIOError', W_IOError.typedef,
+'BlockingIOError', W_IOError.typedef,
 __doc__ = ("Exception raised when I/O would block on a non-blocking "
"I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -345,4 +345,10 @@
 import _io
 typemods = dict((t, t.__module__) for t in vars(_io).values()
 if isinstance(t, type))
-assert all(mod in ('io', '_io') for mod in typemods.values()), typemods
+for t, mod in typemods.items():
+if t is _io.BlockingIOError:
+assert mod == '__builtin__'
+elif t is _io.UnsupportedOperation:
+assert mod == 'io'
+else:
+assert mod == '_io'
diff --git a/pypy/module/_io/test/test_stringio.py 
b/pypy/module/_io/test/test_stringio.py
--- a/pypy/module/_io/test/test_stringio.py
+++ b/pypy/module/_io/test/test_stringio.py
@@ -146,11 +146,6 @@
 exc_info = raises(TypeError, sio.write, 3)
 assert "int" in exc_info.value.args[0]
 
-def test_module(self):
-import io
-
-assert io.StringIO.__module__ == "_io"
-
 def test_newline_none(self):
 import io
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: properly test/fix _io __modules__s

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: 
Changeset: r71310:13f0fb1ddec1
Date: 2014-05-05 22:20 -0400
http://bitbucket.org/pypy/pypy/changeset/13f0fb1ddec1/

Log:properly test/fix _io __modules__s

diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,7 +27,7 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'_io.BlockingIOError', W_IOError.typedef,
+'BlockingIOError', W_IOError.typedef,
 __doc__ = ("Exception raised when I/O would block on a non-blocking "
"I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -345,4 +345,10 @@
 import _io
 typemods = dict((t, t.__module__) for t in vars(_io).values()
 if isinstance(t, type))
-assert all(mod in ('io', '_io') for mod in typemods.values()), typemods
+for t, mod in typemods.items():
+if t is _io.BlockingIOError:
+assert mod == '__builtin__'
+elif t is _io.UnsupportedOperation:
+assert mod == 'io'
+else:
+assert mod == '_io'
diff --git a/pypy/module/_io/test/test_stringio.py 
b/pypy/module/_io/test/test_stringio.py
--- a/pypy/module/_io/test/test_stringio.py
+++ b/pypy/module/_io/test/test_stringio.py
@@ -146,11 +146,6 @@
 exc_info = raises(TypeError, sio.write, 3)
 assert "int" in exc_info.value.args[0]
 
-def test_module(self):
-import io
-
-assert io.StringIO.__module__ == "_io"
-
 def test_newline_none(self):
 import io
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: py3k
Changeset: r71312:9401f74194b9
Date: 2014-05-05 22:43 -0400
http://bitbucket.org/pypy/pypy/changeset/9401f74194b9/

Log:merge default

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -442,6 +442,7 @@
 
 W_CData.typedef = TypeDef(
 '_cffi_backend.CData',
+__module__ = '_cffi_backend',
 __name__ = '',
 __repr__ = interp2app(W_CData.repr),
 __bool__ = interp2app(W_CData.bool),
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -27,7 +27,7 @@
 self.written = written
 
 W_BlockingIOError.typedef = TypeDef(
-'_io.BlockingIOError', W_IOError.typedef,
+'BlockingIOError', W_IOError.typedef,
 __doc__ = ("Exception raised when I/O would block on a non-blocking "
"I/O stream"),
 __new__  = generic_new_descr(W_BlockingIOError),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -383,4 +383,10 @@
 import _io
 typemods = dict((t, t.__module__) for t in vars(_io).values()
 if isinstance(t, type))
-assert all(mod in ('io', '_io') for mod in typemods.values()), typemods
+for t, mod in typemods.items():
+if t is _io.BlockingIOError:
+assert mod == '__builtin__'
+elif t is _io.UnsupportedOperation:
+assert mod == 'io'
+else:
+assert mod == '_io'
diff --git a/pypy/module/_io/test/test_stringio.py 
b/pypy/module/_io/test/test_stringio.py
--- a/pypy/module/_io/test/test_stringio.py
+++ b/pypy/module/_io/test/test_stringio.py
@@ -142,11 +142,6 @@
 exc_info = raises(TypeError, sio.write, 3)
 assert "int" in exc_info.value.args[0]
 
-def test_module(self):
-import io
-
-assert io.StringIO.__module__ == "_io"
-
 def test_newline_none(self):
 import io
 
diff --git a/pypy/module/pypyjit/test_pypy_c/test_buffers.py 
b/pypy/module/pypyjit/test_pypy_c/test_buffers.py
--- a/pypy/module/pypyjit/test_pypy_c/test_buffers.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_buffers.py
@@ -56,7 +56,7 @@
 guard_false(i99, descr=...)
 i100 = int_lshift(i98, 24)
 i101 = int_or(i97, i100)
-i102 = getfield_raw(50657056, descr=)
+i102 = getfield_raw(\d+, descr=)
 i103 = int_lt(i102, 0)
 guard_false(i103, descr=...)
 """)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py 
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -348,51 +348,6 @@
 loop, = log.loops_by_id("globalread", is_entry_bridge=True)
 assert len(loop.ops_by_id("globalread")) == 0
 
-def test_struct_module(self):
-def main():
-import struct
-i = 1
-while i < 1000:
-x = struct.unpack("i", struct.pack("i", i))[0] # ID: struct
-i += x / i
-return i
-
-log = self.run(main)
-assert log.result == main()
-
-loop, = log.loops_by_id("struct")
-if sys.maxint == 2 ** 63 - 1:
-extra = """
-i8 = int_ge(i4, -2147483648)
-guard_true(i8, descr=...)
-"""
-else:
-extra = ""
-# This could, of course stand some improvement, to remove all these
-# arithmatic ops, but we've removed all the core overhead.
-assert loop.match_by_id("struct", """
-guard_not_invalidated(descr=...)
-# struct.pack
-%(32_bit_only)s
-i11 = int_and(i4, 255)
-i13 = int_rshift(i4, 8)
-i14 = int_and(i13, 255)
-i16 = int_rshift(i13, 8)
-i17 = int_and(i16, 255)
-i19 = int_rshift(i16, 8)
-i20 = int_and(i19, 255)
-
-# struct.unpack
-i22 = int_lshift(i14, 8)
-i23 = int_or(i11, i22)
-i25 = int_lshift(i17, 16)
-i26 = int_or(i23, i25)
-i28 = int_ge(i20, 128)
-guard_false(i28, descr=...)
-i30 = int_lshift(i20, 24)
-i31 = int_or(i26, i30)
-""" % {"32_bit_only": extra})
-
 def test_eval(self):
 def main():
 i = 1
diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py 
b/pypy/module/pypyjit/test_pypy_c/test_struct.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
@@ -0,0 +1,84 @@
+from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
+
+
+class TestStruct(BaseTestPyPyC):
+def test_struct_function

[pypy-commit] pypy py3k: copy_reg is copyreg on py3k

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: py3k
Changeset: r71313:3d70a53d701b
Date: 2014-05-05 23:14 -0400
http://bitbucket.org/pypy/pypy/changeset/3d70a53d701b/

Log:copy_reg is copyreg on py3k

diff --git a/pypy/module/_ast/test/test_ast.py 
b/pypy/module/_ast/test/test_ast.py
--- a/pypy/module/_ast/test/test_ast.py
+++ b/pypy/module/_ast/test/test_ast.py
@@ -21,7 +21,7 @@
 assert isinstance(ast.__version__, str)
 
 def test_flags(self):
-from copy_reg import _HEAPTYPE
+from copyreg import _HEAPTYPE
 assert self.ast.AST.__flags__ & _HEAPTYPE == 0
 assert self.ast.Module.__flags__ & _HEAPTYPE == _HEAPTYPE
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: __builtin__ -> builtins

2014-05-05 Thread bdkearns
Author: Brian Kearns 
Branch: py3k
Changeset: r71314:920b78b33122
Date: 2014-05-05 23:18 -0400
http://bitbucket.org/pypy/pypy/changeset/920b78b33122/

Log:__builtin__ -> builtins

diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -385,7 +385,7 @@
 if isinstance(t, type))
 for t, mod in typemods.items():
 if t is _io.BlockingIOError:
-assert mod == '__builtin__'
+assert mod == 'builtins'
 elif t is _io.UnsupportedOperation:
 assert mod == 'io'
 else:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix test

2014-05-05 Thread mattip
Author: mattip 
Branch: 
Changeset: r71315:777bfc76bd25
Date: 2014-05-06 08:41 +0300
http://bitbucket.org/pypy/pypy/changeset/777bfc76bd25/

Log:fix test

diff --git a/rpython/translator/goal/richards.py 
b/rpython/translator/goal/richards.py
--- a/rpython/translator/goal/richards.py
+++ b/rpython/translator/goal/richards.py
@@ -102,13 +102,13 @@
 self.task_waiting = False
 self.task_holding = False
 return self
-
+
 def waitingWithPacket(self):
 self.packet_pending = True
 self.task_waiting = True
 self.task_holding = False
 return self
-
+
 def isPacketPending(self):
 return self.packet_pending
 
@@ -154,6 +154,7 @@
 self.holdCount = 0
 self.qpktCount = 0
 
+taskWorkArea = TaskWorkArea()
 
 class Task(TaskState):
 
@@ -235,7 +236,7 @@
 if t is None:
 raise Exception("Bad task id %d" % id)
 return t
-
+
 
 # DeviceTask
 
@@ -309,7 +310,7 @@
 else:
 i.control = i.control/2 ^ 0xd008
 return self.release(I_DEVB)
-
+
 
 # WorkTask
 
@@ -384,7 +385,7 @@
 wkq = None;
 DeviceTask(I_DEVA, 4000, wkq, TaskState().waiting(), 
DeviceTaskRec());
 DeviceTask(I_DEVB, 5000, wkq, TaskState().waiting(), 
DeviceTaskRec());
-
+
 schedule()
 
 if taskWorkArea.holdCount == 9297 and taskWorkArea.qpktCount == 
23246:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit