One function

normpath in python-zk/kazoo

The author described this change as Creating a sequential znode under / fails (issue #261). It counts as a record because the check below fails on the code as it stood at 0e7c13ed6 and passes on 2e9d33cb5, with nothing else changed between the two runs.

Fix saved2014-12-18
Sharing licenceApache-2.0 · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Normalize path, eliminating double slashes, etc.

The change

1111 new_path = '/'.join(new_comps)
1212 if trailing is True and path.endswith('/'):
1313 new_path += '/'
14- if path.startswith('/'):
14+ if path.startswith('/') and new_path != '/':
1515 return '/' + new_path
1616 return new_path

The check that tells the two apart

failpass·kazoo/tests/test_paths.py::NormPathTestCase::test_normpath_trailing

Check file kazoo/tests/test_paths.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it0e7c13ed61c75c630553495820bb8a8e21f8c6dd
Broken version dated2014-12-16
Modulekazoo.protocol.paths
Units changednormpath
Fingerprinte6281113206ea3a5
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.