spin6lock / python-sproto

python binding to sproto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make过程中提示catch encode error

choleraehyq opened this issue · comments

直接git clone下来之后进入文件夹执行make,提示如下:

python setup.py build --build-lib .
running build
running build_ext
building 'pysproto' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c python_sproto.c -o build/temp.linux-x86_64-2.7/python_sproto.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c sproto.c -o build/temp.linux-x86_64-2.7/sproto.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/python_sproto.o build/temp.linux-x86_64-2.7/sproto.o -o ./pysproto.so
python test.py
result length: 86
04000000d40700000000070000006372797374616c130000006372797374616c406578616d706c652e636f6d260000000f0000000200000004000500000031303038360f000000020000000600050000003130303130
-------------------------
{'email': 'crystal@example.com', 'name': 'crystal', 'phone': [{'type': 1, 'number': '10086'}, {'type': 2, 'number': '10010'}], 'id': 1001}
=========================
62
3104d407c40763723f797374616c13fe6372797374616cff00406578616d706c651f2e636f6d26110f02c5040531308f3038360f022806053e3130303130
-------------------------
04000000d40700000000070000006372797374616c130000006372797374616c406578616d706c652e636f6d260000000f0000000200000004000500000031303038360f0000000200000006000500000031303031300000
=========================
catch encode error

-------------------------
(1, <capsule object NULL at 0x7f06ae516cf0>, <capsule object NULL at 0x7f06ae516d20>)
=========================
{'a': 'hello', 'c': True, 'b': 1000000, 'e': ['ABC', '', 'def'], 'd': {'a': 'world', 'c': -1}, 'g': [True, False, True], 'f': [-3, -2, -1, 0, 1, 2]}
python test_wild_pointer.py
***************************
{'email': 'crystal@example.com', 'name': 'crystal', 'phone': [{'type': 1, 'number': '10086'}, {'type': 2, 'number': '10010'}], 'id': 1001}

可以看到在执行python test.pycatch encode error

运行环境:Ubuntu15.04, python2.7.9, gcc4.9.2

对,那个是演示异常捕捉的

On Sun, May 17, 2015 at 12:19 AM Cholerae Hu notifications@github.com
wrote:

直接git clone下来之后进入文件夹执行make,提示如下:

python setup.py build --build-lib .
running build
running build_ext
building 'pysproto' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c python_sproto.c -o build/temp.linux-x86_64-2.7/python_sproto.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c sproto.c -o build/temp.linux-x86_64-2.7/sproto.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/python_sproto.o build/temp.linux-x86_64-2.7/sproto.o -o ./pysproto.so
python test.py
result length: 86

04000000d40700000000070000006372797374616c130000006372797374616c406578616d706c652e636f6d260000000f0000000200000004000500000031303038360f000000020000000600050000003130303130

{'email': 'crystal@example.com', 'name': 'crystal', 'phone': [{'type': 1, 'number': '10086'}, {'type': 2, 'number': '10010'}], 'id': 1001}

62

3104d407c40763723f797374616c13fe6372797374616cff00406578616d706c651f2e636f6d26110f02c5040531308f3038360f022806053e3130303130

04000000d40700000000070000006372797374616c130000006372797374616c406578616d706c652e636f6d260000000f0000000200000004000500000031303038360f0000000200000006000500000031303031300000

catch encode error


(1, <capsule object NULL at 0x7f06ae516cf0>, <capsule object NULL at 0x7f06ae516d20>)

{'a': 'hello', 'c': True, 'b': 1000000, 'e': ['ABC', '', 'def'], 'd': {'a': 'world', 'c': -1}, 'g': [True, False, True], 'f': [-3, -2, -1, 0, 1, 2]}
python test_wild_pointer.py


{'email': 'crystal@example.com', 'name': 'crystal', 'phone': [{'type': 1, 'number': '10086'}, {'type': 2, 'number': '10010'}], 'id': 1001}

可以看到在执行python test.py时catch encode error

运行环境:Ubuntu15.04, python2.7.9, gcc4.9.2


Reply to this email directly or view it on GitHub
#2.

哦演示的啊,谢谢回复……