New issue 2924: int.to_bytes argument name "nbytes" should be "length" https://bitbucket.org/pypy/pypy/issues/2924/intto_bytes-argument-name-nbytes-should-be
Daniel Herding: Our codebase contains code like this: int.to_bytes(1024, length=8, byteorder="big") Running the same code in Python 3.5.3 [PyPy 6.0.0 with GCC 6.2.0 20160901] on linux leads to: TypeError: to_bytes() got an unexpected keyword argument 'length' Running int.to_bytes() in PyPy shows: TypeError: to_bytes() missing 3 required positional arguments: 'self', 'nbytes', and 'byteorder' The following works in PyPy: int.to_bytes(1024, nbytes=8, byteorder="big") # Does not work in CPython or simply int.to_bytes(1024, 8, byteorder="big") # Also works in CPython Omitting the name of the positional argument is a possible workaround, which has been used by other people: https://github.com/LonamiWebs/Telethon/issues/833 However, it would be nice if PyPy accepted the standardized argument name "length" instead of "nbytes". _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue