[issue39079] help() modifies the string module
New submission from Alfred Morgan : import string a = string.letters help(int) b = string.letters a == b # False -- components: Library (Lib) messages: 358564 nosy: Zectbumo priority: normal severity: normal status: open title: help() modifies the string module versions: Python 2.7 ___ Python tracker <https://bugs.python.org/issue39079> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14573] json iterencode can not handle general iterators
Alfred Morgan <alf...@54.org> added the comment: @serhiy.storchaka while you are doing your overhaul will you please add support for raw json values. I often find myself where I have a serialized object that I want to include in an object response that I'm about to serialize anyway. The implementation should be very simple. Here is my workaround code: class RawJSON(str): pass origEnc = json.encoder.encode_basestring_ascii def rawEnc(obj): if isinstance(obj, RawJSON): return obj return origEnc(obj) json.encoder.encode_basestring_ascii = rawEnc https://stackoverflow.com/a/48985560/289240 -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue14573> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14573] json iterencode can not handle general iterators
Alfred Morgan <alf...@54.org> added the comment: I would love to but it is a bit late for me now. The json encoding has been optimized in c which falls outside my expertise. https://github.com/python/cpython/blob/master/Modules/_json.c -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue14573> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14573] json iterencode can not handle general iterators
Alfred Morgan added the comment: Need a patch? Here you go. https://github.com/Zectbumo/cpython/compare/master How to use it: encoder = JSONEncoder(stream=True) This will iterencode() iterators as lists and file objects as strings and stream them when constructed with stream=True. -- nosy: +Zectbumo versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14573 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com