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 3] Fix syntax changes #3

Closed
sigmavirus24 opened this Issue Dec 25, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@sigmavirus24
Copy link
Contributor

sigmavirus24 commented Dec 25, 2014

  • Print statements (See #4)

  • Raising of exceptions (e.g., raise ExceptionClass, msg) (See #6)

  • except statements (e.g., except ExceptionClass, e) (See #7)

  • Use of Longs (e.g., 1L)

  • Fix import statements. Implicit local imports are no longer valid. For example

    # old sqlobject/__init__.py
    """SQLObject"""
    from __version__ import version, version_info
    
    from col import *
    from index import *
    from joins import *
    from main import *
    from sqlbuilder import AND, OR, NOT, IN, LIKE, RLIKE, DESC, CONTAINSSTRING, const, func
    from styles import *
    from dbconnection import connectionForURI
    import dberrors
    
    # new
    """SQLObject"""
    from .__version__ import version, version_info  # Might actually be invalid syntax.
    
    from .col import *
    from .index import *
    from .joins import *
    from .main import *
    from .sqlbuilder import AND, OR, NOT, IN, LIKE, RLIKE, DESC, CONTAINSSTRING, const, func
    from .styles import *
    from .dbconnection import connectionForURI
    from . import dberrors

We should ensure that print statements are no longer allowed by the interpreter using from __future__ import print_function. I wish we had ways of making the interpreter enforce the others.

@phdru

This comment has been minimized.

Copy link
Member

phdru commented Dec 25, 2014

I always though the biggest problem with Py3 will be unicode: StringCol, UnicodeCol, BLOBCol, PickleCol…

@sigmavirus24

This comment has been minimized.

Copy link
Contributor

sigmavirus24 commented Dec 26, 2014

@phdru it will likely be the most annoying problem but before we can find those problems we need to get the tests running so we need to get rid of SyntaxErrors.

@phdru

This comment has been minimized.

Copy link
Member

phdru commented Dec 26, 2014

Yes, you are right!

@sigmavirus24 sigmavirus24 added this to the 3.0 milestone Dec 26, 2014

@sigmavirus24 sigmavirus24 referenced this issue Dec 26, 2014

Merged

Use new-style exception handling syntax #7

1 of 1 task complete

phdru added a commit that referenced this issue Feb 3, 2015

Merge pull request #58 from drnlm/Fix_relative_imports
Issue #3: Use relative imports

phdru added a commit that referenced this issue Feb 5, 2015

Merge pull request #59 from drnlm/more_import_fixes
Issue #3: More import fixes

This was referenced Feb 6, 2015

@phdru phdru modified the milestone: 3.0 Feb 6, 2015

phdru added a commit that referenced this issue Feb 14, 2015

Fixed in #3: W603 '<>' is deprecated, use '!='
Also already fixed:

E123 closing bracket does not match indentation
E226 missing whitespace around arithmetic operator

@phdru phdru closed this Jun 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment