From 1adffc9ef86d2a150aea4467c3be8ab035619540 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 29 Mar 2015 01:17:42 +0200 Subject: [PATCH] traceback: Add dummy impl of format_tb(), format_exception_only(). As referenced by cgi module. --- traceback/metadata.txt | 4 ++-- traceback/setup.py | 6 +++--- traceback/traceback.py | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/traceback/metadata.txt b/traceback/metadata.txt index 34e7b20b..6b5dc732 100644 --- a/traceback/metadata.txt +++ b/traceback/metadata.txt @@ -1,3 +1,3 @@ -srctype=dummy +srctype=micropython-lib type=module -version=0.0.1 +version=0.1 diff --git a/traceback/setup.py b/traceback/setup.py index 87fd2e78..c48853c1 100644 --- a/traceback/setup.py +++ b/traceback/setup.py @@ -6,9 +6,9 @@ from setuptools import setup setup(name='micropython-traceback', - version='0.0.1', - description='Dummy traceback module for MicroPython', - long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.', + version='0.1', + description='traceback module for MicroPython', + long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.", url='https://github.com/micropython/micropython/issues/405', author='MicroPython Developers', author_email='micro-python@googlegroups.com', diff --git a/traceback/traceback.py b/traceback/traceback.py index 91c6150d..a32b0c44 100644 --- a/traceback/traceback.py +++ b/traceback/traceback.py @@ -1,4 +1,5 @@ -# Dummy file to preclude import errors -# Should be reimplemented for MicroPython -# Reason: -# Completely different underlying impl in MicroPython. +def format_tb(tb, limit): + return ["traceback.format_tb() not implemented\n"] + +def format_exception_only(type, value): + return [repr(value) + "\n"]