Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fastb.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ _fastb_read_pyobj_int(FILE *stream, PyObject *fallback) {
static int
_fastb_write_pyobj_int(FILE *stream, PyObject *pyobj, PyObject *fallback) {
long l = PyInt_AS_LONG(pyobj);
if (-2147483647L <= l && l <= 2147483647L) {
if (-2147483648L <= l && l <= 2147483647L) {
return _fastb_write_int(stream, l);
} else {
return _fastb_write_long(stream, l);
Expand All @@ -235,9 +235,10 @@ _fastb_read_pyobj_long(FILE *stream, PyObject *fallback) {
static int
_fastb_write_pyobj_long(FILE *stream, PyObject *pyobj, PyObject *fallback) {
long long l = PyLong_AsLongLong(pyobj);
if (-9223372036854775807LL <= l && l <= 9223372036854775807LL) {
if (!PyErr_Occurred() && -9223372036854775808LL <= l && l <= 9223372036854775807LL) {
return _fastb_write_long(stream, l);
} else {
PyErr_Clear();
return _fastb_write_pyobj_fallback(stream, pyobj, fallback);
}
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, Extension
setup(name='ctypedbytes',
version='0.1.7',
version='0.1.8',
description='A fast Python module for dealing with so called "typed bytes"',
author='Klaas Bosteels',
author_email='klaas@last.fm',
Expand Down