Closed jahlives closed 5 years ago
ipaddress works when passing unicode. I'd rather fix the relatively few calls to ipaddress in pyspf than use the older and less supported library. Plus we want to keep moving toward python3.
I think making explicit calls for Unicode will make Python 3 harder, not easier. Unicode is the default in Python 3. You have to explicitly specify Unicode for Python 2 and then it's implicit in Python3. I'm not aware if any issues using ipaddr (and it is still maintained upstream - they recently did a new release), so I think the approach of using ipaddress on Python3 and ipaddr on Python2 is the right one. I've seen nothing but trouble with ipaddress on Python 2.
My recommendation is to merge the PR as is. It solves the problem without adding complexity to the code. It changes code I wrote and matches my original intent (the Python 2 ipaddress backport didn't exist then).
Hmm. I had turned pyspf-2.0-branch into master on my local repo, but couldn't figure out how to push to github. So I'll have to do this on 2.0 also. I made a pyspf-2.1 branch with a copy of master. I hate getting interrupted...
only import ipaddress module if running python3 else ensure that ipaddr is imported. At least in python 2.7.5 on Centos7 you get ugly exceptions with ipaddress module and unicode. Fixes issue #7