Bug #7659
closedException is not defined in blinker
0%
Description
I found this error in the error log from apache2:
Exception ignored in: <function BoundMethodWeakref.__init__.<locals>.remove at 0x7f8206f62400>
Traceback (most recent call last):
File "/var/mentat/venv/lib/python3.7/site-packages/blinker/_saferef.py", line 174, in remove
NameError: name 'Exception' is not defined
It happens on every page.
Also, the errors from /var/log/apache2/error.log
are not reported, not even on mentat-hub.
Updated by Rajmund Hruška over 1 year ago
The only reference I have found is here - https://github.com/pallets-eco/blinker/issues/52.
Updated by Rajmund Hruška over 1 year ago
Here is the code where the error occurs:
def remove(weak, self=self):
"""Set self.isDead to True when method or instance is destroyed."""
methods = self.deletion_methods[:]
del self.deletion_methods[:]
try:
del self.__class__._all_instances[self.key]
except KeyError:
pass
for function in methods:
try:
if callable(function):
function(self)
except Exception:
try:
traceback.print_exc()
except AttributeError:
...
I removed the try/catch block and I found out that a similar error occurs: NameError: name 'callable' is not defined
.
Then, I put dir(__builtins__)
in the code, which showed this:
['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
For some reason, type(__builtins__)
is <class 'dict'>
and not <class 'module'>
as I was expecting.
Updated by Rajmund Hruška over 1 year ago
As it is written in [1]
As an implementation detail, most modules have the name builtins made available as part of their globals. The value of builtins is normally either this module or the value of this module’s dict attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python.
__builtins__
can actually be dictionary.
Updated by Rajmund Hruška 9 months ago
- Status changed from New to Rejected
- Target version changed from Backlog to Rejected
This in no longer an issue on the new mentat-hub
.