|
11 | 11 | import threading
|
12 | 12 | import time
|
13 | 13 | from collections import namedtuple
|
14 |
| -from copy import copy |
15 | 14 | from datetime import datetime
|
16 | 15 | from decimal import Decimal
|
17 | 16 | from functools import partial, partialmethod, wraps
|
@@ -611,7 +610,7 @@ def serialize_frame(
|
611 | 610 | )
|
612 | 611 |
|
613 | 612 | if include_local_variables:
|
614 |
| - rv["vars"] = copy(frame.f_locals) |
| 613 | + rv["vars"] = frame.f_locals.copy() |
615 | 614 |
|
616 | 615 | return rv
|
617 | 616 |
|
@@ -1330,14 +1329,18 @@ def qualname_from_function(func):
|
1330 | 1329 |
|
1331 | 1330 | prefix, suffix = "", ""
|
1332 | 1331 |
|
1333 |
| - if hasattr(func, "_partialmethod") and isinstance( |
1334 |
| - func._partialmethod, partialmethod |
1335 |
| - ): |
1336 |
| - prefix, suffix = "partialmethod(<function ", ">)" |
1337 |
| - func = func._partialmethod.func |
1338 |
| - elif isinstance(func, partial) and hasattr(func.func, "__name__"): |
| 1332 | + if isinstance(func, partial) and hasattr(func.func, "__name__"): |
1339 | 1333 | prefix, suffix = "partial(<function ", ">)"
|
1340 | 1334 | func = func.func
|
| 1335 | + else: |
| 1336 | + # The _partialmethod attribute of methods wrapped with partialmethod() was renamed to __partialmethod__ in CPython 3.13: |
| 1337 | + # https://github.com/python/cpython/pull/16600 |
| 1338 | + partial_method = getattr(func, "_partialmethod", None) or getattr( |
| 1339 | + func, "__partialmethod__", None |
| 1340 | + ) |
| 1341 | + if isinstance(partial_method, partialmethod): |
| 1342 | + prefix, suffix = "partialmethod(<function ", ">)" |
| 1343 | + func = partial_method.func |
1341 | 1344 |
|
1342 | 1345 | if hasattr(func, "__qualname__"):
|
1343 | 1346 | func_qualname = func.__qualname__
|
|
0 commit comments