Skip to content

Commit

Permalink
Merge branch 'master' into python3
Browse files Browse the repository at this point in the history
Conflicts:
	distribute_setup.py
	pyamf/adapters/_django_utils_translation.py
	pyamf/alias.py
	pyamf/amf3.py
  • Loading branch information
simonzack committed Jan 23, 2015
2 parents a4805e5 + 7e42b15 commit 3992abb
Show file tree
Hide file tree
Showing 29 changed files with 335 additions and 621 deletions.
42 changes: 35 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,42 @@ python:
- "2.6"
- "2.7"

install:
- pip install flake8
- pip install -e .
env:
global:
- PYTHONPATH=/tmp/gaesdk

before_script:
matrix:
- USE_EXTENSIONS=true # no dependencies
- USE_EXTENSIONS=false
- USE_EXTENSIONS=true DJANGO_VERSION=1.2.7
- USE_EXTENSIONS=false DJANGO_VERSION=1.2.7
- USE_EXTENSIONS=true DJANGO_VERSION=1.3.7
- USE_EXTENSIONS=false DJANGO_VERSION=1.3.7
- USE_EXTENSIONS=true DJANGO_VERSION=1.5.12
- USE_EXTENSIONS=false DJANGO_VERSION=1.5.12
- USE_EXTENSIONS=true SQLALCHEMY_VERSION=0.7.10
- USE_EXTENSIONS=false SQLALCHEMY_VERSION=0.7.10
- USE_EXTENSIONS=true SQLALCHEMY_VERSION=0.8.7
- USE_EXTENSIONS=false SQLALCHEMY_VERSION=0.8.7
- USE_EXTENSIONS=true SQLALCHEMY_VERSION=0.9.8
- USE_EXTENSIONS=false SQLALCHEMY_VERSION=0.9.8
- USE_EXTENSIONS=true TWISTED_VERSION=14.0.2
- USE_EXTENSIONS=false TWISTED_VERSION=14.0.2
- USE_EXTENSIONS=true GAESDK_VERSION=1.9.17
- USE_EXTENSIONS=false GAESDK_VERSION=1.9.17

before_install:
- pip install flake8
- flake8

install:
- pip install flake8 coverage coveralls
- pip install -e .
- ./install_optional_dependencies.sh
- ./maybe_install_cython.sh

script:
- python setup.py test
- pip install Cython
- python setup.py test
- coverage run --source=pyamf setup.py test

after_success:
- coveralls
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ graft doc
graft pyamf/tests/imports
prune doc/build
prune doc/_build
include distribute_setup.py
include setupinfo.py
include *.txt
global-exclude *.swf
global-exclude *.pyc
include cpyamf/*.pyx
include cpyamf/*.pxd
include cpyamf/*.pxd
3 changes: 3 additions & 0 deletions README.txt → README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. image:: https://coveralls.io/repos/hydralabs/pyamf/badge.svg
:target: https://coveralls.io/r/hydralabs/pyamf

PyAMF_ provides Action Message Format (AMF_) support for Python_ that is
compatible with the `Adobe Flash Player`_. It includes integration with
Python web frameworks like Django_, Pylons_, Twisted_, SQLAlchemy_,
Expand Down
2 changes: 1 addition & 1 deletion cpyamf/amf3.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cdef class ClassDefinition(object):


cdef class Context(codec.Context):
cdef codec.IndexedCollection strings
cdef codec.ByteStringReferenceCollection strings
cdef dict classes
cdef dict class_ref
cdef dict proxied_objects
Expand Down
2 changes: 1 addition & 1 deletion cpyamf/amf3.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ cdef class Context(codec.Context):
"""

def __cinit__(self):
self.strings = codec.IndexedCollection(use_hash=1)
self.strings = codec.ByteStringReferenceCollection()
self.classes = {}
self.class_ref = {}
self.proxied_objects = {}
Expand Down
11 changes: 11 additions & 0 deletions cpyamf/codec.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ cdef class IndexedCollection(object):
cpdef Py_ssize_t append(self, object obj) except -1


cdef class ByteStringReferenceCollection(IndexedCollection):
"""
There have been rare hash collisions within a single AMF payload causing
corrupt payloads.
Which strings cause collisions is dependent on the python runtime, each
platform might have a slightly different implementation which means that
testing is extremely difficult.
"""


cdef class Context(object):
"""
C based version of ``pyamf.BaseContext``
Expand Down
21 changes: 20 additions & 1 deletion cpyamf/codec.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ cdef class IndexedCollection(object):

return <object>self.data[ref]

cdef inline object _ref(self, object obj):
cdef object _ref(self, object obj):
if self.use_hash:
return hash(obj)

Expand Down Expand Up @@ -198,6 +198,25 @@ cdef class IndexedCollection(object):
return n


cdef class ByteStringReferenceCollection(IndexedCollection):
"""
There have been rare hash collisions within a single AMF payload causing
corrupt payloads.
Which strings cause collisions is dependent on the python runtime, each
platform might have a slightly different implementation which means that
testing is extremely difficult.
"""

cdef object _ref(self, object obj):
return obj

def __copy__(self):
cdef ByteStringReferenceCollection n = ByteStringReferenceCollection()

return n


cdef class Context(object):
"""
I hold the AMF context for en/decoding streams.
Expand Down
Loading

0 comments on commit 3992abb

Please sign in to comment.