typedef intargfunc ssizeargfunc;
#endif
-#if PY_MAJOR_VERSON < 3
+#if PY_MAJOR_VERSION < 3
// new typedef in Python 3
typedef long Py_hash_t;
/* -1 can be either the actual value, or an error flag. */
return NULL;
if (index < 0)
- index += BaseRow_length(self);
+ index += (long)BaseRow_length(self);
return BaseRow_getitem(self, index);
} else if (PySlice_Check(key)) {
values = PyObject_GetItem(self->row, key);
cpython = platform.python_implementation() == "CPython"
+ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
+if sys.platform == "win32":
+ # Work around issue https://github.com/pypa/setuptools/issues/1902
+ ext_errors += (IOError, TypeError)
+ extra_compile_args = []
+elif sys.platform == "linux":
+ # warn for undefined symbols in .c files
+ extra_compile_args = ["-Wundef"]
+else:
+ extra_compile_args = []
+
ext_modules = [
Extension(
"sqlalchemy.cprocessors",
sources=["lib/sqlalchemy/cextension/processors.c"],
+ extra_compile_args=extra_compile_args,
),
Extension(
"sqlalchemy.cresultproxy",
sources=["lib/sqlalchemy/cextension/resultproxy.c"],
+ extra_compile_args=extra_compile_args,
),
Extension(
- "sqlalchemy.cutils", sources=["lib/sqlalchemy/cextension/utils.c"]
+ "sqlalchemy.cutils",
+ sources=["lib/sqlalchemy/cextension/utils.c"],
+ extra_compile_args=extra_compile_args,
),
]
-ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
-if sys.platform == "win32":
- # 2.6's distutils.msvc9compiler can raise an IOError when failing to
- # find the compiler
- # for TypeError, see https://github.com/pypa/setuptools/issues/1902
- ext_errors += (IOError, TypeError)
-
class BuildFailed(Exception):
def __init__(self):
a.data = "bar"
b.data = "foo"
if sa.util.py3k:
+ if sa.util.py36:
+ message = (
+ r"Could not sort objects by primary key; primary key "
+ r"values must be sortable in Python \(was: '<' not "
+ r"supported between instances of 'MyNotSortableEnum'"
+ r" and 'MyNotSortableEnum'\)"
+ )
+ else:
+ message = (
+ r"Could not sort objects by primary key; primary key "
+ r"values must be sortable in Python \(was: unorderable "
+ r"types: MyNotSortableEnum\(\) < MyNotSortableEnum\(\)\)"
+ )
+
assert_raises_message(
- sa.exc.InvalidRequestError,
- r"Could not sort objects by primary key; primary key values "
- r"must be sortable in Python \(was: '<' not supported between "
- r"instances of 'MyNotSortableEnum' and 'MyNotSortableEnum'\)",
- s.flush,
+ sa.exc.InvalidRequestError, message, s.flush,
)
else:
s.flush()