|
18 | 18 | "updates", |
19 | 19 | "removes", |
20 | 20 | "install_tracker", |
21 | | - "uninstall_tracker", |
22 | 21 | "reset", |
23 | 22 | "response_sizes", |
24 | 23 | ] |
@@ -486,33 +485,6 @@ def install_tracker(): |
486 | 485 | pymongo.command_cursor.CommandCursor._unpack_response = _unpack_response |
487 | 486 |
|
488 | 487 |
|
489 | | -def uninstall_tracker(): |
490 | | - if pymongo.collection.Collection.insert == _insert: |
491 | | - pymongo.collection.Collection.insert = _original_methods["insert"] |
492 | | - if pymongo.collection.Collection.insert_one == _insert_one: |
493 | | - pymongo.collection.Collection.insert_one = _original_methods["insert_one"] |
494 | | - if pymongo.collection.Collection.insert_many == _insert_many: |
495 | | - pymongo.collection.Collection.insert_many = _original_methods["insert_many"] |
496 | | - if pymongo.collection.Collection.update == _update: |
497 | | - pymongo.collection.Collection.update = _original_methods["update"] |
498 | | - if pymongo.collection.Collection.update_one == _update_one: |
499 | | - pymongo.collection.Collection.update_one = _original_methods["update_one"] |
500 | | - if pymongo.collection.Collection.update_many == _update_many: |
501 | | - pymongo.collection.Collection.update_many = _original_methods["update_many"] |
502 | | - if pymongo.collection.Collection.remove == _remove: |
503 | | - pymongo.collection.Collection.remove = _original_methods["remove"] |
504 | | - if pymongo.collection.Collection.delete_one == _delete_one: |
505 | | - pymongo.collection.Collection.delete_one = _original_methods["delete_one"] |
506 | | - if pymongo.collection.Collection.delete_many == _delete_many: |
507 | | - pymongo.collection.Collection.delete_many = _original_methods["delete_many"] |
508 | | - if pymongo.cursor.Cursor._refresh == _cursor_refresh: |
509 | | - pymongo.cursor.Cursor._refresh = _original_methods["cursor_refresh"] |
510 | | - if pymongo.command_cursor.CommandCursor._unpack_response == _unpack_response: |
511 | | - pymongo.command_cursor.CommandCursor._unpack_response = _original_methods[ |
512 | | - "_unpack_response" |
513 | | - ] |
514 | | - |
515 | | - |
516 | 488 | def reset(): |
517 | 489 | global queries, inserts, updates, removes, response_sizes |
518 | 490 | queries = [] |
@@ -548,7 +520,8 @@ def _tidy_stacktrace(): |
548 | 520 | fname = sys._getframe(i).f_code.co_filename |
549 | 521 | if ".html" in fname: |
550 | 522 | fnames.append(fname) |
551 | | - except Exception: |
| 523 | + # Stack can have not enough frames |
| 524 | + except ValueError: |
552 | 525 | break |
553 | 526 | fnames = list(set(fnames)) |
554 | 527 | trace = [] |
|
0 commit comments