Issue12276
Created on 2011-06-07 08:48 by ggenellina, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| tracebacklimitbug.py | ggenellina, 2011-06-07 08:48 | |||
| Limit-traceback-if-sys.tracebacklimit-is-set.patch | chillaranand, 2016-12-27 11:18 | review | ||
| Limit-traceback-if-sys.tracebacklimit-is-set.patch | chillaranand, 2017-01-02 04:58 | review | ||
| Messages (8) | |||
|---|---|---|---|
| msg137792 - (view) | Author: Gabriel Genellina (ggenellina) | Date: 2011-06-07 08:48 | |
Python 3.x doesn't honor sys.tracebacklimit=0 According to http://docs.python.org/py3k/library/sys.html#sys.tracebacklimit when set to 0, it should not print any stack trace, but it does. Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. p3> import sys p3> sys.tracebacklimit = 0 p3> p3> def f(x): ... return f(x-1) if x else 0/0 ... p3> f(5) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f ZeroDivisionError: division by zero p3> |
|||
| msg137793 - (view) | Author: Gabriel Genellina (ggenellina) | Date: 2011-06-07 08:50 | |
Originally reported by Thorsten Kampe in comp.lang.python 2011-5-27 <http://permalink.gmane.org/gmane.comp.python.general/691496> |
|||
| msg137794 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * ![]() |
Date: 2011-06-07 09:10 | |
This was changed a long time ago with 565012d1123d |
|||
| msg137893 - (view) | Author: Gabriel Genellina (ggenellina) | Date: 2011-06-08 02:09 | |
Is this the intended behavior then? I don't get the rationale for that change. There is no way to completely supress traceback information now; for sys.tracebacklimit to be of any significance, it must be >= 1; 0 and negative values behave the same as it not being set (that is, a full traceback is printed). |
|||
| msg138147 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2011-06-11 02:17 | |
Either code or doc must change (with 'version changed' note). Doc: "The default is 1000. When set to 0 or less, all traceback information is suppressed and only the exception type and value are printed." Christian's patch: "values <= 0 are replaced with a default value to avoid infinite recursion and other issues." Default is 1000. I do not see the logic of changing 'nothing' to 'everything'. I am puzzled how printing nothing causes infinite recursion. |
|||
| msg284084 - (view) | Author: Anand Reddy Pandikunta (chillaranand) * | Date: 2016-12-27 11:18 | |
This patch fixes the issue. I have also added 2 test cases to make sure it works. |
|||
| msg284463 - (view) | Author: Anand Reddy Pandikunta (chillaranand) * | Date: 2017-01-02 04:58 | |
Update patch with better assertions |
|||
| msg305597 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-11-05 14:55 | |
Do you mind to create a pull request on GitHub Anand? Issue31949 fixes this and several other bugs in PyTraceBack_Print(), but it may be worth to fix this bug first, especially if the patch contains tests. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:18 | admin | set | github: 56485 |
| 2017-11-20 18:05:52 | serhiy.storchaka | set | status: open -> closed superseder: Bugs in PyTraceBack_Print() resolution: duplicate stage: needs patch -> resolved |
| 2017-11-05 14:55:19 | serhiy.storchaka | set | versions:
+ Python 3.7, - Python 3.5 nosy: + serhiy.storchaka messages: + msg305597 assignee: docs@python -> serhiy.storchaka |
| 2017-01-02 04:58:13 | chillaranand | set | files:
+ Limit-traceback-if-sys.tracebacklimit-is-set.patch messages: + msg284463 |
| 2016-12-27 11:19:00 | chillaranand | set | files:
+ Limit-traceback-if-sys.tracebacklimit-is-set.patch messages:
+ msg284084 |
| 2016-08-08 06:01:57 | matrixise | set | nosy:
+ matrixise |
| 2016-08-05 22:34:26 | berker.peksag | set | keywords:
+ easy stage: needs patch type: behavior versions: + Python 3.5, Python 3.6, - Python 3.1, Python 3.2 |
| 2014-08-08 03:28:13 | ned.deily | link | issue22169 superseder |
| 2011-06-11 02:17:34 | terry.reedy | set | nosy:
+ christian.heimes, terry.reedy, docs@python messages: + msg138147 assignee: docs@python |
| 2011-06-08 02:09:11 | ggenellina | set | messages: + msg137893 |
| 2011-06-07 09:22:27 | vstinner | set | nosy:
+ vstinner |
| 2011-06-07 09:10:18 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg137794 |
| 2011-06-07 08:50:17 | ggenellina | set | messages: + msg137793 |
| 2011-06-07 08:48:21 | ggenellina | create | |
