Issue1763

classification
Title: Number of expected arguments in string methods TypeError messages are incorrect
Type: behaviour Severity: minor
Components: Core Versions: Jython 2.5
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, sbruno
Priority: low Keywords:

Created on 2011-06-22.16:12:33 by sbruno, last changed 2013-02-26.18:05:50 by fwierzbicki.

Messages
msg6558 (view) Author: Santiago Bruno (sbruno) Date: 2011-06-22.16:13:31
>>> ".".join("a","b")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: join() takes 2 arguments (2 given)


While in python it is:
>>> ".".join("a","b")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: join() takes exactly one argument (2 given)
msg6559 (view) Author: Santiago Bruno (sbruno) Date: 2011-06-22.20:14:20
Issue title was: join() Message on a TypeError is incorrect
Actually it looks like a problem with all the string methods, the message seems to be counting the implicit self argument.

jython:
>>> "a".upper(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: upper() takes exactly one argument (1 given)

python:
>>> "a".upper(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: upper() takes no arguments (1 given)



jython:
>>> "a".split(",",1,2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: split() takes 1-3 arguments (3 given)

python:
>>> "a".split(",",1,2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: split() takes at most 2 arguments (3 given)



jython:
>>> "a".replace("a","b",1,1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: replace() takes 3-4 arguments (4 given)

python:
>>> "a".replace("a","b",1,1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: replace() takes at most 3 arguments (4 given)
History
Date User Action Args
2013-02-26 18:05:50fwierzbickisetnosy: + fwierzbicki
2013-02-25 19:40:53fwierzbickisetpriority: low
versions: + Jython 2.5, - 2.5.2
2011-06-22 20:14:20sbrunosetmessages: + msg6559
title: join() Message on a TypeError is incorrect -> Number of expected arguments in string methods TypeError messages are incorrect
2011-06-22 16:13:31sbrunosetmessages: + msg6558
2011-06-22 16:12:33sbrunocreate