Hi,

I've hit the following deviation from Python 2: when a Cython module has a global variable, somehow, upon importing the module, the global variables end up in the *current* (importing) module scope, rather than *imported* module scope, and, while normally relatively harmless, in the case of namedtuples, for instance, this has caused pickling errors in our production code.

test1.py / test2.pyx

    import collections

    Test = collections.namedtuple("Test", ["test"])

$ ipython
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
IPython 1.2.1 -- An enhanced Interactive Python.

In [1]: import test1

In [2]: test1.Test
Out[2]: test1.Test

In [3]: import test2

In [4]: test2.Test
Out[4]: __main__.Test

I would appreciate any hints in the case that I'm deeply confused and doing something obviously wrong...

--
Sincerely yours,
Yury V. Zaytsev
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to