This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sobolevn
Recipients docs@python, ilyagr, sobolevn, terry.reedy, zach.ware
Date 2021-12-23.11:10:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640257840.1.0.676227007412.issue43424@roundup.psfhosted.org>
In-reply-to
Content
Hm, looks like `.name` does not exist for `MacOSXOSAScript`:

```
Python 3.11.0a3+ (heads/main-dirty:71ef0b4c2b, Dec 23 2021, 12:38:09) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.get()
<webbrowser.MacOSXOSAScript object at 0x105a75500>
>>> a = webbrowser.get()
>>> dir(a)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_name', 'args', 'open', 'open_new', 'open_new_tab']
>>> a.name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'MacOSXOSAScript' object has no attribute 'name'. Did you mean: '_name'?
```

This happens because `MacOSXOSAScript` does not call `super().__init__()` in any way, nor it defines `name` and `basename` attributes.

It has this API for 12 years now: https://github.com/python/cpython/commit/4d39f6e09a5c0a0e09eb51d678bacd1adaa3f2ca

So, I see two possible ways to solve this:
1. Ensure all subtypes of `BaseBrowser` to have `name` and `basename` (because they are defined in `BaseBrowser`) and document them
2. Add a code comment that they are just implementation details and not a part of the public API
History
Date User Action Args
2021-12-23 11:10:40sobolevnsetrecipients: + sobolevn, terry.reedy, docs@python, zach.ware, ilyagr
2021-12-23 11:10:40sobolevnsetmessageid: <1640257840.1.0.676227007412.issue43424@roundup.psfhosted.org>
2021-12-23 11:10:40sobolevnlinkissue43424 messages
2021-12-23 11:10:39sobolevncreate