Skip to content

Commit

Permalink
Port tests to pytest and put into tests directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mkleehammer committed Aug 26, 2023
1 parent 26ee8c5 commit f3a0219
Show file tree
Hide file tree
Showing 7 changed files with 497 additions and 1,616 deletions.
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ def get_compiler_settings():
if ldflags:
settings['extra_link_args'].extend(ldflags.split())

from array import array
UNICODE_WIDTH = array('u').itemsize
# if UNICODE_WIDTH == 4:
# # This makes UnixODBC use UCS-4 instead of UCS-2, which works better with sizeof(wchar_t)==4.
# # Thanks to Marc-Antoine Parent
# settings['define_macros'].append(('SQL_WCHART_CONVERT', '1'))
# from array import array
# UNICODE_WIDTH = array('u').itemsize
# if UNICODE_WIDTH == 4:
# # This makes UnixODBC use UCS-4 instead of UCS-2, which works better with sizeof(wchar_t)==4.
# # Thanks to Marc-Antoine Parent
# settings['define_macros'].append(('SQL_WCHART_CONVERT', '1'))

# What is the proper way to detect iODBC, MyODBC, unixODBC, etc.?
settings['libraries'].append('odbc')
Expand Down
4 changes: 2 additions & 2 deletions src/errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PyObject* RaiseErrorV(const char* sqlstate, PyObject* exc_class, const char* for
pAttrs = Py_BuildValue("(Os)", pMsg, sqlstate);
if (pAttrs)
{
pError = PyEval_CallObject(exc_class, pAttrs);
pError = PyObject_CallObject(exc_class, pAttrs);
if (pError)
RaiseErrorFromException(pError);
}
Expand Down Expand Up @@ -154,7 +154,7 @@ static PyObject* GetError(const char* sqlstate, PyObject* exc_class, PyObject* p

PyTuple_SetItem(pAttrs, 0, pSqlState); // pAttrs now owns the pSqlState reference

pError = PyEval_CallObject(exc_class, pAttrs); // pError will incref pAttrs
pError = PyObject_CallObject(exc_class, pAttrs); // pError will incref pAttrs

Py_XDECREF(pAttrs);

Expand Down
2 changes: 1 addition & 1 deletion src/textenc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PyObject* TextBufferToObject(const TextEnc& enc, const byte* pbData, Py_ssize_t
// first pointed this out with shift_jis. I'm not sure if it is a fault in the
// implementation of this codec or if others will have it also.

PyObject* str;
// PyObject* str;

if (cbData == 0)
return PyUnicode_FromStringAndSize("", 0);
Expand Down
Loading

0 comments on commit f3a0219

Please sign in to comment.