python / python/cpython

print _pyrepl.readline._wrapper.reader will raise error'UnixConsole' object has no attribute 'posxy'

Đang mở
#139,349 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

pending stdlib topic-repl type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
36k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Bug report

Bug description:
print('Before importing _pyrepl.readline:')
import sys
import os
print('PYTHON_HISTORY:', os.environ.get('PYTHON_HISTORY'))

print('\\nImporting _pyrepl.readline...')
import _pyrepl.readline

print('After importing:')
print('History length:', _pyrepl.readline.get_current_history_length())
print('Wrapper object:', _pyrepl.readline._wrapper)
print('Wrapper reader:', _pyrepl.readline._wrapper.reader)

./python.exe test.py

Before importing _pyrepl.readline:
PYTHON_HISTORY: None
\nImporting _pyrepl.readline...
After importing:
History length: 0
Wrapper object: _ReadlineWrapper(f_in=3, f_out=4, saved_history_length=-1, startup_hook=None)
Wrapper reader: Traceback (most recent call last):
  File "/Users/yihong/test.py", line 12, in <module>
    print('Wrapper reader:', _pyrepl.readline._wrapper.reader)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/reprlib.py", line 21, in wrapper
    result = user_function(self)
  File "<string>", line 41, in __repr__
  File "/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/reprlib.py", line 21, in wrapper
    result = user_function(self)
  File "<string>", line 9, in __repr__
AttributeError: 'UnixConsole' object has no attribute 'posxy'

this exists from 3.13 to 3.15

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs
  • gh-139351

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi macOS bằng script được cung cấp, bắt đầu từ điểm vào _pyrepl.readline và biểu diễn _wrapper.reader của nó. Kiểm tra đường dẫn biểu diễn của UnixConsole và xác minh rằng việc in reader không còn gây ra AttributeError do thiếu posxy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.