Opened 2 years ago

Closed 18 months ago

#775 closed defect (fixed)

'memoryview' gets included in the namespace

Reported by: mauro Owned by: somebody
Priority: minor Milestone: 0.19.1
Component: Code Generation Keywords:
Cc:

Description

The following code:

import pyximport; pyximport.install()
from mv import *
memoryview(b'asdf')

with mv.pyx:

import array
# # commenting the following two lines stops the error being thrown
ar2 = array.array('i',[1,2,3])
cdef int[:] myslice = ar2
# shows that memoryview is in the namespace of my.pyx, if above two lines are not commented
print(dir())

produces the error:

Traceback (most recent call last):
  File "run_mv.py", line 3, in <module>
    memoryview(b'asdf')
  File "stringsource", line 323, in View.MemoryView.memoryview.__cinit__ (/home/mauro/.pyxbld/temp.linux-x86_64-3.2/pyrex/mv.c:2945)
TypeError: __cinit__() takes at least 2 positional arguments (1 given)

(cython 016, python 3.2.3)

So, through the "from mv import *" cython's version of memoryview is imported to python-space which is not quite the same as CPython's and causes the error. However, this only happens if a memoryview is used in the .pyx file.

Change History (1)

comment:1 Changed 18 months ago by scoder

  • Milestone changed from wishlist to 0.19.1
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.