[issue38780] SysLogHandler crash atexit

2021-01-06 Thread Alan Robertson


Alan Robertson  added the comment:

As far as I know, this only happens during shutdown. During shutdown it has 
already removed the attribute as part of the teardown process. In this case 
adding the attribute at the begining will do no good.

On Wed, Jan 6, 2021, at 10:30 AM, Vinay Sajip wrote:
> 
> Vinay Sajip  added the comment:
> 
> TBH as I said in the now-closed PR, using a NullSocket seems overkill. 
> As mentioned in msg359594, it seems to make more sense to assign a 
> socket attribute to None early in the constructor. If an error occurs 
> during socket creation, the socket attribute will remain at None. When 
> closing, just ensure the socket attribute isn't None before trying to 
> close it. This mirrors what SocketHandler does.
> 
> --
> 
> ___
> Python tracker 
> <https://bugs.python.org/issue38780>
> ___
>

--

___
Python tracker 
<https://bugs.python.org/issue38780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38780] SysLogHandler crash atexit

2021-01-06 Thread Alan Robertson


Alan Robertson  added the comment:

On Wed, Jan 6, 2021, at 10:30 AM, Vinay Sajip wrote:
> 
> Vinay Sajip  added the comment:
> 
> TBH as I said in the now-closed PR, using a NullSocket seems overkill. 
> As mentioned in msg359594, it seems to make more sense to assign a 
> socket attribute to None early in the constructor. If an error occurs 
> during socket creation, the socket attribute will remain at None. When 
> closing, just ensure the socket attribute isn't None before trying to 
> close it. This mirrors what SocketHandler does.
> 
> --
> 
> ___
> Python tracker 
> <https://bugs.python.org/issue38780>
> ___
>

-- 
  Alan Robertson
  al...@unix.sh

--

___
Python tracker 
<https://bugs.python.org/issue38780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39841] "as" variable in except block deletes local variables with same name

2020-03-03 Thread Alan Robertson


Alan Robertson  added the comment:

Thanks for your kind explanation. I may even vaguely remember seeing this 
sometime in the past. Thanks much for your time!

--

___
Python tracker 
<https://bugs.python.org/issue39841>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39841] "as" variable in except block deletes local variables with same name

2020-03-03 Thread Alan Robertson


New submission from Alan Robertson :

When an exception "as" variable occurs, it deletes local variables with the 
same name. This is certainly surprising, and doesn't appear to be a documented 
behavior (but maybe I don't know where to look). The word "bug" comes to mind.  
The following few lines of code illustrate it nicely:

def testme():
err = Exception("nothing worked")
try:
raise ValueError("no value")
except ValueError as err:
pass
print(err)

testme()

--
components: Interpreter Core
files: foo.py
messages: 363300
nosy: alanr
priority: normal
severity: normal
status: open
title: "as" variable in except block deletes local variables with same name
versions: Python 3.7
Added file: https://bugs.python.org/file48946/foo.py

___
Python tracker 
<https://bugs.python.org/issue39841>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38780] SysLogHandler crash atexit

2020-01-08 Thread Alan Robertson


Alan Robertson  added the comment:

There are a variety of different reasons this can fail, not just on MacOS. You 
could give it a bad IP address of a server, etc. [That was my particular case].

The constructor should create an attribute 'socket' and initialize it to None 
early on. Then, the close function in logging/handlers.py should check for 
None. Or alternatively, it shouldn't register the object with atexit until it's 
been constructed "well-enough".

--
nosy: +alanr

___
Python tracker 
<https://bugs.python.org/issue38780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com