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

Test suite fails with Python 3.8.1 #503

Closed
Ma27 opened this issue Dec 20, 2019 · 4 comments
Closed

Test suite fails with Python 3.8.1 #503

Ma27 opened this issue Dec 20, 2019 · 4 comments

Comments

@Ma27
Copy link

Ma27 commented Dec 20, 2019

This happens since urllib.parse parses URLs like path:80 as scheme=path,path=80 (https://bugs.python.org/issue27657).

Which causes errors like this:

def test_uri_value_allowed_protocols(data, kwargs, expected):
>       assert clean(data, **kwargs) == expected
E       assert '<a>valid</a>' == '<a href="192...00">valid</a>'
E         - <a>valid</a>
E         + <a href="192.168.100.100:8000">valid</a>

tests/test_clean.py:676: AssertionError

Currently preparing a patch for this :)

Ma27 added a commit to Ma27/nixpkgs that referenced this issue Dec 20, 2019
https://github.com/matrix-org/synapse/releases/tag/1.7.2

Building for now with Python 3.7 as Python 3.8.1 changed it's behavior
regarding URL parsing[1] which broke one of its dependencies[2].

[1] https://bugs.python.org/issue27657
[2] https://hydra.nixos.org/build/108652790 / mozilla/bleach#503
WilliButz pushed a commit to NixOS/nixpkgs that referenced this issue Dec 21, 2019
https://github.com/matrix-org/synapse/releases/tag/1.7.2

Building for now with Python 3.7 as Python 3.8.1 changed it's behavior
regarding URL parsing[1] which broke one of its dependencies[2].

[1] https://bugs.python.org/issue27657
[2] https://hydra.nixos.org/build/108652790 / mozilla/bleach#503

(cherry picked from commit 880e098)
hugovk added a commit to hugovk/bleach that referenced this issue Jan 28, 2020
hugovk added a commit to hugovk/bleach that referenced this issue Jan 28, 2020
This was referenced Jan 28, 2020
@hugovk
Copy link
Contributor

hugovk commented Jan 28, 2020

@Ma27 Hi, any progress with the patch? Thanks!

@Ma27
Copy link
Author

Ma27 commented Jan 28, 2020

Huh, I thought I provided a status update here as well, sorry!

Unfortunately I'm not sure if I actually want to work around this, the code already depends on some heuristics and I'm afraid that patching around in there will cause some mean regressions.

I still hope that the change gets reverted again: python/cpython#16839 (comment)

@kitterma
Copy link

I don't see much evidence of upstream python3.8 activity to revert. Even if they do, the same problem will occur once 3.9 is out, so it's got to be solved sooner or later.

@Ma27
Copy link
Author

Ma27 commented Apr 16, 2020

Even if they do, the same problem will occur once 3.9 is out, so it's got to be solved sooner or later.

Agreed. While taking a look at this a few months ago I realized though that sanitizing has more culprits than I anticipated, so unless the change is reverted, someone else should fix the library accordingly.

@Ma27 Ma27 closed this as completed Apr 16, 2020
hugovk added a commit to hugovk/bleach that referenced this issue Sep 14, 2020
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

No branches or pull requests

3 participants