This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年05月10日 16:17 by ezio.melotti, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue12051.diff | ezio.melotti, 2011年05月10日 16:17 | review | ||
| issue12051-2.diff | ezio.melotti, 2011年05月10日 19:11 | review | ||
| Messages (3) | |||
|---|---|---|---|
| msg135716 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年05月10日 16:17 | |
Subclasses of JSONEncoder that use check_circular=False can segfault json: >>> import json >>> class EndlessJSONEncoder(json.JSONEncoder): ... def default(self, o): ... return [o] ... >>> EndlessJSONEncoder(check_circular=False).encode(5j) Segmentation fault The attached patch fixes it raising a "RuntimeError: maximum recursion depth exceeded". There might be other ways to get a segfault, because there are other recursive calls involving more functions (i.e. a calls b, and b calls a) that are not covered by the patch. |
|||
| msg135728 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年05月10日 19:11 | |
New patch fixes two more segfaults while encoding highly-nested objects. Updated the issue title accordingly. |
|||
| msg135751 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年05月10日 22:24 | |
New changeset a21f5af476cb by Ezio Melotti in branch '2.7': #12051: Fix segfault in json.dumps() while encoding highly-nested objects using the C accelerations. http://hg.python.org/cpython/rev/a21f5af476cb New changeset 9557e4eeb291 by Ezio Melotti in branch '3.1': #12051: Fix segfault in json.dumps() while encoding highly-nested objects using the C accelerations. http://hg.python.org/cpython/rev/9557e4eeb291 New changeset 3847b279d665 by Ezio Melotti in branch '3.2': #12051: merge with 3.1. http://hg.python.org/cpython/rev/3847b279d665 New changeset 821d7885c7ec by Ezio Melotti in branch 'default': #12051: merge with 3.2. http://hg.python.org/cpython/rev/821d7885c7ec |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:17 | admin | set | github: 56260 |
| 2011年05月10日 22:25:49 | ezio.melotti | set | status: open -> closed resolution: fixed stage: commit review -> resolved |
| 2011年05月10日 22:24:03 | python-dev | set | nosy:
+ python-dev messages: + msg135751 |
| 2011年05月10日 19:11:07 | ezio.melotti | set | files:
+ issue12051-2.diff messages: + msg135728 title: Segfault in JSONEncoder subclasses with check_circular=False -> Segfaults in _json while encoding objects |
| 2011年05月10日 16:17:19 | ezio.melotti | create | |