Skip to content

Commit 6d4e9f0

Browse files
committed
fix: 3-alpine
1 parent f672159 commit 6d4e9f0

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

docs/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* enh (run): settings accepts subclasses (-> shorter notation)
66
* enh: [CliSettings][mininterface.settings.CliSettings]
77
* fix: Countdown won't stop on Alt+Tab.
8+
* fix: 3-alpine
89

910
## 1.1.2 (2025-10-01)
1011
* feat: timeout parameter for alert & confirm

mininterface/_mininterface/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,15 @@ class Env:
9090
# NOTE docs that
9191
# m = run([Env, Env2]) -> .env will be the chosen one.
9292

93-
self._adaptor = self.__annotations__["_adaptor"](self, settings)
93+
# Why using `type(self)` instead of `self.__annotations__`?
94+
# Always access annotations via the class, not the instance.
95+
# Some mixins or Generic from typing may prevent instances from having __annotations__.
96+
# Using type(self).__annotations__ ensures compatibility across Python versions and platforms.
97+
#
98+
# Example: on Alpine Python 3-alpine image, accessing self.__annotations__ raised AttributeError.
99+
# Hypothesis: the combination of typing.Generic + musl libc build altered the metaclass behavior,
100+
# causing __annotations__ to not be automatically set on the instance.
101+
self._adaptor = type(self).__annotations__["_adaptor"](self, settings)
94102

95103
def __enter__(self) -> "Self":
96104
"""Usage within the with statement makes the program to attempt for the following benefits:

mininterface/_tk_interface/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ def prevent_submit(event):
165165
# Only prevent form submission, don't affect Tab navigation
166166
return None # Allow event propagation for other handlers
167167

168-
for tag, field_form in zip(flatten(form), flatten(nested_widgets)):
168+
fform = list(flatten(form))
169+
for tag, field_form in zip(fform, flatten(nested_widgets)):
169170
tag: Tag
170171
field_form: FieldForm
171172
label1: Widget = field_form.label
@@ -193,8 +194,7 @@ def prevent_submit(event):
193194
match tag:
194195
case SelectTag():
195196
grid_info = widget.grid_info()
196-
single = len(dict_removed_main(form)) == 1
197-
wrapper = SelectInputWrapper(master, tag, grid_info, widget, adaptor, single)
197+
wrapper = SelectInputWrapper(master, tag, grid_info, widget, adaptor, len(fform) == 1)
198198
select_tag = True
199199
variable = wrapper.variable_wrapper
200200
# since tkinter variables do not allow objects,

0 commit comments

Comments
 (0)