Commit 78931b6
Fix type bug in build_trackers -- skip non-callable modules (#1249)
Summary:
Pull Request resolved: #1249
Fix ``build_trackers()`` in ``tracker/api.py`` to skip non-callable modules
returned by ``load_module()``. Previously, ``ModuleType`` objects were being
passed where callables were expected, causing ``TypeError: 'module' object
is not callable`` at runtime.
**Root cause:** ``load_module()`` returns ``types.ModuleType`` for packages
(directories with ``__init__.py``) but ``build_trackers()`` assumed all
return values were factory callables.
**Fix:** Added ``callable()`` guard before invoking the loaded object.
Non-callable modules are silently skipped with a debug log message.
**Cleanup:** Removed unused ``source_data`` variable in test MockTracker.
Differential Revision: D959321841 parent 307b3d7 commit 78931b6
1 file changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | 86 | | |
89 | 87 | | |
90 | 88 | | |
| |||
289 | 287 | | |
290 | 288 | | |
291 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
292 | 312 | | |
293 | 313 | | |
294 | 314 | | |
| |||
0 commit comments