Skip to content

make pymssql compile in PyPy #309

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

make pymssql compile in PyPy #309

wants to merge 1 commit into from

Conversation

dholth
Copy link

@dholth dholth commented Apr 2, 2015

These changes allow pymssql to compile and work under PyPy 2.5.1. It will be slow in PyPy since it uses the C API but it is better than nothing and it is more featureful than other options I tried. To make it work I had to inherit from Exception normally and define PyByteArray_Check if it is not defined. Since PyPy doesn't seem to have bytearray it's a pretty safe bet that False is the right answer. Let me know if this affects the tests; I do not have a server I can use against the tests.

Cython also noticed this function declared with except -1 in the .pxd and except 1 in the pyx, so I changed one of them to match. I'm not sure whether -1 or +1 is the correct value.

cdef int convert_python_value(self, object value, BYTE **, int*, int*) except 1

Fixes issue #308.

@msabramo
Copy link
Contributor

msabramo commented Apr 2, 2015

Thank you very much! I'll try to look at this sometime soon, but thanks in advance for contributing!

@msabramo
Copy link
Contributor

msabramo commented Apr 2, 2015

Cc: @ramiro, @sontek

@dholth
Copy link
Author

dholth commented Apr 2, 2015

I've tried it out. It works in my application. It is unfortunately slower than the CPython version of the report (since both spend most of their time calling pymssql, and CPython API emulation is epically slow in PyPy) but I'm sure another program that does more significant processing on the database results would benefit.

@ramiro ramiro mentioned this pull request Mar 1, 2016
@oberstet
Copy link

oberstet commented Mar 1, 2016

CPython API emulation is epically slow in PyPy

Yeah, unfortunately, this is the case.

FWIW, using cffi to interface with native code runs fast on both PyPy and CPython.

@dholth
Copy link
Author

dholth commented Mar 1, 2016

Perhaps it is a little faster now that pypy has recently improved their PyObject support.

@hydratk
Copy link

hydratk commented Feb 3, 2017

I have also tried this PR on my app and it works, speed is ok.
It is possible to include this patch to official release ?

@gehrman
Copy link

gehrman commented May 17, 2017

Building master with this patch rebased and applied required me to revert
cdef int convert_python_value(self, object value, BYTE **, int*, int*) except 1
back to
cdef int convert_python_value(self, object value, BYTE **, int*, int*) except -1. Other than that is there outstanding work that needs to be done here to get this merged?

@yuvalbar yuvalbar mentioned this pull request Nov 8, 2017
@rsyring
Copy link
Contributor

rsyring commented Nov 13, 2017

pymssql is looking for maintainers: #516

Also, we have a new PR for PyPy support. Just wanted to cross reference: #515

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

Successfully merging this pull request may close these issues.

6 participants