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

Discontinue Python 2 support #219

Closed
3 tasks done
untitaker opened this issue Jun 14, 2015 · 4 comments
Closed
3 tasks done

Discontinue Python 2 support #219

untitaker opened this issue Jun 14, 2015 · 4 comments
Assignees
Milestone

Comments

@untitaker
Copy link
Member

untitaker commented Jun 14, 2015

urlencoding

I used to think that Python 3 will be more daunting in Unicode support, but
I've been wrong: Both Python 2 and 3 have usually been equally hard to support.

Turns out that this was only the case until #218 and #215: urllib and urlparse
are completely broken under Python 2, they don't support unicode strings at
all:

$ python2
Python 2.7.10 (default, May 26 2015, 04:16:29) 
[GCC 5.1.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib import quote
>>> quote(u'lolä')
/usr/lib/python2.7/urllib.py:1303: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode
 - interpreting them as being unequal
  return ''.join(map(quoter, s))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/urllib.py", line 1303, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xe4'
>>> quote('lolä')
'lol%C3%A4'
>>> 

Supporting URLs with unicode chars in them was (and is) a major pain in the
ass, on both versions. The stdlib on Python 2 doesn't help.

I'm not going to say that Python 3 is a strictly superior language: In fact I
think it will introduce severe performance regressions, and e.g. the string
model it uses for Unix filesystem APIs is oversimplifying things simply for the
sake of simplicity, not because that makes it more correct. This is wrong in
theory, in practice it would make things easier for me if I didn't have to
support Python 2.

I don't want to drop support for Python 2 in the next years, but perhaps stop
fixing unicode bugs on it.
FUCK IT

other things


plan


fixes #315
fixes #316

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@WhyNotHugo
Copy link
Member

+1 for this.

A warning that unicode URLs (and other features) are only supported via python3 might be enough, and a sane approach

On a less conservative approach, I know several large distros still don't have python3 as the default python, but is it at least bundled by default? If that's the case, changing the hashbang to python3 on setup.py and a few other places would make picking up python 3 the default (we just need to be sure it's commonly installed).

@untitaker
Copy link
Member Author

Not sure that's going to affect anything, most direct installations do python setup.py install since setup.py is usually not executable.

@untitaker
Copy link
Member Author

Another thing is that ^C doesn't work properly on Python 2.

@untitaker
Copy link
Member Author

I've edited the OP to add a few other py2-vs-3 problems that affect vdirsyncer.

untitaker added a commit that referenced this issue Jan 23, 2016
untitaker added a commit that referenced this issue Jan 24, 2016
untitaker added a commit that referenced this issue Jan 24, 2016
@untitaker untitaker changed the title Discourage Python 2? Discontinue Python 2 support Mar 4, 2016
untitaker added a commit that referenced this issue Apr 28, 2016
The error can be disabled with a config option.

See #219
untitaker added a commit that referenced this issue Apr 28, 2016
* Show error for Python 2 users

The error can be disabled with a config option.

See #219
untitaker added a commit that referenced this issue Sep 7, 2016
@untitaker untitaker self-assigned this Sep 7, 2016
untitaker added a commit that referenced this issue Sep 8, 2016
* Discontinue Python 2.

See #219

* Remove Python 2 config option

* Remove coerce_native

* Remove PY2 variable

* s/text_type/str/g

* Flake8 fixes

* Remove str = str

* s/to_native/to_unicode/g

* Remove to_unicode = to_unicode

* Remove iteritems

* Remove itervalues

* Remove str import, flake8 fixes

* Remove urlparse compat code

* Remove with_metaclass

* Remove unused PY2 variable

* Remove getargspec_ish

* Remove to_bytes

* Remove compat module

* Remove Python 2 from Travis

* fixup! Remove urlparse compat code

* fixup! Remove urlparse compat code

* fixup! Remove compat module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants