> + # For example, PyPy 1.9.0 raised TypeError for these cases because it > + # expects x to be a string if base is given. > + @support.cpython_only > + def test_base_arg_with_no_x_arg(self): > + self.assertEquals(int(base=6), 0) > + # Even invalid bases don't raise an exception. > + self.assertEquals(int(base=1), 0) > + self.assertEquals(int(base=1000), 0) > + self.assertEquals(int(base='foo'), 0) I think the above behavior is buggy and should be changed rather than frozen into CPython with a test. According to the docs, PyPy does it right. The current online doc gives the signature as int(x=0) int(x, base=10) <<where x is s string>> The 3.3.0 docstring says "When converting a string, use the optional base. It is an error to supply a base when converting a non-string." Certainly, accepting any object as a base, violating "The allowed values are 0 and 2-36." just because giving a base is itself invalid is crazy. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4