UnboundLocalError in overloading.py

Bug #1207438 reported by Tom Henderson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyBindGen
Fix Released
Undecided
Unassigned

Bug Description

building ns-3-dev with python bindings enabled (changeset 04ef86d43986) yields the following error in build/src/lte/bindings/ns3modulegen.log

Traceback (most recent call last):
  File "bindings/python/ns3modulegen-modular.py", line 125, in <module>
    main(sys.argv)
  File "bindings/python/ns3modulegen-modular.py", line 121, in main
    root_module.generate(out)
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/module.py", line 894, in generate
    self.do_generate(sink_manager, module_file_base_name)
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/module.py", line 761, in do_generate
    class_.generate(sink, self)
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/cppclass.py", line 2029, in generate
    self._generate_methods(code_sink, parent_caller_methods)
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/cppclass.py", line 2412, in _generate_methods
    utils.call_with_error_handling(overload.generate, (code_sink,), {}, overload)
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/utils.py", line 147, in call_with_error_handling
    return callback(*args, **kwargs)
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/overloading.py", line 131, in generate
    self._normalize_py_method_flags()
  File "/a/users/tomh/ns-3-allinone/pybindgen/pybindgen/overloading.py", line 114, in _normalize_py_method_flags
    settings.error_handler.handle_error(wrapper, ex, tb)
UnboundLocalError: local variable 'ex' referenced before assignment

I worked around this with a small hack:

=== modified file 'pybindgen/overloading.py'
--- pybindgen/overloading.py 2009-09-16 12:06:59 +0000
+++ pybindgen/overloading.py 2013-08-01 16:06:39 +0000
@@ -111,6 +111,7 @@
                         modified = True
                         self.wrappers.remove(wrapper)
                         tb = traceback.extract_stack()
+ ex = 'none'
                         settings.error_handler.handle_error(wrapper, ex, tb)
                         break

I could not easily determine what has changed in the lte bindings to force this error, but the above workaround lets me build ns-3 and run all python tests successfully.

Gustavo Carneiro (gjc)
Changed in pybindgen:
status: New → Fix Committed
Gustavo Carneiro (gjc)
Changed in pybindgen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.