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 diabonas
Recipients diabonas
Date 2021-12-11.12:12:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639224725.06.0.440012701527.issue46047@roundup.psfhosted.org>
In-reply-to
Content
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 <Python.h>

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 "<string>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/jsonschema/__init__.py", line 21, in <module>
    from jsonschema._types import TypeChecker
  File "/usr/lib/python3.10/site-packages/jsonschema/_types.py", line 168, in <module>
    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).
History
Date User Action Args
2021-12-11 12:12:05diabonassetrecipients: + diabonas
2021-12-11 12:12:05diabonassetmessageid: <1639224725.06.0.440012701527.issue46047@roundup.psfhosted.org>
2021-12-11 12:12:05diabonaslinkissue46047 messages
2021-12-11 12:12:04diabonascreate