Skip to content

Avoid repr crashes for MapAttribute descriptors - #1306

Open
miruky wants to merge 1 commit into
pynamodb:masterfrom
miruky:fix/map-attribute-descriptor-repr
Open

miruky wants to merge 1 commit into
pynamodb:masterfrom
miruky:fix/map-attribute-descriptor-repr

Conversation

@miruky

@miruky miruky commented Sep 20, 2026

Copy link
Copy Markdown

Rendering Model.get_attributes() raises AttributeError when a model contains a MapAttribute. Map descriptors deliberately have no attribute_values, but the inherited representation tries to read it.

Use the ordinary attribute representation for map descriptors and preserve the existing field representation for map values. Tests cover raw and typed descriptors, rendering the attribute dictionary, and empty and populated map values.

Fixes #1259.

Validated on macOS:

  • Regression tests: two failures on the original implementation; all five cases pass after the fix.
  • pytest tests/ -k "not ddblocal": 393 passed, 21 deselected on Python 3.8.20 and 3.12.13.
  • mypy . on Python 3.8.20, matching the typing CI environment: no issues in 62 source files.

DynamoDB Local integration tests and live AWS operations were not run.

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

Successfully merging this pull request may close these issues.

get_attributes() raises AttributeError on Office example

1 participant