python / python/cpython

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

Open
#139,349 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending stdlib topic-repl type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the macOS failure with the provided script, starting at the _pyrepl.readline entry point and its _wrapper.reader representation. Inspect the UnixConsole representation path and verify that printing the reader no longer raises AttributeError for missing posxy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.