#35090 closed Cleanup/optimization (fixed)
Enforce uniqueness on custom path converters
Reported by: | Adam Johnson | Owned by: | Salvo Polizzi |
---|---|---|---|
Component: | Core (URLs) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Salvo Polizzi | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
register_converter()
allows custom path converters to silently replace existing converters. This could lead to surprising behaviour, both when two places accidentally use the same custom name or when replacing a default converter. This could be particularly hard to debug if a third-party package uses a custom converter.
For example, say two modules register path converters named “year”. The first allows 1-4 digits:
class YearConverter: regex = r"[0-9]{1,4}" ... register_converter(YearConverter, "year")
Whilst the second requires exactly four digits:
class YearConverter: regex = r"[0-9]{4}" ... register_converter(YearConverter, "year")
Whichever module is loaded last will silently overwrite the other’s converter. URLs will then only be interpreted with that converter, leading to fewer URLs being matched than intended. This can be particularly difficult to spot as import order may change accidentally due to other code being rearranged.
See the full example project at https://github.com/adamchainz/django-ticket-35090
I propose that support for reusing path converter names be deprecated, eventually raising an exception. I think this should include the default names (int
etc.) as replacing them can break URLs from third-party packages.
Change History (25)
comment:1 by , 13 months ago
Description: | modified (diff) |
---|
comment:2 by , 13 months ago
Description: | modified (diff) |
---|
comment:3 by , 13 months ago
comment:4 by , 13 months ago
Type: | Bug → Cleanup/optimization |
---|
As for it's a cleanup not a bug. If someone registers converters with the same name as builtin converters, they will get what they deserve. What if they do it on purpose?
comment:5 by , 13 months ago
If someone registers converters with the same name as builtin converters, they will get what they deserve. What if they do it on purpose?
Even if done on purpose, users can break URLs in other parts of their project or packages unwittingly. If you need a modified int
converter, for example, there’s little harm in requiring it to have a different name, but potential harm in allowing silent replacement.
comment:6 by , 13 months ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
follow-up: 11 comment:8 by , 13 months ago
I'm not sure I understand the desired fix: is it to prevent any converter registered name overlap (ie a dynamic check at the time of project load)? or just a check against the Django/default's converters?
Would there be a way to override registered converters?
comment:9 by , 13 months ago
Patch needs improvement: | unset |
---|
comment:10 by , 12 months ago
Needs documentation: | set |
---|---|
Owner: | changed from | to
Patch needs improvement: | set |
Status: | new → assigned |
comment:11 by , 12 months ago
Replying to Natalia Bidart:
I'm not sure I understand the desired fix: is it to prevent any converter registered name overlap (ie a dynamic check at the time of project load)? or just a check against the Django/default's converters?
I interpreted it as an issue to avoid overlapping among different registered converters, but please correct me if I misunderstood.
Would there be a way to override registered converters?
I honestly don't know if there is a possibility to override
comment:12 by , 12 months ago
Needs documentation: | unset |
---|
comment:13 by , 12 months ago
Patch needs improvement: | unset |
---|
comment:14 by , 12 months ago
Natalia, I propose preventing *any* overlap, that is, blocking the overriding of both the default and custom converters. Replacing a converter opens the possibility of “action at a distance” and a hard-to-debug lack of correct URL resolution. Unique names prevent that.
comment:15 by , 11 months ago
Patch needs improvement: | set |
---|
comment:16 by , 11 months ago
Patch needs improvement: | unset |
---|
I don't know why javascript tests are failing. If anyone can review the PR, please give me an advice on how to fix that problem.
comment:17 by , 11 months ago
Patch needs improvement: | set |
---|
comment:18 by , 11 months ago
Patch needs improvement: | unset |
---|
comment:19 by , 11 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:23 by , 3 days ago
Cc: | added |
---|
The removal of the deprecation code is causing failuires when the test suite is run in reverse:
====================================================================== ERROR [0.008s]: test_converter_reverse_with_second_layer_instance_namespace (urlpatterns.tests.SimplifiedURLTests.test_converter_reverse_with_second_layer_instance_namespace) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/test/utils.py", line 446, in inner return func(*args, **kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 181, in test_converter_reverse_with_second_layer_instance_namespace url = reverse("instance-ns-base64:subsubpattern-base64", kwargs=kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 64, in reverse app_list = resolver.app_dict[ns] ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 637, in app_dict self._populate() ~~~~~~~~~~~~~~^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 548, in _populate for url_pattern in reversed(self.url_patterns): ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== ERROR [0.000s]: test_converter_reverse (urlpatterns.tests.SimplifiedURLTests.test_converter_reverse) (url='base64') ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 174, in test_converter_reverse url = reverse(url_name, kwargs=kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 98, in reverse resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 749, in _reverse_with_prefix self._populate() ~~~~~~~~~~~~~~^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 548, in _populate for url_pattern in reversed(self.url_patterns): ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== ERROR [0.000s]: test_converter_reverse (urlpatterns.tests.SimplifiedURLTests.test_converter_reverse) (url='subpattern-base64') ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 174, in test_converter_reverse url = reverse(url_name, kwargs=kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 98, in reverse resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 749, in _reverse_with_prefix self._populate() ~~~~~~~~~~~~~~^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 548, in _populate for url_pattern in reversed(self.url_patterns): ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== ERROR [0.015s]: test_converter_reverse (urlpatterns.tests.SimplifiedURLTests.test_converter_reverse) (url='namespaced-base64:subpattern-base64') ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 174, in test_converter_reverse url = reverse(url_name, kwargs=kwargs) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 64, in reverse app_list = resolver.app_dict[ns] ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 637, in app_dict self._populate() ~~~~~~~~~~~~~~^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 548, in _populate for url_pattern in reversed(self.url_patterns): ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== ERROR [0.000s]: test_converter_resolve (urlpatterns.tests.SimplifiedURLTests.test_converter_resolve) (url='/base64/aGVsbG8=/') ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 163, in test_converter_resolve match = resolve(url) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 25, in resolve return get_resolver(urlconf).resolve(path) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 666, in resolve for pattern in self.url_patterns: ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== ERROR [0.000s]: test_converter_resolve (urlpatterns.tests.SimplifiedURLTests.test_converter_resolve) (url='/base64/aGVsbG8=/subpatterns/d29ybGQ=/') ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 163, in test_converter_resolve match = resolve(url) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 25, in resolve return get_resolver(urlconf).resolve(path) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 666, in resolve for pattern in self.url_patterns: ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== ERROR [0.010s]: test_converter_resolve (urlpatterns.tests.SimplifiedURLTests.test_converter_resolve) (url='/base64/aGVsbG8=/namespaced/d29ybGQ=/') ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 163, in test_converter_resolve match = resolve(url) File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/base.py", line 25, in resolve return get_resolver(urlconf).resolve(path) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 666, in resolve for pattern in self.url_patterns: ^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 718, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ~~~~~~~~~^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1022, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/path_base64_urls.py", line 5, in <module> register_converter(converters.Base64Converter, "base64") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/django/urls/converters.py", line 57, in register_converter raise ValueError(f"Converter {type_name!r} is already registered.") ValueError: Converter 'base64' is already registered. ====================================================================== FAIL [0.002s]: test_warning_override_converter (urlpatterns.tests.SimplifiedURLTests.test_warning_override_converter) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/main-reverse/database/postgres/label/focal/python/python3.13/tests/urlpatterns/tests.py", line 212, in test_warning_override_converter with self.assertRaisesMessage(ValueError, msg): ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/contextlib.py", line 148, in __exit__ next(self.gen) ~~~~^^^^^^^^^^ AssertionError: ValueError not raised
To reproduce: ./runtests.py --reverse urlpatterns
I've submitted a PR for this bug: https://github.com/django/django/pull/17703