[issue44050] Exceptions in a subinterpreter are changed by another subinterpreter

2021-05-05 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> eric.snow
nosy: +eric.snow

___
Python tracker 

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



[issue44050] Exceptions in a subinterpreter are changed by another subinterpreter

2021-05-05 Thread Ken Jin


Change by Ken Jin :


--
keywords: +3.9regression
nosy: +christian.heimes, lukasz.langa, vstinner

___
Python tracker 

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



[issue44050] Exceptions in a subinterpreter are changed by another subinterpreter

2021-05-05 Thread Trygve Aaberge


Trygve Aaberge  added the comment:

And here are the bug reports for two Python scripts that are affected by this 
issue:
https://github.com/wee-slack/wee-slack/issues/812
https://github.com/poljar/weechat-matrix/issues/248

--

___
Python tracker 

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



[issue44050] Exceptions in a subinterpreter are changed by another subinterpreter

2021-05-05 Thread Trygve Aaberge


Trygve Aaberge  added the comment:

Here is the Python script that the C program to reproduce the issue runs.

--
Added file: https://bugs.python.org/file50016/subinterpreter_ssl_issue.py

___
Python tracker 

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



[issue44050] Exceptions in a subinterpreter are changed by another subinterpreter

2021-05-05 Thread Trygve Aaberge


New submission from Trygve Aaberge :

This issue is a regression in Python 3.9. It was recently fixed in main/3.10, 
but I'm opening this issue to request that it is fixed in 3.9 as well since it 
breaks certain Python scripts running in WeeChat.

I have a C application which is using the Python/C API and is running multiple 
python subinterpreters. One of those subinterpreters is running a script which 
is reading data from a non-blocking ssl socket. When there is no more data to 
read, trying to read throws `ssl.SSLWantReadError` which is handled by the 
script. However, if a script in another subinterpreter imports _ssl, the 
SSLWantReadError exceptions thrown in the first script now have a different 
class instance, so they are not catched anymore.

This is a regression in 3.9. It didn't happen in 3.8. The commit that 
introduced the issue is 
https://github.com/python/cpython/commit/82c83bd907409c287a5bd0d0f4598f2c0538f34d
The commit that fixes the issue in 3.10 is 
https://github.com/python/cpython/commit/7f1305ef9ea7234e1a5aacbea17490232e9b7dc2

I have attached a C program to reproduce the issue. It seems I can only attach 
one file per comment, so the python script that program runs will follow in the 
next commit. It connects to an ssl socket, so you need to have that running 
first. That can be started by running this:

```
openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 
365 -subj '/'
openssl s_server -key key.pem -cert cert.pem -accept 1234
```

The script will output this when the issue is not present (so in 3.8 and main):
```
no data
no data
```

And this when the issue is present (in 3.9):
```
no dataunknown error: The operation did not complete (read) (_ssl.c:2627)
exception name: SSLWantReadError
SSLWantReadError id: 93893206532320
exception id: 93893207118800
```

--
components: Subinterpreters
files: interpreter.c
messages: 393011
nosy: trygveaa
priority: normal
severity: normal
status: open
title: Exceptions in a subinterpreter are changed by another subinterpreter
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50015/interpreter.c

___
Python tracker 

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