Skip to content

Instantly share code, notes, and snippets.

View plq's full-sized avatar

Burak Arslan plq

View GitHub Profile
@plq
plq / outwit.py
Created December 28, 2013 22:21
lxml segfault
from __future__ import print_function
from lxml import etree
from StringIO import StringIO
def coroutine(func):
def start(*args, **kwargs):
ret = func(*args, **kwargs)
try:
@plq
plq / output2
Last active January 1, 2016 15:28
Outsmarting context managers with coroutines
enter 1
enter 2
2 yo
exit 1 (<type 'exceptions.Exception'>, Exception(), <traceback object at 0x6c7b48>)
hey
@plq
plq / gist:8113509
Created December 24, 2013 13:39
cpython stacktrace
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff0a4941f in __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element (__pyx_v_self=0x1671e08, __pyx_v_element_config=0xa66d20) at src/lxml/lxml.etree.c:113538
113538 __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(gdb) bt
#0 0x00007ffff0a4941f in __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element (__pyx_v_self=0x1671e08, __pyx_v_element_config=0xa66d20) at src/lxml/lxml.etree.c:113538
#1 0x00007ffff0a4e283 in __pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__ (__pyx_v_self=0x167e5a0, __pyx_v_exc_type=0x7dde20 <_PyExc_GeneratorExit>, __pyx_v_exc_val=0x16810d8, __pyx_v_exc_tb=0x1677df8)
at src/lxml/lxml.etree.c:114964
#2 0x00007ffff0a4e185 in __pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__ (__pyx_v_self=0x167e5a0, __pyx_a
@plq
plq / server.py
Last active December 29, 2015 11:39
simple type as __in_header__ does not work
import logging
from spyne.model.primitive import Boolean, Unicode, Integer
from spyne.model.complex import ComplexModel
from spyne.service import ServiceBase
from spyne.decorator import rpc
class SomeService(ServiceBase):
__in_header__ = Unicode(sub_name='myinfo')
@plq
plq / helloworld_null.py
Created October 16, 2013 20:19
Spyne NullServer example.
'''
This is a simple HelloWorld example showing how the NullServer works. The
NullServer is meant to be used mainly for testing.
'''
import logging
logging.basicConfig(level=logging.INFO)
from pprint import pprint
@plq
plq / README
Created August 26, 2013 13:31 — forked from anonymous/README
sample nuitka test program.
Traceback (most recent call last):
File "sample.py", line 8, in <module>
print list(sq_all(l))
File "sample.py", line 4, in sq_all
yield x*x
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'
def sq_all(l):
for x in l:
yield x*x
l = [1,2,3,4,None,6,7,8]
print list(sq_all(l))
@plq
plq / inst.xml
Last active December 19, 2015 18:59
<!DOCTYPE dtd [
<!ENTITY file SYSTEM "some_file">
]>
<SomeObject xmlns="some_ns">
<d>2013-07-15T20:21:43.476838</d>
<i>5</i>
<s>&file;</s>
</SomeObject>
@plq
plq / output
Last active December 17, 2015 15:19
patch
================================================================================== FAILURES ===================================================================================
_________________________________________________________________ TestSqlAlchemyNested.test_scalar_collection _________________________________________________________________
test_sqlalchemy.py:945: in test_scalar_collection
> session.commit()
/home/plq/src/sqlalchemy/lib/sqlalchemy/orm/session.py:721: in commit
> self.transaction.commit()
/home/plq/src/sqlalchemy/lib/sqlalchemy/orm/session.py:354: in commit
> self._prepare_impl()
/home/plq/src/sqlalchemy/lib/sqlalchemy/orm/session.py:334: in _prepare_impl
> self.session.flush()