Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

unboundlocalerror in xtracebackexc on syntaxerror #12

@kingarrrt

Description

@kingarrrt
188 def format_exception(self):
--> 189     return self._format_lines(self._format_exception())
    190
    191 def print_tb(self):
  File ".venv/py27/lib/python2.7/site-packages/xtraceback/xtraceback.py", line 177, in XTraceback._format_exception
    self = <xtraceback.xtraceback.XTraceback object at 0x7f84fc7e87d0>
    175 lines = []
    176 for exc in self.exceptions:
--> 177     lines.extend(exc.format_exception())
            exc = <xtraceback.xtracebackexc.XTracebackExc object at 0x7f84fc7...
            lines = []
    178 return lines
    179
  File ".venv/py27/lib/python2.7/site-packages/xtraceback/xtracebackexc.py", line 119, in XTracebackExc.format_exception
    self = <xtraceback.xtracebackexc.XTracebackExc object at 0x7f84fc7e8890>
    116 lines = list(self.format_tb())
    117 if lines:
    118     lines.insert(0, "Traceback (most recent call last):\n")
--> 119 lines.extend(self.format_exception_only())
        lines = [
            'Traceback (most recent call last):\n',
            '  File "<stdlib>/unittest/case.py", line 329, in TestCase.run\n    self = <pico.test.unit.query.test_kdbquery.TestKdbConnection testMethod=t...\n    result = <nose.result.TextTestResult run=2 errors=0 failures=0>\n     327 else:\n     328     try:\n---> 329         testMethod()\n                 orig_result = <nose.result.TextTestResult run=2 errors=0 fai...\n                 success = False\n                 testMethod = <bound method TestKdbConnection.test_execute of...\n     330     except KeyboardInterrupt:\n     331         raise\n',
            '  File "pico/test/unit/query/test_kdbquery.py", line 57, in TestKdbConnection.test_execute\n    self = <pico.test.unit.query.test_kdbquery.TestKdbConnection testMethod=t...\n      55 with mock.patch.object(conn._conn, "__call__",\n      56                        return_value=mock_result,\n----> 57                        autospec=True) as patch:\n                                conn = <pico.query.kdbquery.KdbConnection obj...\n                                pool = <Mock id=\'140209148528912\'>\n      58     with conn:\n      59         result = conn(query="select 1")\n',
            '  File ".venv/py27/lib/python2.7/site-packages/mock.py", line 1349, in _patch.__enter__\n    self = <mock._patch object at 0x7f84fc7e8250>\n    1347 \n    1348     new = create_autospec(autospec, spec_set=spec_set,\n--> 1349                           _name=self.attribute, **kwargs)\n                                   autospec = <bound method Mock.__call__ of ...\n                                   kwargs = {\n                                       \'return_value\': <MagicMock spec=\'QTable\' id=\'140209149632080\'>,\n                                       }\n                                   local = False\n                                   new = sentinel.DEFAULT\n                                   original = <bound method Mock.__call__ of ...\n                                   spec_set = False\n    1350 elif kwargs:\n    1351     # can\'t set keyword args when we aren\'t creating the mock\n',
            '  File ".venv/py27/lib/python2.7/site-packages/mock.py", line 2241, in create_autospec\n    spec = <bound method Mock.__call__ of <Mock spec=\'QConnection\' id=\'140209...\n    spec_set = False\n    instance = False\n    _name = \'__call__\'\n    **kwargs = {\'spec\': <function __call__ at 0x7f85039c85f0>}\n    2239     mock._mock_children[entry] = new\n    2240     skipfirst = _must_skip(spec, entry, is_type)\n--> 2241     _check_signature(original, new, skipfirst=skipfirst)\n             Klass = <class \'mock.MagicMock\'>\n             _kwargs = {\n                 \'return_value\': <MagicMock spec=\'QTable\' id=\'140209149632080\'>,\n                 \'spec\': <bound method Mock.__call__ of <Mock spec=\'QConnection\' id=\'140209148883088\'>>,\n                 }\n             _new_name = \'\'\n             entry = \'im_func\'\n             is_type = False\n             mock = <function __call__ at 0x7f84fc845410>\n             new = <MagicMock name=\'__call__.im_func\' spec=\'function\' id=\'140...\n             original = <function __call__ at 0x7f85039c85f0>\n             parent = <MagicMock name=\'__call__\' spec=\'instancemethod\' id=\'14...\n             skipfirst = False\n    2242 \n    2243 # so functions created with _set_signature become instance attributes,\n',
            '  File ".venv/py27/lib/python2.7/site-packages/mock.py", line 212, in _check_signature\n    func = <function __call__ at 0x7f85039c85f0>\n    mock = <MagicMock name=\'__call__.im_func\' spec=\'function\' id=\'14020914856...\n    skipfirst = False\n    instance = False\n     210 # unfortunately even not in the first place\n     211 src = "lambda _mock_self, %s: None" % signature\n---> 212 checksig = eval(src, {})\n         result = (\n             \'_mock_self, *args, **kwargs\', <function __call__ at 0x7f85039c85f0>,\n             )\n         signature = \'_mock_self, *args, **kwargs\'\n         src = \'lambda _mock_self, _mock_self, *args, **kwargs: None\'\n     213 _copy_func_details(func, checksig)\n     214 type(mock)._mock_check_sig = checksig\n',
            ]
    120 return lines
  File ".venv/py27/lib/python2.7/site-packages/xtraceback/xtracebackexc.py", line 111, in XTracebackExc.format_exception_only
    self = <xtraceback.xtracebackexc.XTracebackExc object at 0x7f84fc7e8890>
    109     stype = str(self.etype)
    110 lines.append("%s%s\n" % (stype,
--> 111                          value_str and ": %s" % value_str or ""))
                                 lines = []
                                 stype = 'SyntaxError'
    112
    113 return lines
UnboundLocalError: local variable 'value_str' referenced before assignment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions