Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lovasoa/marshmallow_dataclass
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.6.0
Choose a base ref
...
head repository: lovasoa/marshmallow_dataclass
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v8.6.1
Choose a head ref
  • 5 commits
  • 8 files changed
  • 4 contributors

Commits on Sep 17, 2023

  1. Do not ignore Union argument ordering in tests (#248)

    * Revert "Ignore union ordering"
    
    This reverts commit b61cd50.
    
    * test: mark expected failure, add separate test of its non-failing bits
    
    * ci(tests): report skipped/xfailed tests
    
    * docs(test): add link for context
    
    Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
    
    ---------
    
    Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
    dairiki and lovasoa authored Sep 17, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f315d71 View commit details

Commits on Sep 19, 2023

  1. Copy the full SHA
    d6396c1 View commit details

Commits on Mar 20, 2024

  1. Fix memory leak issue (#258)

    * Test for memory leaks as described in #198
    
    * Possible fix for #198: memory leak
    
    * Optimization: avoid holding frame reference when locals == globals
    
    * Get caller frame at decoration-time
    
    Here we are more careful about which caller's locals we use to
    resolve forward type references.  We want the callers locals
    at decoration-time — not at decorator-construction time.
    
    Consider:
    ```py
    frozen_dataclass = marshmallow_dataclass.dataclass(frozen=True)
    
    def f():
        @custom_dataclass
        class A:
            b: "B"
    
        @custom_dataclass
        class B:
            x: int
    ```
    
    The locals we want in this case are the one from where the
    custom_dataclass decorator is called, not from where
    marshmallow_dataclass.dataclass is called.
    
    * Add ability to pass explicit localns (and globalns) to class_schema
    
    When class_schema is called, it doesn't need the caller's whole stack
    frame.  What it really wants is a `localns` to pass to
    `typing.get_type_hints` to be used to resolve type references.
    
    Here we add the ability to pass an explicit `localns` parameter to
    `class_schema`.  We also add the ability to pass an explicit
    `globalns`, because ... might as well — it might come in useful.
    (Since we need these only to pass to `get_type_hints`, we might
    as well match `get_type_hints` API as closely as possible.)
    
    * test: check for frame leakage when decorators throw exceptions
    
    * Fix mypy by setting python to the minimum supported version, 3.8
    
    ---------
    
    Co-authored-by: Jeff Dairiki <dairiki@dairiki.org>
    mvanderlee and dairiki authored Mar 20, 2024
    Copy the full SHA
    9668980 View commit details
  2. v8.6.1

    dairiki committed Mar 20, 2024
    Copy the full SHA
    a60cea0 View commit details
  3. Update VERSION, (hopefully) really publish 8.6.1

    dairiki committed Mar 20, 2024
    Copy the full SHA
    c59cdb5 View commit details
Showing with 392 additions and 81 deletions.
  1. +1 −1 .github/workflows/python-package.yml
  2. +15 −0 CHANGELOG.md
  3. +190 −68 marshmallow_dataclass/__init__.py
  4. +1 −1 setup.py
  5. +28 −10 tests/test_field_for_schema.py
  6. +16 −0 tests/test_forward_references.py
  7. +140 −0 tests/test_memory_leak.py
  8. +1 −1 tests/test_mypy.yml
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -47,4 +47,4 @@ jobs:
if: ${{ matrix.python_version != 'pypy3' && matrix.python_version != '3.6' }}
run: pre-commit run --all-files
- name: Test with pytest
run: pytest
run: pytest -ra
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# marshmallow\_dataclass change log

## v8.6.1 (2024-03-20)

- (Mostly) fix [memory leak][#198] when using
`marshamallow_dataclass.dataclass` decorator. ([#258], thank you @mvanderlee!)
- Fix docstring formatting for `class_schema`. ([#249])
- Do not ignore `Union` argument ordering in tests. Note that a
[bug][#247] remains: semantically, `Union`s do not respect argument
order, yet order matters for de/serialization. ([#248])

[#198]: https://github.com/lovasoa/marshmallow_dataclass/issues/198
[#247]: https://github.com/lovasoa/marshmallow_dataclass/issues/247
[#248]: https://github.com/lovasoa/marshmallow_dataclass/pull/248
[#249]: https://github.com/lovasoa/marshmallow_dataclass/pull/249
[#258]: https://github.com/lovasoa/marshmallow_dataclass/pull/258

## v8.6.0 (2023-09-16)
- New field in associated Meta classes: `include_non_init`:
- This adds the ability to include non init-ed fields into the schema
Loading