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

PyException_Check and the Python Cassandra Driver #1496

Closed
abrugh opened this issue Oct 25, 2016 · 8 comments
Closed

PyException_Check and the Python Cassandra Driver #1496

abrugh opened this issue Oct 25, 2016 · 8 comments
Milestone

Comments

@abrugh
Copy link

abrugh commented Oct 25, 2016

Hi,

I think there's something wrong with Cython 0.25.0

How things should and do work:

  • Make a new virtualenv
  • pip install cython=0.24.1
  • pip install cassandra-driver==3.7.0 (i tried 3.2.0 and 3.0.0 too)
  • start python
  • import cassandra.cluster

Where things break

  • Make a new virtualenv
  • pip install cython==0.25.0
  • pip install cassandra-driver==3.7.0
  • There will be an error about PyException_Check being implicitly declared but the install completes
  • start python
  • import cassandra.cluster
  • You will set another error about PyException_Check

I honestly know nothing about Cython other than its a black box for making Python faster. But the fact that the only variable between the two scenarios above is the Cython version leads me to believe it's an issue with Cython and not the Cassandra driver.

Sorry of this doesn't meet criteria for a bug report. I'm happy to supply more info.

@jhgg
Copy link

jhgg commented Oct 25, 2016

Am having this exact same issue as of recent.

@jhgg
Copy link

jhgg commented Oct 25, 2016

It looks like this symbol has somehow appeared:

$ nm -g /home/deploy/virtualenvs/discord/local/lib/python2.7/site-packages/cassandra/cluster.so | grep PyException
                 U PyException_Check

This doesn't exist in the .so generated by cython 0.24.1

@ngoldbaum
Copy link

I've uploaded cluster.c here: https://gist.github.com/ngoldbaum/ff58cd6d51002ca6dc574e34ff5016cd

The problematic call to the nonexistent PyException_Check is being generated by code in the cython file that looks like this:

for exc in [f for f in results if isinstance(f, Exception)]:
    ...

@ngoldbaum
Copy link

In fact the following test code after being cythonized produces a call to PyException_Check:

results = ['foo', 'bar']

for exc in [f for f in results if isinstance(f, Exception)]:
    pass
$ cython test.pyx
$ ag PyException_Check test.c
998:    __pyx_t_6 = PyException_Check(__pyx_t_2);

@ngoldbaum
Copy link

Under cython 0.24.1 the same line looks like:

__pyx_t_6 = PyObject_IsInstance(__pyx_t_2, __pyx_builtin_Exception); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 3, __pyx_L1_error)

@jhgg
Copy link

jhgg commented Oct 25, 2016

Fairly certain the bug is here:

type_check = 'Py%s_Check' % type_name.capitalize()

It is generating the incorrect type check.

@ngoldbaum
Copy link

I think this was caused by b1d7b0d, ping @robertwb

@1st1
Copy link
Contributor

1st1 commented Oct 26, 2016

Exactly the same problem in uvloop. Here's a Travis CI log.

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

5 participants