Skip to content

Commit bef2dea

Browse files
authored
chore(release): 1.103.1 (#4630)
See [CHANGELOG](https://github.com/aws/jsii/blob/patch/v1.103.1/CHANGELOG.md) (Re-roll of #4628 which I messed up) --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
2 parents 3b9adc4 + 69c40cb commit bef2dea

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [1.103.1](https://github.com/aws/jsii/compare/v1.103.0...v1.103.1) (2024-08-30)
6+
7+
8+
### Bug Fixes
9+
10+
* **python:** user defined `__jsii_proxy_class` attributes are not preserved ([#4625](https://github.com/aws/jsii/issues/4625)) ([d3ec911](https://github.com/aws/jsii/commit/d3ec911a5d531e088524d2479e1ee831da0bc2ff))
11+
512
## [1.103.0](https://github.com/aws/jsii/compare/v1.102.0...v1.103.0) (2024-08-27)
613

714

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"rejectCycles": true
1313
}
1414
},
15-
"version": "1.103.0",
15+
"version": "1.103.1",
1616
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
1717
}

packages/@jsii/python-runtime/src/jsii/_runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def implements(*interfaces: Type[Any]) -> Callable[[T], T]:
168168
def deco(cls):
169169
cls.__jsii_type__ = getattr(cls, "__jsii_type__", None)
170170
cls.__jsii_ifaces__ = getattr(cls, "__jsii_ifaces__", []) + list(interfaces)
171-
cls.__jsii_proxy_class__ = lambda: getattr(cls, "__jsii_proxy_class__", None)
171+
cls.__jsii_proxy_class__ = getattr(cls, "__jsii_proxy_class__", lambda: None)
172172

173173
# https://github.com/agronholm/typeguard/issues/479
174174
cls.__protocol_attrs__ = getattr(cls, "__protocol_attrs__", [])

packages/@jsii/python-runtime/tests/test_python.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,37 @@ def test_inheritance_maintained(self):
2727

2828
assert base_names == ["DerivedStruct", "MyFirstStruct"]
2929

30+
31+
class TestImplementsInterface:
32+
33+
def test_jsii_proxy_class_defaults_to_none(self) -> None:
34+
@jsii.implements(IBaz)
35+
class MyBaz:
36+
pass
37+
38+
klass = getattr(MyBaz, "__jsii_proxy_class__")()
39+
assert klass == None
40+
41+
def test_jsii_proxy_class_preserves_user_defined_attribute(self) -> None:
42+
43+
class _MyBazProxy:
44+
def baz_method(self) -> str:
45+
return "_MyBazProxy"
46+
47+
@jsii.implements(IBaz)
48+
class MyBaz:
49+
50+
@staticmethod
51+
def __jsii_proxy_class__():
52+
return _MyBazProxy
53+
54+
def baz_method(self) -> str:
55+
return "MyBaz"
56+
57+
klass = getattr(MyBaz, "__jsii_proxy_class__")()
58+
instance = klass()
59+
assert instance.baz_method() == "_MyBazProxy"
60+
3061
def test_implements_interface(self) -> None:
3162
"""Checks that jsii-generated classes correctly implement the relevant jsii-generated interfaces."""
3263

0 commit comments

Comments
 (0)