[issue11983] Inconsistent hash and comparison for code objects

2014-04-14 Thread Caelyn McAulay
Caelyn McAulay added the comment: Here is a patch to add the requested documentation to code.h - I expanded it to specify (as per the conversation in this issue) that co_name is used in both hash and comparisons while co_firstlineno is used only in comparisons. I do not attempt explain the

[issue11983] Inconsistent hash and comparison for code objects

2014-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0e35cef1d984 by Andrew Kuchling in branch 'default': #11983: update comment to describe which fields are used and why. http://hg.python.org/cpython/rev/0e35cef1d984 -- nosy: +python-dev ___ Python

[issue11983] Inconsistent hash and comparison for code objects

2014-04-14 Thread A.M. Kuchling
A.M. Kuchling added the comment: Thanks for the patch! -- assignee: - akuchling nosy: +akuchling resolution: - fixed stage: - committed/rejected status: open - closed versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org

[issue11983] Inconsistent hash and comparison for code objects

2013-01-19 Thread Eugene Toder
Eugene Toder added the comment: If you add co_firstlineno into code_hash you can say something like /* The rest isn't used in hash and comparisons, except co_name and co_firstlineno, which are preserved for tracebacks and debuggers. */ (Otherwise you'd need to explain why co_firstlineno

[issue11983] Inconsistent hash and comparison for code objects

2013-01-17 Thread Brett Cannon
Brett Cannon added the comment: I have no issue with the current behaviour, so it sounds like the source comment just needs updating. Care to suggest some wording, Eugene? -- ___ Python tracker rep...@bugs.python.org

[issue11983] Inconsistent hash and comparison for code objects

2013-01-16 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: -brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11983 ___ ___ Python-bugs-list

[issue11983] Inconsistent hash and comparison for code objects

2013-01-16 Thread Antoine Pitrou
Antoine Pitrou added the comment: It doesn't actually fix the bug and makes hash inconsistent with cmp. The only constraint is that a == b imply hash(a) == hash(b). But the converse doesn't have to be true, i.e. if it perfectly possible to have hash(a) == hash(b) and a != b (pretty much by

[issue11983] Inconsistent hash and comparison for code objects

2013-01-16 Thread Antoine Pitrou
Antoine Pitrou added the comment: Woops, I saw Brett unnosied himself, sorry for nosying him by mistake. -- nosy: -brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11983 ___

[issue11983] Inconsistent hash and comparison for code objects

2013-01-16 Thread Brett Cannon
Brett Cannon added the comment: Making as pending for someone to prove my fix is bad for the problem (since it passes an explicit test), else I will close it in the near-ish future. -- nosy: +brett.cannon status: open - pending ___ Python tracker

[issue11983] Inconsistent hash and comparison for code objects

2013-01-16 Thread Eugene Toder
Eugene Toder added the comment: My comment will make more sense if you follow the links that I provided. Brett's check-in (http://hg.python.org/cpython-fullhistory/rev/8127a55a57cb) says that it fixes bug #1190011 (http://www.mail-archive.com/python-bugs-list@python.org/msg02440.html). The

[issue11983] Inconsistent hash and comparison for code objects

2011-05-08 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: It appears that * co_name was added to hash and cmp in this check-in by Guido: http://hg.python.org/cpython-fullhistory/diff/525b2358721e/Python/compile.c I think the reason was to preserve function name when defining multiple functions with

[issue11983] Inconsistent hash and comparison for code objects

2011-05-08 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Btw, disabling dedup for codes won't be the first exception -- we already avoid coalescing -0.0 with 0.0 for float and complex, even though they compare equal. -- ___ Python tracker

[issue11983] Inconsistent hash and comparison for code objects

2011-05-06 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: What fix would you propose? -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11983 ___

[issue11983] Inconsistent hash and comparison for code objects

2011-05-06 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: I would propose changing implementation to match the comment. At a minimum, remove co_firstlineno comparison. As the last resort, at least change the comment. -- ___ Python tracker

[issue11983] Inconsistent hash and comparison for code objects

2011-05-02 Thread Eugene Toder
New submission from Eugene Toder elto...@gmail.com: A comment in the definition of PyCodeObject in Include/code.h says: /* The rest doesn't count for hash or comparisons */ which, I think, makes a lot of sense. The implementation doesn't follow this comment, though. code_hash actually

[issue11983] Inconsistent hash and comparison for code objects

2011-05-02 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11983 ___ ___