[issue45620] A misleading url in 'Floating Point Arithmetic' page
Akuli added the comment: If you still have the problem, can you show us what headers your browser sends to websites? You can see that by running in Python: import socket print(socket.create_server(('127.0.0.1', 12345)).accept()[0].recv(1024).decode()) and then going to http://localhost:12345/ in your browser. I'm especially interested in the line that starts with Accept-Language. For me, the site now works, and my Accept-Language header is: Accept-Language: en-US,en;q=0.9,fi;q=0.8,sv;q=0.7,pt;q=0.6,it;q=0.5,zh-CN;q=0.4,zh;q=0.3 -- ___ Python tracker <https://bugs.python.org/issue45620> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers
Akuli added the comment: I now agree that `# type: ignore` in dict subclasses makes sense the most, and exposing the views doesn't solve practical problems. We talked more with the people who brought this up in typing. Turns out that the correct solution to their problems was to just inherit from MutableMapping instead of inheriting from dict. If you really need to inherit from dict and make .keys() do something else than it does by default, you're most likely trying to override all dict methods that do something with the keys, and you should just inherit from MutableMapping instead. -- ___ Python tracker <https://bugs.python.org/issue46399> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers
Akuli added the comment: > I also think that keeping a status quo (ignoring the mapping attribute in > typing) is the lesser evil. Can you clarify this? There are several things that typing could do, and I don't know which option you are referring to. I listed most of them below, and I'd like to know which exactly of them "is the lesser evil". If we literally ignore the attribute, any usage of `.mapping` will be an error, which basically makes the whole `.mapping` feature useless for statically typed code. It also wouldn't appear in IDE autocompletions. If we add it to `KeysView` and `ValuesView`, library authors will end up using `.mapping` with arguments annotated as `Mapping` or `MutableMapping`, not realizing it is purely a dict thing, not required from an arbitrary mapping object. If we keep `.mapping` in dict but not anywhere else, as described already, it becomes difficult to override .keys() and .values() in a dict subclass. You can't just return a KeysView or a ValuesView. If that was allowed, how should people annotate code that uses `.mapping`? You can't annotate with `dict`, because that also allows subclasses of dict, which might not have a `.mapping` attribute. Yet another option would be to expose `dict_keys` and `dict_values` somewhere where they don't actually exist at runtime. This leads to code like this: from typing import Any, TYPE_CHECKING if TYPE_CHECKING: # A lie for type checkers to work. from something_that_doesnt_exist_at_runtime import dict_keys, dict_values else: # Runtime doesn't check type annotations anyway. dict_keys = Any dict_values = Any While this works, it isn't very pretty. -- nosy: +Akuli ___ Python tracker <https://bugs.python.org/issue46399> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45620] A misleading url in 'Floating Point Arithmetic' page
Akuli added the comment: Thanks! Works for me in browser now. -- ___ Python tracker <https://bugs.python.org/issue45620> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45620] A misleading url in 'Floating Point Arithmetic' page
Akuli added the comment: To me, it redirects or doesn't redirect to the drugs site, depending on what Accept-Language header your browser sends. And when the redirecting happens, the site is in chinese. (I don't speak chinese, and I don't know why my browser is sending zh-CN in Accept-Language.) akuli@akuli-desktop:~$ curl -s -H 'Accept-Language: en-US,en;q=0.9' https://www.lahey.com/float.htm | head Lahey - Floating point akuli@akuli-desktop:~$ curl -s -H 'Accept-Language: en-US,en;q=0.9,zh-CN;q=0.4' https://www.lahey.com/float.htm | head Document Moved Object MovedThis document may be found https://www.hmbags.tw/";>here Incognito mode worked for me, because it sends `Accept-Language: en-US,en;q=0.9` without any additional languages. -- nosy: +Akuli ___ Python tracker <https://bugs.python.org/issue45620> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44021] enum docs in 3.10: missing "New in version 3.10"
Change by Akuli : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue44021> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44592] tkinter focus_get() with non-tkinter Tk widget
Akuli added the comment: Typo in previous message: I meant `widget.focus_get() is None`. It currently means "this application doesn't have focus", while `is not None` currently means "this application has focus". -- ___ Python tracker <https://bugs.python.org/issue44592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44592] tkinter focus_get() with non-tkinter Tk widget
Akuli added the comment: Here are the options: - Do nothing. My program will error in some corner cases. - Change it to return `None`, so `widget.focus_get() is not None` no longer means "this application doesn't have focus", but rather "this application doesn't have focus or the focused widget was not created in tkinter". Note that `focus_get()` can already return None, and we would just add one more situation where it does so. - Change tkinter so that it doesn't matter whether a widget was created in tkinter or not. This doesn't seem to be easy. -- ___ Python tracker <https://bugs.python.org/issue44592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44592] tkinter focus_get() with non-tkinter Tk widget
Akuli added the comment: Unfortunately I don't know any real-world examples of this on Windows. The open file dialog works very differently on Windows: it uses the native Windows dialog, whereas on Linux, it's implemented in Tcl. Meanwhile, here's a platform-independent toy example: import tkinter root = tkinter.Tk() root.tk.eval(""" entry .e pack .e focus .e """) root.after(500, root.focus_get) root.mainloop() Also, thanks for reopening! -- resolution: duplicate -> status: closed -> open ___ Python tracker <https://bugs.python.org/issue44592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44592] tkinter focus_get() with non-tkinter Tk widget
Akuli added the comment: I found issue734176 before I created this. It is NOT a duplicate. While issue734176 is about menus, this one is about focus_get(), and not necessarily related to menus. In fact, I initially noticed this with an "open file" dialog, not with a menu. I'm not putting my address into your CLA, thank you very much. -- ___ Python tracker <https://bugs.python.org/issue44592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44592] tkinter focus_get() with non-tkinter Tk widget
Akuli added the comment: Forgot to mention: The correct fix IMO would be to return None when a KeyError occurs. This way code like `focus_get() == some_tkinter_widget` would always do the right thing, for example. -- ___ Python tracker <https://bugs.python.org/issue44592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44592] tkinter focus_get() with non-tkinter Tk widget
New submission from Akuli : The purpose of focus_get() is to return the widget that currently has the focus. It tries to convert its result to a tkinter widget, which can fail, because not all Tk widgets are known to tkinter. Consider this, for example: import tkinter def print_focused_widget(): print(repr(root.focus_get())) root.after(1000, print_focused_widget) root = tkinter.Tk() menu = root["menu"] = tkinter.Menu() menu.add_cascade(label="Click here", menu=tkinter.Menu()) print_focused_widget() tkinter.mainloop() Output, with menu clicked after a couple seconds (on Linux): None Exception in Tkinter callback Traceback (most recent call last): File "/home/akuli/.local/lib/python3.10/tkinter/__init__.py", line 1916, in __call__ return self.func(*args) File "/home/akuli/.local/lib/python3.10/tkinter/__init__.py", line 838, in callit func(*args) File "/home/akuli/porcu/foo.py", line 4, in print_focused_widget print(repr(root.focus_get())) File "/home/akuli/.local/lib/python3.10/tkinter/__init__.py", line 782, in focus_get return self._nametowidget(name) File "/home/akuli/.local/lib/python3.10/tkinter/__init__.py", line 1531, in nametowidget w = w.children[n] KeyError: '#!menu' Some nametowidget() calls in tkinter/__init__.py already handle this correctly. Consider winfo_children(), for example: try: # Tcl sometimes returns extra windows, e.g. for # menus; those need to be skipped result.append(self._nametowidget(child)) except KeyError: pass -- components: Tkinter messages: 397199 nosy: Akuli priority: normal severity: normal status: open title: tkinter focus_get() with non-tkinter Tk widget type: behavior versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue44592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44021] enum docs in 3.10: missing "New in version 3.10"
New submission from Akuli : https://docs.python.org/3.10/library/enum.html says "New in version 3.10: StrEnum". That's true, but these are also new in 3.10: - property (I mean enum.property, not the built-in property) - global_enum - FlagBoundary - StrEnum - EnumType (does this even exist? I compiled the latest python today and I don't have this) -- assignee: docs@python components: Documentation messages: 392824 nosy: Akuli, docs@python priority: normal severity: normal status: open title: enum docs in 3.10: missing "New in version 3.10" versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue44021> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43018] unwanted label showing up in ttk.LabeledScale
New submission from Akuli : import tkinter from tkinter import ttk root = tkinter.Tk() ttk.LabeledScale(root).pack() root.mainloop() Run this code and move the slider to center. You see something in front of the number. The problem is this line in ttk.py: tmp = Label(self).pack(side=label_side) # place holder I tried deleting it, but then the label doesn't show up at all, and what remains is just a scale. Packing with a different side works, but that feels like a hack. -- components: Tkinter files: .png messages: 385591 nosy: Akuli priority: normal severity: normal status: open title: unwanted label showing up in ttk.LabeledScale versions: Python 3.9 Added file: https://bugs.python.org/file49765/.png ___ Python tracker <https://bugs.python.org/issue43018> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40666] TarFile.add does not support pathlib.Path as a value to first argument.
New submission from Akuli : TarFile.add seems to support pathlib.Path objects (and other PathLike string paths) starting at Python 3.6, for both name and arcname. The paths go to `os.path` functions that return strings. Recently typeshed was updated to support passing pathlib.Paths in TarFile.add: https://github.com/python/typeshed/pull/4369 -- nosy: +Akuli ___ Python tracker <https://bugs.python.org/issue40666> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41409] deque.pop(index) is not supported
Akuli added the comment: I don't think it's very common to write code that needs to work with any MutableSequence but not with any Sequence. I think that's the only situation where missing support for deque.pop(index) is a problem. Maybe deque should be a Sequence but not a MutableSequence. Or maybe there should be a way to say "MutableSequence does not require support for .pop(index) even though you get it by inheriting from MutableSequence". -- ___ Python tracker <https://bugs.python.org/issue41409> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41409] deque.pop(index) is not supported
Akuli added the comment: I meant MutableSequence instead of MutableMapping. Oops. -- ___ Python tracker <https://bugs.python.org/issue41409> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41409] deque.pop(index) is not supported
New submission from Akuli : The pop method of collections.deque can't be used like deque.pop(index), even though `del deque[index]` or deque.pop() without an argument works. This breaks the Liskov substitution principle because collections.abc.MutableMapping supports the .pop(index) usage. Is this intentional? related typeshed issue: https://github.com/python/typeshed/issues/4364 -- components: Library (Lib) messages: 374378 nosy: Akuli priority: normal severity: normal status: open title: deque.pop(index) is not supported ___ Python tracker <https://bugs.python.org/issue41409> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41384] tkinter raises TypeError when it's supposed to raise TclError
New submission from Akuli : from Lib:tkinter/__init__.py: raise TclError('unknown option -'+kwargs.keys()[0]) This is no longer valid in Python 3. -- components: Tkinter messages: 374188 nosy: Akuli priority: normal pull_requests: 20748 severity: normal status: open title: tkinter raises TypeError when it's supposed to raise TclError ___ Python tracker <https://bugs.python.org/issue41384> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30978] str.format_map() silences exceptions in __getitem__
Akuli added the comment: Oops, I forgot to mention that I have no thoughts about backporting this. It would be nice to see this fixed in 3.7 though :) -- ___ Python tracker <http://bugs.python.org/issue30978> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30978] str.format_map() silences exceptions in __getitem__
Akuli added the comment: I think all exceptions should be passed through. Things like dict.__contains__ don't selectively turn some errors to KeyError either; if something is not hashable it's a TypeError, not a KeyError. >>> [] in {} Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' -- ___ Python tracker <http://bugs.python.org/issue30978> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30978] str.format_map() silences exceptions in __getitem__
New submission from Akuli: Example: class BrokenMapping: def __getitem__(self, key): 1/0 # this silences the ZeroDivisionError and raises KeyError('world') 'hello {world}'.format_map(BrokenMapping()) I have tried this on several different CPython versions on Ubuntu 14.04 (including the latest Python 3.7.0a0 from github) and they all do this. PyPy passes the ZeroDivisionError through correctly. -- messages: 298747 nosy: Akuli priority: normal severity: normal status: open title: str.format_map() silences exceptions in __getitem__ type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.7 ___ Python tracker <http://bugs.python.org/issue30978> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com