|
11 | 11 | import threading
|
12 | 12 | import time
|
13 | 13 | from collections import namedtuple
|
14 |
| -from copy import copy |
15 | 14 | from decimal import Decimal
|
16 | 15 | from numbers import Real
|
17 | 16 |
|
@@ -672,7 +671,7 @@ def serialize_frame(
|
672 | 671 | )
|
673 | 672 |
|
674 | 673 | if include_local_variables:
|
675 |
| - rv["vars"] = copy(frame.f_locals) |
| 674 | + rv["vars"] = frame.f_locals.copy() |
676 | 675 |
|
677 | 676 | return rv
|
678 | 677 |
|
@@ -1414,16 +1413,18 @@ def qualname_from_function(func):
|
1414 | 1413 |
|
1415 | 1414 | prefix, suffix = "", ""
|
1416 | 1415 |
|
1417 |
| - if ( |
1418 |
| - _PARTIALMETHOD_AVAILABLE |
1419 |
| - and hasattr(func, "_partialmethod") |
1420 |
| - and isinstance(func._partialmethod, partialmethod) |
1421 |
| - ): |
1422 |
| - prefix, suffix = "partialmethod(<function ", ">)" |
1423 |
| - func = func._partialmethod.func |
1424 |
| - elif isinstance(func, partial) and hasattr(func.func, "__name__"): |
| 1416 | + if isinstance(func, partial) and hasattr(func.func, "__name__"): |
1425 | 1417 | prefix, suffix = "partial(<function ", ">)"
|
1426 | 1418 | func = func.func
|
| 1419 | + else: |
| 1420 | + # The _partialmethod attribute of methods wrapped with partialmethod() was renamed to __partialmethod__ in CPython 3.13: |
| 1421 | + # https://github.com/python/cpython/pull/16600 |
| 1422 | + partial_method = getattr(func, "_partialmethod", None) or getattr( |
| 1423 | + func, "__partialmethod__", None |
| 1424 | + ) |
| 1425 | + if isinstance(partial_method, partialmethod): |
| 1426 | + prefix, suffix = "partialmethod(<function ", ">)" |
| 1427 | + func = partial_method.func |
1427 | 1428 |
|
1428 | 1429 | if hasattr(func, "__qualname__"):
|
1429 | 1430 | func_qualname = func.__qualname__
|
|
0 commit comments