Ticket #173 (new enhancement)

Opened 4 years ago

Last modified 4 years ago

per-interpreter module state in Py3 (PEP 3121)

Reported by: scoder Owned by: somebody
Priority: major Milestone: wishlist
Component: Code Generation Keywords:
Cc:

Description

Py3 has a new infrastructure for making module state local to an interpreter instance, as described in PEP 3121.

 http://www.python.org/dev/peps/pep-3121/

Cython should support this, preferably without requiring new syntax or changes to user code.

Change History

Changed 4 years ago by dagss

Something to consider: One might make ModuleNode?.py more lean and get less code duplication by doing some sort of transform from the module scope to a (cdef) class. Global variables would be fields, module-level code (including "registration" of Python functions as they are defined, see below) would be part of the constructor.

Module-level functions should however NOT be made methods, because Python functions can be overwritten inside an if-test, then redefined etc. (with Python scope rules).

Instead the creation of functions would then perhaps need to be split in two: One node for defining the function as such, and another node for registering the function in module scope; where the latter would be put in the constructor of the "module class". The two are seperate operations on Python level, so there's no reason they need to happen in the same node.

Changed 4 years ago by scoder

The IMHO most important part of this is described in ticket #218.

Note: See TracTickets for help on using tickets.