Commit Graph

125 Commits

Author SHA1 Message Date
R. Tyler Croy 1f3221e58e Merge pull request #36 from ericpeden/memory-leaks
memory leak fixes
2014-05-30 08:55:06 -07:00
Eric Peden a652ad05f7 Fix memory leaks in ProcessObject. 2014-05-29 20:14:25 -07:00
Eric Peden 110f2ebc03 Fix a memory leak in yajl.dump(). 2014-05-29 20:14:02 -07:00
R. Tyler Croy 52094838b9 Merge pull request #31 from rickeyski/master
Undefined Symbols in python3.2
2011-10-09 12:53:06 -07:00
rickey cf3c29dfcc Fixed undefined symbol on python3.2 2011-07-08 15:30:51 -04:00
Travis J Parker 4aadc2fc2e missed the pybuffer decref in Decoder.decode 2011-04-26 22:32:20 -07:00
Travis J Parker e150d09b8f handle the case of a unicode argument to loads() differently
unfortunately this just needs to be inlined, a separate utf8_z_hash
function won't work. the reason being that PyString_AsStringAndSize
gives access to the string object's internal buffer rather than copying,
and that string object was being decrefed away at the end of the
function, but the buffer we got out of it still needed to be usable.
2011-04-26 22:32:20 -07:00
Travis J Parker 5405ff8a53 fix that new test. ./runtests.sh wasn't seeing the problem for some reason 2011-04-26 22:32:20 -07:00
Travis J Parker b39e2da029 fix for https://github.com/rtyler/py-yajl/issues/27 with test, though another unicode test is now failing 2011-04-26 22:32:20 -07:00
Igor 001ba95c4d make yajl.(De|En)coder subclassable. Add default methode to Encoder and
modify ProcessObject to mimick simplejson's JSONEncoder behaviour when
encountering unknown types
2010-10-19 16:16:23 -07:00
Igor 70430eab9c add tests for tuples and generator encoding 2010-09-12 12:43:01 +02:00
Igor ac1469e1cc change ProcessObject to treat lists, tuple and generators as iterators when serializing 2010-09-12 12:19:11 +02:00
R. Tyler Ballance 44e8588f23 Bump to the latest yajl
Change-Id: I75624cd1f1d73f686c2c200406fcd574692c421f
2010-08-17 22:09:17 -07:00
Travis J Parker e2504262a0 Prevent SIGSEGV when encoding objects that refer to themselves
Also, there were a few places missing checks for yajl_gen_in_error_status

http://github.com/rtyler/py-yajl/issues#issue/18

Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org>
2010-05-02 08:39:47 -07:00
R. Tyler Ballance ac4de75c7e Skip IssueThirteenTest on Python 2.4/2.5
Change-Id: I9cffc2e3876cb27a99acba9786e1a9ddf030cf5d
2010-04-10 22:36:43 -07:00
R. Tyler Ballance d8fa6202cc Add `yajl.monkeypatch` to smuggle yajl into sys.modules['json']
http://github.com/rtyler/py-yajl/issues#issue/13

Change-Id: I46924a0a2379c37a2cfc07def071ce59a22761d0
2010-04-10 17:55:43 -07:00
R. Tyler Ballance c3c33b77e3 Add a __version__ attribute onto the module
When building a module from inside the git tree, the version
will also be "tagged" with the latest commit hash

Change-Id: Ic4b3d4072afcfccbb7bcbe09afc49f950d25e535
2010-04-10 17:41:12 -07:00
R. Tyler Ballance 1c276f4366 When dealing with PyLong objects, pull them out as long long's and use yajl_gen_number()
On 32-bit machines, a PyLong_AsLong() call on a 64-bit number will fail,
to remedy this we pull out the `long long` and use that to generate a buffer
to pass into yajl_gen_number() which will handle it appropriately

http://github.com/rtyler/py-yajl/issues#issue/16

Change-Id: Iec800f6e765e14041d7a264e3fdecdbb15cc986d
2010-04-11 01:15:17 -07:00
R. Tyler Ballance 215f62f9ba If ProcessObject() gives us a bad status, check to see if we have a Python exception to raise
In the case of an OverflowError (see: issue #16), we want to raise *that*
exception instead of raising our own TypeError

Change-Id: I5b0cf5903b4cabe87df14137aa5d6c944ab3a270
2010-04-11 00:47:24 -07:00
R. Tyler Ballance 9e0c781b21 Add a test case for the long int overflow issue
Change-Id: I63a3b9393fa486ea55165ad17e4b3ecb787d980f
http://github.com/rtyler/py-yajl/issues#issue/16
2010-04-10 14:45:44 -07:00
R. Tyler Ballance b8204ae573 Add a simple test runner to run tests for myself locally against Python2/3
Change-Id: I1303c79fd2f0097b8435e8505cbecda1b2bb958d
2010-04-10 14:45:24 -07:00
R. Tyler Ballance d9b087d872 Bump to v0.3.6 for next series of development
This series of development should start to flesh out streaming,
per my notes in:
    http://github.com/rtyler/py-yajl/issues#issue/14

Change-Id: I5afdd19d91d380835d5087162abe068ea466e5a6
2010-04-08 23:35:05 -07:00
R. Tyler Ballance 4f25a9b527 Bump to 0.3.5
Change-Id: Id568a4c96593b052e25792e4fa90a32f992e82ff
2010-04-07 21:42:14 -07:00
R. Tyler Ballance 85f3aa53e0 Properly handle multiple unicode keys inside of a dictionary
Previously, py-yajl used `yajl_gen_number()` in order to print a non-escaped
buffer to the output stream. The ENSURE_NOT_KEY macro inside of yajl_gen.c
would cause entries to be dropped and an unchecked `yajl_gen_keys_must_be_strings`
status would be returned.

In order to work around this, a portion of code has been lifted from yajl_gen.c and
added to yajl_hacks.c which adds the function `yajl_gen_raw_string()` which prints
the buffer, unescaped, to the output stream without calling ENSURE_NOT_KEY.

http://github.com/rtyler/py-yajl/issues/#issue/12

Change-Id: I75a71573c4949d04ad4d532c27f2b64486db906e
2010-04-07 21:23:46 -07:00
R. Tyler Ballance c619aeab0e Properly escape inbound slashes and double-quotes
Change-Id: I38c4d06f9c2c6cae361b9921ad1c51aeb5baacc8
2010-04-06 21:24:13 -07:00
R. Tyler Ballance 85a66ede60 Enable new unicode tests to run on Python 2 and 3 properly
Change-Id: I5b680279773a13d7bb5490e194f1ebdbbde0f731
2010-04-06 21:19:01 -07:00
R. Tyler Ballance 399b8cb18b Increment the py-yajl version to v0.3.4
Change-Id: I0b19f60aa91d51040ffc5735c9b88c5572cfd098
2010-04-06 21:00:32 -07:00
R. Tyler Ballance 836ea060ac When converting a tuple to a list, the count needs to be incremented on the borrowed reference
http://github.com/rtyler/py-yajl/issues#issue/11

Change-Id: I54adeaf992d041f43b8d1c9c8eb3fbe957b85826
2010-04-06 20:57:37 -07:00
R. Tyler Ballance dff262de24 Bump yajl to the latest version
Change-Id: I643ae26f8ea2ed521e14a3477dccdb47cde88766
2010-04-06 20:47:44 -07:00
R. Tyler Ballance 489a42078e When not using the XML option, fall-back to unittest.main()
Change-Id: I266b5b6bd7aae778f8d6730a018353ff32a69eb0
2010-04-06 20:47:44 -07:00
R. Tyler Ballance 01cb3f10a3 Properly escape unicode characters to their proper code points
Using yajl_gen_number() to circumvent yajl_gen_string()'s built-in
escaping and performing the conversion of wide-characters to their
respective code-points before passing the buffer along

Testing latin-1 and simplified chinese characters.

http://github.com/rtyler/py-yajl/issues#issue/7

Change-Id: I3a851aeff6548c7a3246be09515731abaae1fe93
2010-04-06 20:47:39 -07:00
R. Tyler Ballance deffafe6c6 Skip the "long" test in Python 3
Change-Id: Id93849811fbc904fd96a951b7e7b31c897f7eb14
2010-03-22 16:07:27 -07:00
R. Tyler Ballance 9fbc542239 Encode keys properly for Python 3
Change-Id: I6f931788c6d9665bba98083335157318807c6a63
2010-03-22 16:03:19 -07:00
R. Tyler Ballance f40427c52c When dealing with numbered keys in dictionaries, convert them to strings
Per issue #10, this is in line with the Python `json` module behavior:

    >>> import json
    >>> json.dumps({1:2})
    '{"1": 2}'
    >>> json.dumps({1.2:2})
    '{"1.2": 2}'

Change-Id: Idd5c10e884227c5f82f19c6eabf083059f97950e
2010-03-22 15:47:36 -07:00
R. Tyler Ballance b6f7e32a88 Update ignore rules to exclude more
Change-Id: Ie3753837fc5266f34fa37309e3bf051d67b1bfbe
2010-03-22 15:10:06 -07:00
R. Tyler Ballance 1738cb5fe9 Bump version to 0.3.3
Change-Id: I7cd8316e65390e0f34e208114b96e3426f252093
2010-03-21 23:54:37 -07:00
R. Tyler Ballance 9d8d1a4dc4 Raise a TypeError when encountering objects that cannot be serialized
When calling `json.dumps` on a list of set() objects we should be raising
a TypeError. Resolving the issue wherein objects inside of lists in
`ProcessObject` that could not be encoded would be silently dropped.

Change-Id: I1022f8fa27b8290839a11fa22edba8d776a0f145
2010-03-21 23:42:33 -07:00
R. Tyler Ballance e5bfbe1ac6 Convert tuples to lists before encoding them
The `json` module in Python 2.6 functions in a similar fashion:

    >>> json.dumps([(2,3,)])
    '[[2, 3]]'
    >>>

Reported by indigoviolet in issue #8

Change-Id: Ia5f0b649d137e42a692a38b52ccff71874dd4c71
2010-03-21 22:18:36 -07:00
R. Tyler Ballance 6d05e9fe20 Python 3-safe prints. 2010-02-21 00:56:29 -08:00
R. Tyler Ballance f19a562d4e Automatically initialize the yajl submodule and create necessary symlinks 2010-02-21 00:53:06 -08:00
R. Tyler Ballance 983060062c Prune yajl/.git and yajl/build directories from the source distribution 2010-02-21 00:52:45 -08:00
R. Tyler Ballance e8f702eca3 Update xmlrunner.py for Python 3.1 compat 2010-02-21 00:22:24 -08:00
R. Tyler Ballance 454db0f83b Add an xml runner for and update unit.py for magic Hudson magic 2010-02-21 00:01:18 -08:00
R. Tyler Ballance 5aa88624ed Bump submodule to latest yajl HEAD 2010-02-20 23:03:26 -08:00
R. Tyler Ballance 4b71a0c6cb Bump version to 0.3.2 2010-02-20 23:02:29 -08:00
R. Tyler Ballance 6197b7f45b Clean-up some irritating extra whitespace 2010-02-20 21:55:06 -08:00
R. Tyler Ballance 64d15fbc7d Define some macros for building cleanly on Python 2.4 and Python 2.5
With regards to PyUnicode_DecodeUTF8() I'm /hoping/ that it operates
in a similar fashion to PyUnicode_FromStringAndSize() on Python 2.6/3.0
2010-02-20 21:36:45 -08:00
R. Tyler Ballance d1c8f94177 Fix Py_SIZE, macro
Using Py_Size() gives this error on 2.5:
    Symbol not found: _Py_Size
2010-02-20 15:55:39 -08:00
R. Tyler Ballance 57d9c174fd Define the Py_SIZE macro for Python 2.4 and Python 2.5 builds 2010-02-20 15:32:33 -08:00
R. Tyler Ballance 480f8cf8e2 Bump version 2010-01-10 01:07:56 -08:00