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

Surprising table equality behavior #12

Open
dubois opened this issue May 9, 2013 · 5 comments
Open

Surprising table equality behavior #12

dubois opened this issue May 9, 2013 · 5 comments

Comments

@dubois
Copy link

dubois commented May 9, 2013

import lupa
r = lupa.LuaRuntime()
r.globals().test == r.globals().test
False

I can supply a patch that adds richcmp and hash to _LuaTable.

@scoder
Copy link
Owner

scoder commented Jun 15, 2013

Sounds like a good idea.

@dubois
Copy link
Author

dubois commented Mar 11, 2014

I never got around to adding the patch :-P. Here it is!
https://gist.github.com/dubois/9478877

@scoder
Copy link
Owner

scoder commented Mar 11, 2014

Thanks. A couple of comments:

  • looks very good functionality wise
  • lacks tests
  • I prefer pull requests :)
  • "richcmp()" is bidirectional, so you can't be sure the first argument is "self", it might be the second (which is, I guess, why you thought you'd have to type the first argument explicitly)
  • "uintptr_t" appears to be C99. Not sure I want to require that. There's also the "stdint.h not in MSVC" issue. Tricky ground.
  • the comparison operators should use the CPython constants (from cpython.object cimport Py_EQ, ...), not plain integers. There's also no need to explicitly return True/False, just return the comparison result.
  • there's a special type "Py_hash_t" that Cython defines as return value of "hash()" (and that it backports for Py<3.2)

@SoulSen
Copy link

SoulSen commented Aug 22, 2020

I'm pretty sure this occurs with all _LuaObject, since I've experienced this with _LuaFunction too

@scoder
Copy link
Owner

scoder commented Aug 22, 2020

Don't know why this was closed. Doesn't look like it's resolved.
PR welcome, as described above.

@scoder scoder reopened this Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants