`profiling.sampling` in `--binary` mode raises a `UnicodeEncodeError` while collecting the samples
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with Lib/profiling/sampling/binary_collector.py, where the traceback shows the failing write, and inspect how sample stack frame strings are encoded. Reproduce with the xarray documentation profiling command on Python 3.15.1; done means binary mode collects samples without raising UnicodeEncodeError for the reported surrogate character.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug report
when trying to profile building xarray's docs with profiling.sampling I get a UnicodeEncodeError while collecting the result.
For now, the command to reproduce is:
git clone https://github.com/pydata/xarray
cd xarray
pixi run -e doc python -m profiling.sampling run --binary -o profile.bin -m sphinx -b html -d _build/doctrees . _build/html
And the traceback is:
Traceback (most recent call last):
File "<frozen runpy>", line 201, in _run_module_as_main
File "<frozen runpy>", line 87, in _run_code
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/__main__.py", line 65, in <module>
main()
~~~~^^
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/cli.py", line 1011, in main
_main()
~~~~~^^
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/cli.py", line 1167, in _main
handler(args)
~~~~~~~^^^^^^
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/cli.py", line 1316, in _handle_run
collector = sample(
process.pid,
...<9 lines>...
blocking=args.blocking,
)
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/sample.py", line 535, in sample
profiler.sample(collector, duration_sec, async_aware=async_aware)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/sample.py", line 192, in sample
raise e from None
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/sample.py", line 180, in sample
collector.collect(stack_frames)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File ".../xarray/.pixi/envs/doc/lib/python3.15/profiling/sampling/binary_collector.py", line 112, in collect
self._writer.write_sample(stack_frames, timestamp_us)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'utf-8' codec can't encode character '\uddd0' in position 240: surrogates not allowed
I'm fully aware that this isn't a very minimal reproducer, but I didn't manage to find a minimal example as everything else I tried does not fail.
If you need more information or have any ideas on how to narrow this down I'd be happy to help.
versions:
python: 3.15.1 (conda-forge, linux-64)
sphinx: 9.2.0
(for a full env see https://github.com/pydata/xarray/actions/runs/40041611450/job/120713798864#step:3:1830 (lines 1830-2055))
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs
- gh-160615
- Ngôn ngữ chính
- Python
- Star
- 77.7k
- Fork
- 38.3k
- Merge trung bình
- 12 giờ 27 phút
- Pull request đã merge (30 ngày)
- 710
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python/cpython
-
3.16 build type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
python/cpython#160829 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies infra topic-ensurepip
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
symtable: repr() of a Symbol raises TypeError under -X lazy_imports=allCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởstdlib topic-lazy-imports type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
python/cpython#160810 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tarfile: extractfile(member).read() of a sparse member is slow due to repeated bytes concatenationĐang mởperformance stdlib triaged type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
python/cpython#160774 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tests topic-profiling type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
python/cpython#160334 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của python/cpython
Issue tương tự
-
area/profiles comp/cli P3 type/feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NousResearch/hermes-agent#146372 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Document obs-aw-automerge contract and fix automerge doc inconsistenciesCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
GeoSeries scale and skew tests fail with pytest 9.2.0Có thể đã có người làm @jiayuasu đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
admission-deferred priority: medium status: ready work-class: scoped
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
melodic-software/claude-code-plugins#10887 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày