Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_get_raw_tables_view fails on Python 2.7.2 #868

Closed
ctb opened this issue Mar 11, 2015 · 10 comments
Closed

test_get_raw_tables_view fails on Python 2.7.2 #868

ctb opened this issue Mar 11, 2015 · 10 comments

Comments

@ctb
Copy link
Member

ctb commented Mar 11, 2015

  File "/Users/t/dev/khmer/tests/test_counting_hash.py", line 117, in test_get_raw_tables_view
    memv = memoryview(tab)
TypeError: cannot make memory view because object does not have the buffer interface

c.f. #671

@kdm9
Copy link
Contributor

kdm9 commented Mar 11, 2015

Oh balls. Will investigate.

I think the issue may be old/new style buffers in CPython???

I was examining how to efficiently pass these to Cython as memory views and hit upon a similar issue (to do with read only buffers).

@kdm9
Copy link
Contributor

kdm9 commented Mar 11, 2015

Although that's rather intriguing, as type(tab) is buffer. And you'd hope that a buffer exposed the buffer interface 😀.

NB:

$ python --version
Python 2.7.8

@luizirber
Copy link
Member

This also breaks Python 2.6, but I guess we're not aiming for 2.6 anymore.

Traceback (most recent call last):
  File "khmer/.tox/py26/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "khmer/tests/test_counting_hash.py", line 117, in test_get_raw_tables_view
    memv = memoryview(tab)
NameError: global name 'memoryview' is not defined

@kdm9
Copy link
Contributor

kdm9 commented Mar 12, 2015

Mmmh, not good. I'll add a fix for @luizirber's observation.

@kdm9
Copy link
Contributor

kdm9 commented Mar 12, 2015

I haven't been able to find any python bugs/changes that indicate this is a python problem, but that may be my poor google skills.

@kdm9
Copy link
Contributor

kdm9 commented Mar 12, 2015

@luizirber any chance you could post your tox.ini? or even check it in, if that's ok.

@luizirber
Copy link
Member

I didn't make a PR because it needs more polishing, for now I'm using something that works but is also wrong (the ideal would be moving parts from the Makefile here, and then calling tox on the Makefile)

[tox]
envlist=py26,py27

[testenv]
commands=
    make install-dependencies
    make clean
    make test

@ctb
Copy link
Member Author

ctb commented Mar 14, 2015

Note, further investigation suggests that it is a problem in Python 2.7.2 but not Python 2.7.6.

@kdm9
Copy link
Contributor

kdm9 commented Mar 14, 2015

Interesingly, while testing on another machine (supercomputer using ICC), I got this:

khmer/_khmermodule.cc: In function 'PyObject* hash_get_raw_tables(khmer_KCountingHash_Object*, PyObject*)':
khmer/_khmermodule.cc:691: error: reference to 'Byte' is ambiguous
third-party/zlib/zconf.h:368: error: candidates are: typedef unsigned char Byte
lib/khmer.hh:83: error:                 typedef unsigned char khmer::Byte
khmer/_khmermodule.cc:691: error: reference to 'Byte' is ambiguous
third-party/zlib/zconf.h:368: error: candidates are: typedef unsigned char Byte
lib/khmer.hh:83: error:                 typedef unsigned char khmer::Byte
khmer/_khmermodule.cc:691: error: 'table_ptrs' was not declared in this scope
error: command 'gcc' failed with exit status 1

I.e, zlib.h has a similar typedef for Byte.

Using khmer::Byte in khmer/_khmermodule.cc fixed that, so I'll add that to #869.

@kdm9
Copy link
Contributor

kdm9 commented Mar 19, 2015

#869 fixed this, AFAICT

@kdm9 kdm9 closed this as completed Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants