[pypy-commit] pyrepl default: Pass correct number of arguments to commands.

Trundle noreply at buildbot.pypy.org
Sat Jan 5 00:53:09 CET 2013


Author: Andreas St?hrk <andy-python at hammerhartes.de>
Branch: 
Changeset: r204:3b7b8ac1ca43
Date: 2013-01-05 00:46 +0100
http://bitbucket.org/pypy/pyrepl/changeset/3b7b8ac1ca43/

Log:	Pass correct number of arguments to commands.

	Fixes issue #4.

diff --git a/pyrepl/reader.py b/pyrepl/reader.py
--- a/pyrepl/reader.py
+++ b/pyrepl/reader.py
@@ -526,7 +526,7 @@
             cmd = self.commands.get(cmd[0],
                                     commands.invalid_command)(self, *cmd)
         elif isinstance(cmd[0], type):
-            cmd = cmd[0](self, cmd)
+            cmd = cmd[0](self, *cmd)
         else:
             return  # nothing to do
 
diff --git a/testing/test_bugs.py b/testing/test_bugs.py
--- a/testing/test_bugs.py
+++ b/testing/test_bugs.py
@@ -17,15 +17,26 @@
 # CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-from .infrastructure import EA, read_spec
+from pyrepl.historical_reader import HistoricalReader
+from .infrastructure import EA, TestReader, read_spec
 
 # this test case should contain as-verbatim-as-possible versions of
 # (applicable) bug reports
 
 import pytest
 
+class HistoricalTestReader(HistoricalReader, TestReader):
+    pass
+
 @pytest.mark.xfail(reason='event missing', run=False)
 def test_transpose_at_start():
     read_spec([( 'transpose', [EA, '']),
                ( 'accept',    [''])])
 
+def test_cmd_instantiation_crash():
+    spec = [
+        ('reverse-history-isearch', ["(r-search `') "]),
+        (('key', 'left'), ['']),
+        ('accept', [''])
+    ]
+    read_spec(spec, HistoricalTestReader)


More information about the pypy-commit mailing list