Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telnetlib raises UnboundLocalError #37016

Closed
noah mannequin opened this issue Aug 11, 2002 · 3 comments
Closed

telnetlib raises UnboundLocalError #37016

noah mannequin opened this issue Aug 11, 2002 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@noah
Copy link
Mannequin

noah mannequin commented Aug 11, 2002

BPO 593696
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2002-08-11.20:09:40.000>
created_at = <Date 2002-08-11.16:57:00.000>
labels = ['library']
title = 'telnetlib raises UnboundLocalError'
updated_at = <Date 2002-08-11.20:09:40.000>
user = 'https://bugs.python.org/noah'

bugs.python.org fields:

activity = <Date 2002-08-11.20:09:40.000>
actor = 'nnorwitz'
assignee = 'nnorwitz'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2002-08-11.16:57:00.000>
creator = 'noah'
dependencies = []
files = []
hgrepos = []
issue_num = 593696
keywords = []
message_count = 3.0
messages = ['11907', '11908', '11909']
nosy_count = 3.0
nosy_names = ['nnorwitz', 'terry.reedy', 'noah']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue593696'
versions = ['Python 2.2']

@noah
Copy link
Mannequin Author

noah mannequin commented Aug 11, 2002

I have a tiny test script that causes telnetlib to
crash due to an UnboundLocalError exception.
I tested this on Python 2.2.1 on Linux and OpenBSD.
Here is the uname output of both test machines:
OpenBSD ark2 2.9 GENERIC#653 i386
Linux starship.python.net 2.2.19-6.2.12smp #1 SMP Fri
Oct 26 11:29:57 EDT 2001 i686 unknown

Here is the script:

import telnetlib
tn = telnetlib.Telnet ("surfers.org", 4242)
tn.read_until ("Please enter your name:")
tn.write ("Mongo\n")
tn.read_until ("just connect to Surfers:")

Here is the exact error:

# python term.py
Traceback (most recent call last):
  File "term.py", line 6, in ?
    tn.read_until ("just connect to Surfers:")
  File "/usr/local/lib/python2.2/telnetlib.py", line 297, in 
read_until
    self.process_rawq()
  File "/usr/local/lib/python2.2/telnetlib.py", line 424, in 
process_rawq
    self.msg('IAC %d not recognized' % ord(opt))
UnboundLocalError: local variable 'opt' referenced before 
assignment

Let me know if I can provide more information.

Yours,
Noah

@noah noah mannequin closed this as completed Aug 11, 2002
@noah noah mannequin assigned nnorwitz Aug 11, 2002
@noah noah mannequin added the stdlib Python modules in the Lib dir label Aug 11, 2002
@noah noah mannequin closed this as completed Aug 11, 2002
@noah noah mannequin assigned nnorwitz Aug 11, 2002
@noah noah mannequin added the stdlib Python modules in the Lib dir label Aug 11, 2002
@terryjreedy
Copy link
Member

Logged In: YES
user_id=593130

This appears to be trivial fix in telnetlib.py, line 424:
self.msg('IAC %d not recognized' % ord(opt))
I believe 'opt' should be changed to 'c' since it is c that is
not recognized in the if-elif series above this line. Opt is
only set for certain values of c.

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Aug 11, 2002

Logged In: YES
user_id=33168

Checked in as 1.16.10.2.
Thanks!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

1 participant