zs-yaml 0.10.1.dev2__tar.gz → 0.10.1.dev4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/PKG-INFO +1 -1
  2. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/test_all_conversions.py +52 -1
  3. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml/_version.py +3 -3
  4. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml.egg-info/PKG-INFO +1 -1
  5. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/.github/workflows/ci.yml +0 -0
  6. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/.gitignore +0 -0
  7. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/CHANGELOG.md +0 -0
  8. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/LICENSE +0 -0
  9. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/README.md +0 -0
  10. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/api_docs_review.md +0 -0
  11. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/doc/zs-yaml.png +0 -0
  12. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/doc/zs-yaml.svg +0 -0
  13. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/extern_compression/extern_compression.zs +0 -0
  14. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/extern_compression/payload.yaml +0 -0
  15. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/extern_compression/test_compression.py +0 -0
  16. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/.gitignore +0 -0
  17. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/benchmark.py +0 -0
  18. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/generate_perf_yaml.py +0 -0
  19. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/perf.zs +0 -0
  20. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/perf_reference.bin +0 -0
  21. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/perf_reference_dict.sha256 +0 -0
  22. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/perf/test_fast_path.py +0 -0
  23. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/addresses.yaml +0 -0
  24. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/custom_transformations.py +0 -0
  25. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/hobbies.yaml +0 -0
  26. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/skills.yaml +0 -0
  27. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/team.zs +0 -0
  28. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/team1.yaml +0 -0
  29. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/test_pyobj_to_yaml.py +0 -0
  30. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/examples/team/work_experience.yaml +0 -0
  31. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/pyproject.toml +0 -0
  32. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/setup.cfg +0 -0
  33. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml/__init__.py +0 -0
  34. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml/built_in_transformations.py +0 -0
  35. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml/convert.py +0 -0
  36. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml/main.py +0 -0
  37. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml/yaml_transformer.py +0 -0
  38. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml.egg-info/SOURCES.txt +0 -0
  39. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml.egg-info/dependency_links.txt +0 -0
  40. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml.egg-info/entry_points.txt +0 -0
  41. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml.egg-info/requires.txt +0 -0
  42. {zs_yaml-0.10.1.dev2 → zs_yaml-0.10.1.dev4}/zs_yaml.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zs-yaml
3
- Version: 0.10.1.dev2
3
+ Version: 0.10.1.dev4
4
4
  Summary: YAML support for zserio
5
5
  Author-email: "Navigation Data Standard e.V." <support@nds-association.org>
6
6
  License-Expression: MIT
@@ -279,6 +279,56 @@ members:
279
279
  raise
280
280
 
281
281
 
282
+ def test_descriptor_cache_keyed_on_object_not_id():
283
+ """Regression: _COMPOUND_CACHE must not alias distinct TypeInfos by id().
284
+
285
+ Previously the cache keyed on ``id(type_info)`` while only storing the
286
+ descriptor. Each call to a generated ``type_info()`` returns a fresh
287
+ ``TypeInfo`` instance, so after GC reclaims one, a later call can land at
288
+ the same memory address and the cache returns a stale descriptor —
289
+ surfacing as ``'X' object has no attribute 'y'`` errors during
290
+ ``bin_to_dict`` / ``bin_to_yaml`` in long-running processes that load
291
+ multiple schemas.
292
+
293
+ We simulate the collision by seeding the cache with an int key matching
294
+ ``id(type_info)`` whose value is an unrelated descriptor, then verify the
295
+ lookup still returns the correct descriptor for that ``type_info``.
296
+ """
297
+ from team.api import Team, Person
298
+ from zs_yaml import convert
299
+
300
+ print("Testing _COMPOUND_CACHE id-reuse regression...")
301
+
302
+ ti_team = Team.type_info()
303
+ ti_person = Person.type_info()
304
+
305
+ convert._COMPOUND_CACHE.clear()
306
+ desc_team = convert._compound_descriptor(ti_team)
307
+ desc_person = convert._compound_descriptor(ti_person)
308
+ assert desc_team is not desc_person, "Distinct TypeInfos must produce distinct descriptors"
309
+
310
+ # Simulate the previous bug: an int key matching id(ti_person) carrying
311
+ # an unrelated descriptor (as if a freed TypeInfo had occupied that
312
+ # address before GC reclaimed it). A correctly-keyed cache (keyed on the
313
+ # TypeInfo object) ignores the stale int-keyed entry; a buggy id-keyed
314
+ # cache would return desc_team for ti_person.
315
+ convert._COMPOUND_CACHE[id(ti_person)] = desc_team
316
+ desc_person_again = convert._compound_descriptor(ti_person)
317
+
318
+ if desc_person_again is not desc_person:
319
+ team_fields = [f.schema_name for f in desc_team.fields]
320
+ person_fields_expected = [f.schema_name for f in desc_person.fields]
321
+ person_fields_actual = [f.schema_name for f in desc_person_again.fields]
322
+ raise AssertionError(
323
+ "_COMPOUND_CACHE returned a stale descriptor — id() reuse regression. "
324
+ f"Expected fields={person_fields_expected}, got={person_fields_actual} "
325
+ f"(matches Team fields={team_fields})."
326
+ )
327
+
328
+ print(" ✓ cache returns correct descriptor under simulated id() collision")
329
+ return True
330
+
331
+
282
332
  if __name__ == "__main__":
283
333
  try:
284
334
  # Run all tests
@@ -287,7 +337,8 @@ if __name__ == "__main__":
287
337
  test_json_to_yaml(json_path)
288
338
  test_bin_to_yaml()
289
339
  test_yaml_to_yaml_with_template_args()
290
-
340
+ test_descriptor_cache_keyed_on_object_not_id()
341
+
291
342
  print("\n✅ All conversion tests passed!")
292
343
  sys.exit(0)
293
344
  except Exception as e:
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.10.1.dev2'
22
- __version_tuple__ = version_tuple = (0, 10, 1, 'dev2')
21
+ __version__ = version = '0.10.1.dev4'
22
+ __version_tuple__ = version_tuple = (0, 10, 1, 'dev4')
23
23
 
24
- __commit_id__ = commit_id = 'g694552b85'
24
+ __commit_id__ = commit_id = 'gcb265bd81'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zs-yaml
3
- Version: 0.10.1.dev2
3
+ Version: 0.10.1.dev4
4
4
  Summary: YAML support for zserio
5
5
  Author-email: "Navigation Data Standard e.V." <support@nds-association.org>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes