IBM / db2sock-ibmi

An asynchronous PASE Db2 and IBM i integration library
MIT License
4 stars 7 forks source link

xrange() was removed in Python 3 in favor of range() #38

Closed cclauss closed 5 years ago

cclauss commented 5 years ago

This PR provides equivalent functionality on both Python 2 and Python 3.

flake8 testing of https://github.com/IBM/db2sock-ibmi on Python 3.7.1

$ flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics

./toolkit/proc/gen.py:192:36: F821 undefined name 'strw'
        srvpgm_c_byval += '*(fool'+strw+'_t *)iNextVal(layout, '+stri+')'
                                   ^
./toolkit/proc/gen.py:256:12: F821 undefined name 'xrange'
  for i in xrange(2**n):
           ^
2     F821 undefined name 'strw'
2

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

kadler commented 5 years ago

We don't need to be Python 2 compatible. Can you change it to just use range instead?

kadler commented 5 years ago

Thanks for the PR. You're doing a great service fixing all these Python 3 issues!

cclauss commented 5 years ago

This still remains...

./toolkit/proc/gen.py:192:36: F821 undefined name 'strw'
        srvpgm_c_byval += '*(fool'+strw+'_t *)iNextVal(layout, '+stri+')'
                                   ^