Giter VIP home page Giter VIP logo

ctypedbytes's People

Contributors

brunovianarezende avatar klbostee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ctypedbytes's Issues

Python 2.4 compatibility

The current fastb.c code is not compatible with Python < 2.5. I'm stuck with Python 2.4 on my Hadoop cluster :-(. The following diff fixes the extension. (I'm not configuring it as a fork/pull because it's so simple.)

See http://bugs.python.org/issue1485576 for a discussion

diff --git a/fastb.c b/fastb.c
index f54f20c..9fe54af 100644
--- a/fastb.c
+++ b/fastb.c
@@ -18,6 +18,12 @@

 #include <Python.h>

+#if PY_VERSION_HEX < 0x02050000
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
+
 #define BYTE_TC   1
 #define BOOL_TC   2
 #define INT_TC    3

longs not read properly

It’s currently not caught by the unit tests, but after adding .reads() (in order to avoid falling back to the pure-Python typedbytes module) in tests/testio.py you get:

Failure in test testio (tests.testio.TestIO) 
Traceback (most recent call last):
  File "/usr/lib/python2.6/unittest.py", line 279, in run
    testMethod()
  File "/mir/klaas/gits/ctypedbytes/tests/testio.py", line 23, in testio
    self.assertEqual(objects[index], record)
  File "/usr/lib/python2.6/unittest.py", line 350, in failUnlessEqual
    (msg or '%r != %r' % (first, second))
AssertionError: 3000000000 != -1294967296L

Hence, longs are not read properly by the implementation in C.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.