1. PyPy
  2. PyPy project
  3. pypy
  4. Pull requests

Pull requests

#173 Declined
Repository
Deleted repository
Branch
stdlib-2.7.4-classobj-fix (f3379f5f9bf1)
Repository
pypy
Branch
stdlib-2.7.4

fix getattr/setattr behaviour.

Author
  1. Andrews Medina
Reviewers
Description
No description

Comments (8)

  1. Armin Rigo
    • should go to "default", not to the stdlib-2.7.4 branch.

    • should also cover delattr; does it? tests needed.

    • the changes cover old-instance-level and old-class-level getattr and setattr, but the tests not.

    • also include tests for cases where we get a UnicodeEncodeError: 'ascii' codec can't encode char(...)

    • finally, question: what about new-style instances, or more generally any object? They seem to work fine already in PyPy. Why do only old-style classes and instances not work?

    1. Armin Rigo

      No, the issue is not randomly fixing old- and new-style classes, because then e.g. "getattr(somelist, u'append')" would not work. The issue is understanding why it no longer works in that branch, and fixing the root cause.

        1. Armin Rigo

          Ok, I see. I think I added long ago unwrap_attr(), but its purpose was seriously abused since then, until the "# XXX" was written in the function because it seemed not to make much sense any more. How about killing it instead? I'm not sure, but I believe you'd get the correct behavior by simply calling "space.str_w(w_attr)" instead of unwrap_attr() everywhere, without the need for additional type checking (so making this pull request here unnecessary).