mk-fg / pretty-yaml

PyYAML-based module to produce a bit more pretty and readable YAML-serialized data
Do What The F*ck You Want To Public License
135 stars 29 forks source link

fixed maximum recursion error #3

Closed chrigl closed 10 years ago

chrigl commented 10 years ago

If pyaml.dump was called multiple times it ran into an maximum recursion error. This was because on each call, the original Serializer.serialize_node was wrapped with a new one over and over again.

Also added some tests.

To reproduce the problem, take tests/test_pyaml.py only, and use py.test to run the code. The test will result in an RuntimeError: maximum recursion depth exceeded

mk-fg commented 10 years ago

Thanks.

PyYAML should actually allow extending it properly, so this monkey-patching is a horrible hack anyway, and ideally should go away. Only exists because I wrote it in a hurry as an ad-hoc helper and didn't want to spend time looking into how proper extension should be done.