Re: svn commit: r1814386 - in /subversion/branches/swig-py3: build/generator/swig/ build/generator/util/ subversion/bindings/swig/python/svn/ subversion/bindings/swig/python/tests/ subversion/bindings/swig/python/tests/trac/versioncontrol/ subversion/bindi...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1814386 - in /subversion/branches/swig-py3: build/generator/swig/ build/generator/util/ subversion/bindings/swig/python/svn/ subversion/bindings/swig/python/tests/ subversion/bindings/swig/python/tests/trac/versioncontrol/ subversion/bindi...

Daniel Shahaf-2
[hidden email] wrote on Mon, 06 Nov 2017 01:58 +0000:
> +++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py Mon Nov  6 01:58:20 2017
> @@ -53,17 +53,19 @@ import shutil
>  if sys.version_info[0] >= 3:

>  else:
>    # Python <3.0
>    try:
> -    from cStringIO import StringIO
> +    from io import StringIO
>    except ImportError:
> -    from StringIO import StringIO
> +    from io import StringIO

Is this intended to catch transient disk errors or something? :-)

> @@ -246,21 +249,21 @@ class SubversionRepositoryTestCase(unitt
>          diffs = self.repos.get_deltas('trunk/README.txt', 2, 'trunk/README.txt', 3)
>          self._cmp_diff((('trunk/README.txt', 2),
>                          ('trunk/README.txt', 3),
> -                        (Node.FILE, Changeset.EDIT)), diffs.next())
> -        self.assertRaises(StopIteration, diffs.next)
> +                        (Node.FILE, Changeset.EDIT)), next(diffs))
> +        self.assertRaises(StopIteration, lambda *args: next(diffs))

Should this be "lambda: next(diffs)" without variadicity?

>

Ack on the rest.

Cheers,

Daniel
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1814386 - in /subversion/branches/swig-py3: build/generator/swig/ build/generator/util/ subversion/bindings/swig/python/svn/ subversion/bindings/swig/python/tests/ subversion/bindings/swig/python/tests/trac/versioncontrol/ subversion/bindi...

Troy Curtis Jr


On Mon, Nov 6, 2017 at 7:33 AM Daniel Shahaf <[hidden email]> wrote:
[hidden email] wrote on Mon, 06 Nov 2017 01:58 +0000:
> +++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py Mon Nov  6 01:58:20 2017
> @@ -53,17 +53,19 @@ import shutil
>  if sys.version_info[0] >= 3:

>  else:
>    # Python <3.0
>    try:
> -    from cStringIO import StringIO
> +    from io import StringIO
>    except ImportError:
> -    from StringIO import StringIO
> +    from io import StringIO

Is this intended to catch transient disk errors or something? :-)

Transient gray matter errors?  Looks like I missed an unnecessary 2to3 conversion. And since it happens to work in 2.7 now, I had no import errors!  The whole block can be simplified a bit now that 2.7 is the minimum version.
 
> @@ -246,21 +249,21 @@ class SubversionRepositoryTestCase(unitt
>          diffs = self.repos.get_deltas('trunk/README.txt', 2, 'trunk/README.txt', 3)
>          self._cmp_diff((('trunk/README.txt', 2),
>                          ('trunk/README.txt', 3),
> -                        (Node.FILE, Changeset.EDIT)), diffs.next())
> -        self.assertRaises(StopIteration, diffs.next)
> +                        (Node.FILE, Changeset.EDIT)), next(diffs))
> +        self.assertRaises(StopIteration, lambda *args: next(diffs))

Should this be "lambda: next(diffs)" without variadicity?

I don't have a good explanation for this.  I distinctly remember having syntax errors trying to do just that, and running across the '*args' method in my search for the right syntax...however your syntax works perfectly find in both my 2.7 and 3.6.  I also did not find the web reference for '*args' again that I seem to remember.  More transient gray matter errors perhaps!?  I'll get that fixed up as well.

Thanks for the review!
Troy