Commit Graph

55 Commits

Author SHA1 Message Date
Sumanth Ratna
249bc245b9 Only run ps -ww -p $PID -o command= if available 2020-12-21 01:40:49 +01:00
Riley Shaw
4dab3e218a fix closing single quote regex class for comment pattern (#89)
* fix COMMENT_REGXP

i noticed a couple of bugs in the regular expression while testing.

the first bug is found when a line doesn't have a comment but has `#` in a string. the matcher seems to forcefully fetch the `#` from inside of the string. [proof](https://regex101.com/r/tUCeTa/1). to fix this i have made the comment optional.

the second bug was introduced because a `"` was put where a `'` should have been. this causes a `'` delimited string containing a `"` to be matched incorrectly. [proof](https://regex101.com/r/qlunxG/1). to fix this i have replaced the `"` with `\'`

* exclude optional comment
2019-06-17 18:08:41 +02:00
Daniel Troeder
cadd8e6834 fix Python 2 import (fix #78) 2019-05-07 23:12:13 +02:00
Daniel Hahler
02b0b51dcf format_value: catch BaseException
Ref: https://github.com/Qix-/better-exceptions/issues/85#issuecomment-489930136
2019-05-07 15:33:33 +02:00
Delgan
f10e1fb154
Align "format_traceback" output with built-in function (#64) 2019-01-10 23:51:03 +01:00
Delgan
c170bf65a6
Surround repr() with try / except in case object is unprintable (#65) 2019-01-10 23:50:48 +01:00
Josh Junon
d5f56d8136 0.2.2 2019-01-10 15:17:39 +01:00
Delgan
04f7e97206
Add support for chained exceptions (#63) 2019-01-08 22:09:32 +01:00
Delgan
4d6a9daf6a
Fix unit tests failing on Python 3.7 (#62) 2019-01-07 20:59:59 +01:00
Josh Junon
0b13582973 0.2.1 2018-01-16 16:19:52 +01:00
Josh Junon
62a1690097 0.2.0 2018-01-16 16:17:20 +01:00
Delgan
a257cbb0c1 Remove outdated module docstring 2017-10-19 12:28:24 +02:00
paradoxxxzero
ab227a9d96 Fix SyntaxError missing exception part 2017-10-19 12:01:29 +02:00
Delgan
f926bcccc2 Add automatic hook based on an environment variable 2017-10-19 12:01:29 +02:00
Delgan
c9c2ce9d9c Add a way to use better_exceptions functions without side effects
Importing 'better_exceptions' automatically replaces the default sys.excepthook and
add an handler to the root logger.
This is very useful in most cases, but sometimes the user may want to use library
functions without any side effects.

Two packages can be published: the first contains all the functions of the library,
and the second uses these functions to automatically set up the better exception system.
The user can choose the package he wants to import, and there is no code repetition
in the repository

The core functions had to be encapsulated into a class so that user can still modify
global parameters to his convenience.
2017-09-13 09:06:45 +02:00
Delgan
35eaebff0b Fix raw codes appearing with Python 3 on Windows cmd
Colorama does not wrap the 'buffer' attributes of streams, so writing
to it would not convert ANSI codes on Windows.
The workaround is to use '.write()' without encoding the string,
and rather wrap the stream used by Colorama to encode substrings
which are sent once win32 call are made.
2017-09-11 09:59:20 +02:00
Delgan
712c2dbdfc Add __version__ to top level module 2017-09-10 22:25:43 +02:00
Delgan
f9e1dddc27 Fix uncaught error on some exotic environments 2017-09-10 22:25:01 +02:00
TaoBeier
821b9e4555 fix indentation and change nodes iterable 2017-09-10 22:11:09 +02:00
Josh Junon
a6b49d021f run PYTHONSTARTUP in better-exceptions REPL 2017-05-12 00:09:34 -07:00
Kevin Woldt
4ab6076c3e using relative imports to support sub packaging (#30) 2017-05-03 12:52:37 -07:00
Josh Junon
d807d03afc use new PY3 variable instead of system check 2017-04-24 15:51:18 -07:00
cold
cd378ffe7d Fix Non-ASCII exceptions UnicodeDecodeError (#33)
* Fix Non-ASCII exceptions UnicodeDecodeError

Fix some code includes Non-ASCII characters will cause `UnicodeDecodeError`

* Add test encoding & regenerate test data
2017-04-24 15:48:26 -07:00
Josh Junon
9a53e5ffa8 add isatty(2) check back in to color support detection 2017-03-28 14:16:31 -07:00
Josh Junon
f6f74b8ea7 add logger patching (closes #21) 2017-03-28 14:12:14 -07:00
Josh Junon
3c51839251 allow for either dict or module __builtins__ (fixes #26) 2017-03-28 12:56:32 -07:00
Josh Junon
096281cbae clarify usage message when default interpreter is used 2017-03-26 09:23:30 -07:00
Josh Junon
f548b84f21 add special case to remove runcode() calls 2017-03-24 01:18:39 -07:00
Josh Junon
6db81f32c6 omit last frame if we created it 2017-03-24 01:14:15 -07:00
Josh Junon
bcac52d39b define final_source in case there isn't a frame 2017-03-24 01:05:49 -07:00
Josh Junon
2a9b86d8d3 ignore dummy exception frame if tb not present 2017-03-24 00:58:00 -07:00
Josh Junon
9024677a77 allow for non-whitespace characters to surround strings 2017-03-24 00:46:15 -07:00
Josh Junon
7fabe8725f fix encoding issues and accidental skipping when compact -c is used 2017-03-24 00:35:28 -07:00
Josh Junon
c7e306d309 fix -c parsing when code is the last program argument 2017-03-24 00:06:18 -07:00
Josh Junon
f1ba394557 decode output from spawn() prior to shlex.split-ting it 2017-03-23 23:58:18 -07:00
Josh Junon
df512de997 sort colored ast nodes based on their col_offset (fixes #18) 2017-03-23 23:46:46 -07:00
Josh Junon
46363e1061 read command line from system if using -c 2017-03-23 23:31:11 -07:00
Josh Junon
e359b7dbb4 add ability to silence the banner 2017-03-23 22:09:56 -07:00
Josh Junon
2d0978b0f1 add interactive mode 2017-03-23 21:04:03 -07:00
Josh Junon
a53ef3c58a fix line munging (fixes #11) 2017-03-23 11:40:15 -07:00
JiuLi Gao
f5defff2b5 Update funciton get_frame_information (#14)
We could use `inspect.getframeinfo()` method to parse all info of a frame that we need.
2017-03-23 11:39:51 -07:00
Josh Junon
e45928fb6b add more terminfo paths 2017-03-23 10:55:51 -07:00
P M
f33c858e15 Improve terminfo detection (fixes #15) (#16)
* Iterate over possible terminfo directories.

* Simplify iterating over terminfo subdirs.
2017-03-23 10:53:33 -07:00
JiuLi Gao
5df6bdef70 Update __init__.py (#13)
typo error
2017-03-22 20:48:27 -07:00
Josh
87413759cc use better color detection methods and add color support on windows
Makes color detection a little more intuitive and adds proper Windows support via colorama (only installed on Windows).
2017-03-22 18:41:02 -07:00
Josh
222d871323 use system encoding and detect non-unicode encoding (#9)
use system encoding and detect non-unicode encoding
2017-03-22 12:30:36 -07:00
Josh Junon
a81b768fd6 don't use bolded angle box character (fixes #6) 2017-03-22 10:26:45 -07:00
Florian Mounier
3801a070ec Remove useless strip parameter 2017-03-22 09:12:37 -07:00
Florian Mounier
6c22d2b1a4 Use linecache 2017-03-22 09:12:37 -07:00
Florian Mounier
4765a593c0 Fix assert special handling. Should probably fix #2 and address #3 2017-03-22 11:19:45 +01:00