One function

initpkg in pytest-dev/apipkg

The author described this change as fix typos and auto-obtain version from pkg_ressources. It counts as a record because the check below fails on the code as it stood at 4d840c3b3 and passes on a10f27e46, with nothing else changed between the two runs.

Fix saved2015-02-15
Sharing licenceMIT · LICENSE
Change size+3 1

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

initialize given package from the export definitions.

The change

88 d['__file__'] = f
99 if hasattr(oldmod, '__version__'):
1010 d['__version__'] = oldmod.__version__
11+ elif distribution_version(pkgname) is not None:
12+ d['__version__'] = distribution_version(pkgname)
1113 if hasattr(oldmod, '__loader__'):
1214 d['__loader__'] = oldmod.__loader__
1315 if hasattr(oldmod, '__path__'):
1921 oldmod.__dict__.update(d)
2022 mod = ApiModule(pkgname, exportdefs, implprefix=pkgname, attr=d)
2123 sys.modules[pkgname] = mod
22- # eaerload in bypthon to avoid their monkeypatching breaking packages
24+ # eagerload in bypthon to avoid their monkeypatching breaking packages
2325 if 'bpython' in sys.modules or eager:
2426 for module in sys.modules.values():
2527 if isinstance(module, ApiModule):

The check that tells the two apart

failpass·test_apipkg.py::test_autoset_version_attribute_from_distribution

Check file test_apipkg.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 it4d840c3b33c1dbc79849879bb969eee1bd6c12b9
Broken version dated2015-02-15
Moduleapipkg
Units changedinitpkg
Fingerprint47d8fc9447534e16
Checked2026-08-18 by goldset/0.1

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