Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python / Jython 2.2 support #1

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Conversation

clach04
Copy link

@clach04 clach04 commented Mar 30, 2012

Any interest in Jython 2.2 support? There are few holes but it mostly works.

I've also added 2.2 support to pystache, have you considered re-using (some of) the pystache test suite?

unknown added 2 commits March 29, 2012 14:16
json/js/node tests (with warning).

NOTE options to implement pep8 and unittests (rather than asserts), could
even reuse unittest from https://github.com/defunkt/pystache
…ng is

now optional. The Bool tests are also optional (and are not ran under
python 2.2). The reason for this is that the test suite hard fails (unlike
a unittest based one) and does not complete if failure are detected. I
attempted a Bool replacement but it didn't work and I'm unclear why. It
appeared to raise the exception TypeError exception in the wrong place
(could be a Jython 2.2 traceback bug).

if sys.version_info < (2, 3):
    # version 2.2
    # this kinda works BUT fails with this module's usage of len(Bool)
    # with Jython 2.2 :-(
    class MyBool:
        def __init__(self, is_true=None):
            self.is_true = is_true

        def __len__(self):
            raise TypeError('len() of unsized object')

        def __repr__(self):
            if self.is_true:
                return 'True'
            else:
                return 'False'
    True = MyBool(1)
    False = MyBool(0)
@hyperturtle
Copy link
Owner

Let me think about it for a while. are the change in _tokenize for pep8? or is that a jython 2.2/python 2.4 issue? Also for the tests, running pthong test.py is optional. If ran from nosetests, all tests are run even if one of them fails. Running test.py is just a convenience for me. I agree that the bool tests should be separate, the use case doesn't make much sense. I also like the itertools.takewhile fallback. Again, let me think about some of these changes and I'll try and incorporate some of these.

@clach04
Copy link
Author

clach04 commented Mar 30, 2012

All the changes are 2.4/2.2 related. The _tokenize() was for 2.4 (and earlier). I've not (yet) made an attempt on pep8 formatting changes, I was thinking about it (hence the comment in the commit for clach04/stache@25d633b ) :-)

The last time I tried nose it didn't work with 2.2. I may have to see if it is worth getting that working under 2.2.

clach04 and others added 20 commits April 9, 2012 13:53
Merged Unicode branch and code now works on almost all versions of Python
Extracted code from
SmithSamuelM@f2c591e

NOTE this no longer passes test suite as test suite is white space
sensitive, the test suite has not been updated. The test suite stops
on failure, more testing needed.
Working test suite to match previous test, adds a new test for
with and without white space.
py3 first, this avoids DeprecationWarning in older 3.x version (pre 3.8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants