[issue46047] When using Py_NewInterpreter, some modules fail to import in Python 3.10
New submission from Jonas Witschel : Consider the following minimal example C code which is trying to import jsonschema (https://python-jsonschema.readthedocs.io/en/stable/), compiled using "gcc test_newinterpreter.c -I /usr/include/python3.10 -lpython3.10 -o test_newinterpreter" or similar: #include int main(void) { Py_Initialize(); PyThreadState *interpreter = Py_NewInterpreter(); PyRun_SimpleString("import jsonschema"); Py_Finalize(); } In Python 3.9.9, this works as expected. However in Python 3.10.0, the following error is produced: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.10/site-packages/jsonschema/__init__.py", line 21, in from jsonschema._types import TypeChecker File "/usr/lib/python3.10/site-packages/jsonschema/_types.py", line 168, in draft3_type_checker = TypeChecker( TypeError: TypeChecker() takes no arguments Removing the Py_NewInterpreter() call makes the example work as expected in Python 3.10.0. This might be related to the enhancements to the type cache from bpo-42745. Another recent bug report I found that might possibly be related is bpo-46036. This bug breaks some WeeChat plugins that try to import one of the affected modules, e.g. weechat-matrix (https://github.com/poljar/weechat-matrix). -- components: C API, Subinterpreters messages: 408295 nosy: diabonas priority: normal severity: normal status: open title: When using Py_NewInterpreter, some modules fail to import in Python 3.10 type: compile error versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue46047> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46047] When using Py_NewInterpreter, some modules fail to import in Python 3.10
Jonas Witschel added the comment: Downstream bug report in Arch Linux: https://bugs.archlinux.org/task/72979 -- ___ Python tracker <https://bugs.python.org/issue46047> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46047] When using Py_NewInterpreter, some modules fail to import in Python 3.10
Jonas Witschel added the comment: I notice this has already been reported as bpo-46006 and bpo-46034, so closing in favour of these. -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46047> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters
Change by Jonas Witschel : -- nosy: +diabonas ___ Python tracker <https://bugs.python.org/issue46006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46067] SSLContext.set_npn_protocols broken in Python 3.10, tries to call non-existing _set_npn_protocols
New submission from Jonas Witschel : Consider the following minimal example: import ssl context = ssl.create_default_context() context.set_npn_protocols(['http/1.1', 'spdy/2']) In Python 3.10, it fails with the following error: AttributeError: 'SSLContext' object has no attribute '_set_npn_protocols'. Did you mean: 'set_npn_protocols'? This is because bpo-43669 (https://github.com/python/cpython/commit/39258d3595300bc7b952854c915f63ae2d4b9c3e) removed _set_npn_protocols, while it is still used by SSLContext.set_npn_protocols: https://github.com/python/cpython/blob/191c431de7d9b23484dd16f67e62c6e85a1fac7f/Lib/ssl.py#L551 Note that the function is already deprecated in Python 3.10 and throws a DeprecationWarning: ssl NPN is deprecated, use ALPN instead but should still probably continue working for now. -- assignee: christian.heimes components: SSL messages: 408466 nosy: christian.heimes, diabonas priority: normal severity: normal status: open title: SSLContext.set_npn_protocols broken in Python 3.10, tries to call non-existing _set_npn_protocols type: compile error versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue46067> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com