Skip to content

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

@yihong0618

Description

@yihong0618

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/[email protected]/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/[email protected]/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions